Class: TinyClassifier::Retrainer
- Defined in:
- lib/tiny-classifier/retrainer.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Trainer
Methods inherited from Base
#classifier, #initialize, #parse_command_line_options
Constructor Details
This class inherits a constructor from TinyClassifier::Trainer
Class Method Details
.run(argv = nil) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/tiny-classifier/retrainer.rb', line 21 def run(argv=nil) argv ||= ARGV.dup retrainer = new *categories = retrainer.(argv) retrainer.run(wrong: categories[0], correct: categories[1]) end |
Instance Method Details
#run(params) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tiny-classifier/retrainer.rb', line 30 def run(params) if input.empty? error("Error: No effective input.") false else @category = params[:wrong] prepare_category classifier.send("untrain_#{@category}", input) @category = params[:correct] prepare_category classifier.send("train_#{@category}", input) save true end end |