Sha256: 851a947f68d3ff2745a01fb9b7372d2599b406493d6750127cbb7c35539ae4b2

Contents?: true

Size: 538 Bytes

Versions: 9

Compression:

Stored size: 538 Bytes

Contents

require File.dirname(__FILE__) + '/../../lib/ai4r/classifiers/naive_bayes'
require File.dirname(__FILE__) + '/../../lib/ai4r/data/data_set'
require File.dirname(__FILE__) + '/../../lib/ai4r/classifiers/id3'
require 'benchmark'

include Ai4r::Classifiers
include Ai4r::Data

data_set = DataSet.new
data_set.load_csv_with_labels File.dirname(__FILE__) + "/naive_bayes_data.csv"

b = NaiveBayes.new.
      set_parameters({:m=>3}).
      build data_set
p b.eval(["Red", "SUV", "Domestic"])
p b.get_probability_map(["Red", "SUV", "Domestic"])

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
nirvdrum-ai4r-1.9.1 examples/classifiers/naive_bayes_example.rb
ai4r-1.13 examples/classifiers/naive_bayes_example.rb
ai4r-1.12 examples/classifiers/naive_bayes_example.rb
ai4r-1.11 examples/classifiers/naive_bayes_example.rb
ai4ruby-1.14 examples/classifiers/naive_bayes_example.rb
ai4ruby-1.13 examples/classifiers/naive_bayes_example.rb
ai4ruby-1.12 examples/classifiers/naive_bayes_example.rb
ai4ruby-1.11 examples/classifiers/naive_bayes_example.rb
ai4r-1.9 examples/classifiers/naive_bayes_example.rb