Class: Trainer
- Inherits:
-
TinyClassifierBase
- Object
- TinyClassifierBase
- Trainer
- Defined in:
- lib/tiny-classifier/trainer.rb
Constant Summary
Constants inherited from TinyClassifierBase
TinyClassifierBase::TOKENIZERS
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Trainer
constructor
A new instance of Trainer.
- #run(params) ⇒ Object
Methods inherited from TinyClassifierBase
Constructor Details
#initialize ⇒ Trainer
Returns a new instance of Trainer.
28 29 30 31 |
# File 'lib/tiny-classifier/trainer.rb', line 28 def initialize super option_parser. += " LABEL" end |
Class Method Details
.run(argv = nil) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/tiny-classifier/trainer.rb', line 20 def run(argv=nil) argv ||= ARGV.dup trainer = new *labels = trainer.(argv) trainer.run(label: labels.first) end |
Instance Method Details
#run(params) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tiny-classifier/trainer.rb', line 33 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 |