Sha256: cd44110b813d012737c573c5a8634aa7864dfba94aa05a3bc11d748a52431f4a

Contents?: true

Size: 1.52 KB

Versions: 25

Compression:

Stored size: 1.52 KB

Contents

#include <CT.h>

#include <rice/rice.hpp>

#include "utils.h"

void init_ct(Rice::Module& m) {
  Rice::define_class_under<tomoto::ICTModel, tomoto::ILDAModel>(m, "CT")
    .define_singleton_function(
      "_new",
      [](size_t tw, size_t k, tomoto::Float alpha, tomoto::Float eta, size_t seed) {
        tomoto::CTArgs args;
        args.k = k;
        args.alpha = {alpha};
        args.eta = eta;
        if (seed >= 0) {
          args.seed = seed;
        }
        return tomoto::ICTModel::create((tomoto::TermWeight)tw, args);
      }, Rice::Return().takeOwnership())
    .define_method(
      "_correlations",
      [](tomoto::ICTModel& self, tomoto::Tid topic_id) {
        return self.getCorrelationTopic(topic_id);
      })
    .define_method(
      "num_beta_sample",
      [](tomoto::ICTModel& self) {
        return self.getNumBetaSample();
      })
    .define_method(
      "num_beta_sample=",
      [](tomoto::ICTModel& self, size_t value) {
        self.setNumBetaSample(value);
        return value;
      })
    .define_method(
      "num_tmn_sample",
      [](tomoto::ICTModel& self) {
        return self.getNumTMNSample();
      })
    .define_method(
      "num_tmn_sample=",
      [](tomoto::ICTModel& self, size_t value) {
        self.setNumTMNSample(value);
        return value;
      })
    .define_method(
      "_prior_cov",
      [](tomoto::ICTModel& self) {
        return self.getPriorCov();
      })
    .define_method(
      "prior_mean",
      [](tomoto::ICTModel& self) {
        return self.getPriorMean();
      });
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
tomoto-0.3.1 ext/tomoto/ct.cpp
tomoto-0.3.0-x86_64-linux ext/tomoto/ct.cpp
tomoto-0.3.0-x86_64-darwin ext/tomoto/ct.cpp
tomoto-0.3.0 ext/tomoto/ct.cpp
tomoto-0.2.3 ext/tomoto/ct.cpp