Class: TinyClassifier::Trainer
- Defined in:
- lib/tiny-classifier/trainer.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Trainer
constructor
A new instance of Trainer.
- #run(params) ⇒ Object
Methods inherited from Base
#classifier, #parse_command_line_options
Constructor Details
#initialize ⇒ Trainer
Returns a new instance of Trainer.
29 30 31 32 |
# File 'lib/tiny-classifier/trainer.rb', line 29 def initialize super option_parser. += " LABEL" end |
Class Method Details
.run(argv = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/tiny-classifier/trainer.rb', line 21 def run(argv=nil) argv ||= ARGV.dup trainer = new *labels = trainer.(argv) trainer.run(label: labels.first) end |
Instance Method Details
#run(params) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tiny-classifier/trainer.rb', line 34 def run(params) @label = params[:label] prepare_label if input.empty? STDERR.puts("Error: No effective input.") false else classifier.send("train_#{@label}", input) save true end end |