Last active
August 29, 2015 14:12
-
-
Save sdsdkkk/82d527b234e72cc17975 to your computer and use it in GitHub Desktop.
Train Classifier or Classifier Reborn's Bayes Classifier Using CSV File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'classifier' | |
require 'csv' | |
content = '' | |
File.open('training_set.csv', 'r') do |file| | |
content = file.read | |
end | |
training_set = CSV.parse content | |
b = Classifier::Bayes.new "label1", "label2", "label3" #put every category for the classification here | |
training_set.each do |t| | |
b.send("train_#{t.first}", t.last) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment