naive_bayes 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,9 +30,10 @@ You can also tell your classifier to save itself, so its easy for you to pick up
30
30
  a = NaiveBayes.new(:spam, :ham)
31
31
  a.db_filepath = 'path/to/anywhere.nb'
32
32
 
33
- # Save is called after every train function
34
33
  a.train(:spam, 'bad', 'word')
35
34
  a.train(:ham, 'good', 'word')
35
+
36
+ a.save
36
37
 
37
38
  Some time goes past and we want to classify a new document we just received...
38
39
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -73,7 +73,7 @@ class NaiveBayes
73
73
 
74
74
  # P(Feature | Class)
75
75
  def prob_of_feature_given_a_class(feature, klass)
76
- return assumed_probability if @klass_count[klass] == 0
76
+ return assumed_probability if @features_count[klass][feature] == 0
77
77
  @features_count[klass][feature] / @klass_count[klass]
78
78
  end
79
79
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{naive_bayes}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["reddavis"]
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.homepage = %q{http://github.com/reddavis/Naive-Bayes}
34
34
  s.rdoc_options = ["--charset=UTF-8"]
35
35
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.3.5}
36
+ s.rubygems_version = %q{1.3.6}
37
37
  s.summary = %q{Simple straight forward Naive Bayes classifier implementation}
38
38
  s.test_files = [
39
39
  "spec/naive_bayes_spec.rb",
@@ -1 +1 @@
1
- o:NaiveBayes :@features_count{: spam}I"bad:
1
+ o:NaiveBayes :@klass_count{: spamf1:hamf1:@db_filepath"U/Users/reddavis/Documents/projects/machine_learning/naive_bayes/spec/db/naive.nb:@features_count{;}" wordf1"badf1f0;}"wef1"badf1@:
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naive_bayes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 3
9
+ version: 0.0.3
5
10
  platform: ruby
6
11
  authors:
7
12
  - reddavis
@@ -14,14 +19,18 @@ default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 9
23
31
  version: 1.2.9
24
- version:
32
+ type: :development
33
+ version_requirements: *id001
25
34
  description: Simple straight forward Naive Bayes classifier implementation
26
35
  email: reddavis@gmail.com
27
36
  executables: []
@@ -57,18 +66,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
66
  requirements:
58
67
  - - ">="
59
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
60
71
  version: "0"
61
- version:
62
72
  required_rubygems_version: !ruby/object:Gem::Requirement
63
73
  requirements:
64
74
  - - ">="
65
75
  - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
66
78
  version: "0"
67
- version:
68
79
  requirements: []
69
80
 
70
81
  rubyforge_project:
71
- rubygems_version: 1.3.5
82
+ rubygems_version: 1.3.6
72
83
  signing_key:
73
84
  specification_version: 3
74
85
  summary: Simple straight forward Naive Bayes classifier implementation