Class: Tomoto::SLDA
- Inherits:
-
Object
- Object
- Tomoto::SLDA
- Defined in:
- lib/tomoto/slda.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, vars: "", alpha: 0.1, eta: 0.01, mu: [], nu_sq: [], glm_param: [], seed: nil) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/tomoto/slda.rb', line 3 def self.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, k: 1, vars: "", alpha: 0.1, eta: 0.01, mu: [], nu_sq: [], glm_param: [], seed: nil) model = _new(to_tw(tw), k, vars.split("").map { |v| to_glm(v) }, alpha, eta, mu, nu_sq, glm_param, 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
#add_doc(doc, y: []) ⇒ Object
11 12 13 |
# File 'lib/tomoto/slda.rb', line 11 def add_doc(doc, y: []) _add_doc(prepare_doc(doc), y) end |
#var_type(var_id) ⇒ Object
15 16 17 18 |
# File 'lib/tomoto/slda.rb', line 15 def var_type(var_id) raise "train() should be called first" unless @prepared _var_type(var_id) end |