Class: Tomoto::HLDA
- Inherits:
-
Object
- Object
- Tomoto::HLDA
- Defined in:
- lib/tomoto/hlda.rb
Class Method Summary collapse
Instance Method Summary collapse
- #children_topics(topic_id) ⇒ Object
- #level(topic_id) ⇒ Object
- #live_topic?(topic_id) ⇒ Boolean
- #num_docs_of_topic(topic_id) ⇒ Object
- #parent_topic(topic_id) ⇒ Object
Class Method Details
.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, depth: 2, alpha: 0.1, eta: 0.01, gamma: 0.1, seed: nil) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/tomoto/hlda.rb', line 3 def self.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, depth: 2, alpha: 0.1, eta: 0.01, gamma: 0.1, seed: nil) model = _new(to_tw(tw), depth, alpha, eta, gamma, 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
#children_topics(topic_id) ⇒ Object
11 12 13 14 |
# File 'lib/tomoto/hlda.rb', line 11 def children_topics(topic_id) check_topic(topic_id) _children_topics(topic_id) end |
#level(topic_id) ⇒ Object
16 17 18 19 |
# File 'lib/tomoto/hlda.rb', line 16 def level(topic_id) check_topic(topic_id) _live_topic?(topic_id) ? _level(topic_id) : -1 end |
#live_topic?(topic_id) ⇒ Boolean
21 22 23 24 |
# File 'lib/tomoto/hlda.rb', line 21 def live_topic?(topic_id) check_topic(topic_id) _live_topic?(topic_id) end |
#num_docs_of_topic(topic_id) ⇒ Object
26 27 28 29 |
# File 'lib/tomoto/hlda.rb', line 26 def num_docs_of_topic(topic_id) check_topic(topic_id) _num_docs_of_topic(topic_id) end |
#parent_topic(topic_id) ⇒ Object
31 32 33 34 |
# File 'lib/tomoto/hlda.rb', line 31 def parent_topic(topic_id) check_topic(topic_id) _live_topic?(topic_id) ? _parent_topic(topic_id) : -1 end |