Class: Tomoto::CT

Inherits:
Object
  • Object
show all
Defined in:
lib/tomoto/ct.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, k: 1, alpha: 0.1, eta: 0.01, seed: nil) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/tomoto/ct.rb', line 3

def self.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, k: 1, alpha: 0.1, eta: 0.01, seed: nil)
  model = _new(to_tw(tw), k, alpha, eta, seed || -1)
  model.instance_variable_set(:@min_cf, min_cf)
  model.instance_variable_set(:@min_df, min_df)
  model.instance_variable_set(:@rm_top, rm_top)
  init_params(model, binding)
end

Instance Method Details

#correlations(topic_id = nil) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/tomoto/ct.rb', line 11

def correlations(topic_id = nil)
  prepare
  if topic_id
    _correlations(topic_id)
  else
    k.times.map { |i| _correlations(i) }
  end
end

#prior_covObject



20
21
22
# File 'lib/tomoto/ct.rb', line 20

def prior_cov
  _prior_cov.each_slice(k).to_a
end