Sha256: 408eb87052e2c8f63f2c41f7effe4f57d9c0d58f8a5be0aada15714f9ed45e9e
Contents?: true
Size: 551 Bytes
Versions: 1
Compression:
Stored size: 551 Bytes
Contents
module LearnKit module NaiveBayes class Gaussian # Calc accuracy for test data module Score # calculate accuracy for test data def score(total = 0, correct = 0) labels.each do |label_name| data_set[label_name].each do |feature| predicted_label = predict(feature) correct += 1 if predicted_label == label_name total += 1 end end total.zero? ? 0 : (correct * 100.0 / total).round(4) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
learn_kit-0.0.1 | lib/learn_kit/naive_bayes/gaussian/score.rb |