fathom 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/.autotest +10 -0
  2. data/Gemfile +10 -2
  3. data/Gemfile.lock +8 -0
  4. data/TODO.md +12 -25
  5. data/VERSION +1 -1
  6. data/lib/{fathom/ext → ext}/array.rb +0 -0
  7. data/lib/{fathom/ext → ext}/faster_csv.rb +0 -0
  8. data/lib/{fathom/ext → ext}/open_struct.rb +0 -0
  9. data/lib/{fathom/ext → ext}/string.rb +0 -0
  10. data/lib/fathom.rb +16 -13
  11. data/lib/fathom/agent.rb +8 -9
  12. data/lib/fathom/{causal_graph.rb → archive/causal_graph.rb} +0 -0
  13. data/lib/fathom/{concept.rb → archive/concept.rb} +0 -0
  14. data/lib/fathom/archive/conditional_probability_matrix.rb +3 -0
  15. data/lib/fathom/{inverter.rb → archive/inverter.rb} +0 -0
  16. data/lib/fathom/archive/node.rb +24 -1
  17. data/lib/fathom/distributions/discrete_uniform.rb +11 -32
  18. data/lib/fathom/import.rb +37 -34
  19. data/lib/fathom/import/yaml_import.rb +22 -1
  20. data/lib/fathom/knowledge_base.rb +34 -23
  21. data/lib/fathom/knowledge_base/search.rb +19 -0
  22. data/lib/fathom/node.rb +32 -1
  23. data/lib/fathom/node/belief_node.rb +121 -0
  24. data/lib/fathom/node/cpm_node.rb +100 -0
  25. data/lib/fathom/node/data_collection.rb +97 -0
  26. data/lib/fathom/{data_node.rb → node/data_node.rb} +1 -1
  27. data/lib/fathom/{value_aggregator.rb → node/decision.rb} +5 -5
  28. data/lib/fathom/node/discrete_node.rb +41 -0
  29. data/lib/fathom/node/fact.rb +24 -0
  30. data/lib/fathom/{mc_node.rb → node/mc_node.rb} +1 -1
  31. data/lib/fathom/{enforced_name.rb → node/node_extensions/enforced_name.rb} +1 -1
  32. data/lib/fathom/{numeric_methods.rb → node/node_extensions/numeric_methods.rb} +19 -1
  33. data/lib/fathom/{plausible_range.rb → node/plausible_range.rb} +1 -1
  34. data/spec/ext/array_spec.rb +10 -0
  35. data/spec/ext/faster_csv_spec.rb +10 -0
  36. data/spec/ext/open_struct_spec.rb +20 -0
  37. data/spec/ext/string_spec.rb +7 -0
  38. data/spec/fathom/import/csv_import_spec.rb +11 -9
  39. data/spec/fathom/import/yaml_import_spec.rb +27 -7
  40. data/spec/fathom/knowledge_base_spec.rb +8 -4
  41. data/spec/fathom/node/belief_node_spec.rb +180 -0
  42. data/spec/fathom/node/cpm_node_spec.rb +144 -0
  43. data/spec/fathom/node/data_collection_spec.rb +26 -0
  44. data/spec/fathom/{data_node_spec.rb → node/data_node_spec.rb} +1 -1
  45. data/spec/fathom/node/decision_spec.rb +15 -0
  46. data/spec/fathom/node/discrete_node_spec.rb +56 -0
  47. data/spec/fathom/node/fact_spec.rb +33 -0
  48. data/spec/fathom/{mc_node_spec.rb → node/mc_node_spec.rb} +1 -1
  49. data/spec/fathom/{enforced_name_spec.rb → node/node_extensions/enforced_name_spec.rb} +1 -1
  50. data/spec/fathom/{numeric_methods_spec.rb → node/node_extensions/numeric_methods_spec.rb} +53 -11
  51. data/spec/fathom/{plausible_range_spec.rb → node/plausible_range_spec.rb} +1 -1
  52. data/spec/fathom/node_spec.rb +17 -0
  53. data/spec/fathom_spec.rb +40 -0
  54. data/spec/spec_helper.rb +3 -0
  55. data/spec/support/fact.yml +11 -0
  56. metadata +57 -30
  57. data/lib/fathom/value_multiplier.rb +0 -18
@@ -1,9 +1,12 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
3
4
  require 'fathom'
4
5
  require 'rspec'
5
6
  require 'rspec/autorun'
6
7
 
8
+ include Fathom
9
+
7
10
  # Requires supporting ruby files in spec/support/ and its subdirectories.
8
11
  Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f}
9
12
 
@@ -0,0 +1,11 @@
1
+ Fact:
2
+ name: One
3
+ value: 1
4
+
5
+ fact:
6
+ name: Two
7
+ value: 2
8
+
9
+ :fact:
10
+ name: Three
11
+ value: 3
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fathom
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 17
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - David
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-15 00:00:00 -07:00
18
+ date: 2011-02-10 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,6 +42,7 @@ extra_rdoc_files:
42
42
  - LICENSE
43
43
  - README.md
44
44
  files:
45
+ - .autotest
45
46
  - .bundle/config
46
47
  - .document
47
48
  - .gitignore
@@ -54,65 +55,80 @@ files:
54
55
  - TODO.md
55
56
  - VERSION
56
57
  - autotest/discover.rb
58
+ - lib/ext/array.rb
59
+ - lib/ext/faster_csv.rb
60
+ - lib/ext/open_struct.rb
61
+ - lib/ext/string.rb
57
62
  - lib/fathom.rb
58
63
  - lib/fathom/agent.rb
59
64
  - lib/fathom/agent/agent_cluster.rb
60
65
  - lib/fathom/agent/properties.rb
66
+ - lib/fathom/archive/causal_graph.rb
67
+ - lib/fathom/archive/concept.rb
61
68
  - lib/fathom/archive/conditional_probability_matrix.rb
69
+ - lib/fathom/archive/inverter.rb
62
70
  - lib/fathom/archive/n2.rb
63
71
  - lib/fathom/archive/n3.rb
64
72
  - lib/fathom/archive/node.rb
65
73
  - lib/fathom/archive/noodle.rb
66
74
  - lib/fathom/archive/scratch.rb
67
- - lib/fathom/causal_graph.rb
68
- - lib/fathom/concept.rb
69
- - lib/fathom/data_node.rb
70
75
  - lib/fathom/distributions.rb
71
76
  - lib/fathom/distributions/discrete_gaussian.rb
72
77
  - lib/fathom/distributions/discrete_uniform.rb
73
78
  - lib/fathom/distributions/gaussian.rb
74
79
  - lib/fathom/distributions/uniform.rb
75
- - lib/fathom/enforced_name.rb
76
- - lib/fathom/ext/array.rb
77
- - lib/fathom/ext/faster_csv.rb
78
- - lib/fathom/ext/open_struct.rb
79
- - lib/fathom/ext/string.rb
80
80
  - lib/fathom/import.rb
81
81
  - lib/fathom/import/csv_import.rb
82
82
  - lib/fathom/import/import_node.rb
83
83
  - lib/fathom/import/yaml_import.rb
84
- - lib/fathom/inverter.rb
85
84
  - lib/fathom/knowledge_base.rb
86
- - lib/fathom/mc_node.rb
85
+ - lib/fathom/knowledge_base/search.rb
87
86
  - lib/fathom/monte_carlo_set.rb
88
87
  - lib/fathom/node.rb
89
- - lib/fathom/numeric_methods.rb
90
- - lib/fathom/plausible_range.rb
88
+ - lib/fathom/node/belief_node.rb
89
+ - lib/fathom/node/cpm_node.rb
90
+ - lib/fathom/node/data_collection.rb
91
+ - lib/fathom/node/data_node.rb
92
+ - lib/fathom/node/decision.rb
93
+ - lib/fathom/node/discrete_node.rb
94
+ - lib/fathom/node/fact.rb
95
+ - lib/fathom/node/mc_node.rb
96
+ - lib/fathom/node/node_extensions/enforced_name.rb
97
+ - lib/fathom/node/node_extensions/numeric_methods.rb
98
+ - lib/fathom/node/plausible_range.rb
91
99
  - lib/fathom/simulation.rb
92
100
  - lib/fathom/simulation/tick_methods.rb
93
101
  - lib/fathom/simulation/tick_simulation.rb
94
- - lib/fathom/value_aggregator.rb
95
102
  - lib/fathom/value_description.rb
96
- - lib/fathom/value_multiplier.rb
97
103
  - lib/options_hash.rb
104
+ - spec/ext/array_spec.rb
105
+ - spec/ext/faster_csv_spec.rb
106
+ - spec/ext/open_struct_spec.rb
107
+ - spec/ext/string_spec.rb
98
108
  - spec/fathom/agent/agent_cluster_spec.rb
99
109
  - spec/fathom/agent_spec.rb
100
- - spec/fathom/data_node_spec.rb
101
110
  - spec/fathom/distributions/discrete_gaussian_spec.rb
102
111
  - spec/fathom/distributions/discrete_uniform_spec.rb
103
112
  - spec/fathom/distributions/gaussian_spec.rb
104
113
  - spec/fathom/distributions/uniform_spec.rb
105
- - spec/fathom/enforced_name_spec.rb
106
114
  - spec/fathom/import/csv_import_spec.rb
107
115
  - spec/fathom/import/import_node_spec.rb
108
116
  - spec/fathom/import/yaml_import_spec.rb
109
117
  - spec/fathom/import_spec.rb
110
118
  - spec/fathom/knowledge_base_spec.rb
111
- - spec/fathom/mc_node_spec.rb
112
119
  - spec/fathom/monte_carlo_set_spec.rb
120
+ - spec/fathom/node/belief_node_spec.rb
121
+ - spec/fathom/node/cpm_node_spec.rb
122
+ - spec/fathom/node/data_collection_spec.rb
123
+ - spec/fathom/node/data_node_spec.rb
124
+ - spec/fathom/node/decision_spec.rb
125
+ - spec/fathom/node/discrete_node_spec.rb
126
+ - spec/fathom/node/fact_spec.rb
127
+ - spec/fathom/node/mc_node_spec.rb
128
+ - spec/fathom/node/node_extensions/enforced_name_spec.rb
129
+ - spec/fathom/node/node_extensions/numeric_methods_spec.rb
130
+ - spec/fathom/node/plausible_range_spec.rb
113
131
  - spec/fathom/node_spec.rb
114
- - spec/fathom/numeric_methods_spec.rb
115
- - spec/fathom/plausible_range_spec.rb
116
132
  - spec/fathom/simulation/tick_simulation_spec.rb
117
133
  - spec/fathom/simulation_spec.rb
118
134
  - spec/fathom/value_description_spec.rb
@@ -121,6 +137,7 @@ files:
121
137
  - spec/support/demo.yml
122
138
  - spec/support/demo_agent.rb
123
139
  - spec/support/dummy_numeric_node.rb
140
+ - spec/support/fact.yml
124
141
  has_rdoc: true
125
142
  homepage: http://github.com/davidrichards/fathom
126
143
  licenses: []
@@ -151,29 +168,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
168
  requirements: []
152
169
 
153
170
  rubyforge_project:
154
- rubygems_version: 1.3.7
171
+ rubygems_version: 1.5.0
155
172
  signing_key:
156
173
  specification_version: 3
157
174
  summary: Decision Support in Ruby
158
175
  test_files:
176
+ - spec/ext/array_spec.rb
177
+ - spec/ext/faster_csv_spec.rb
178
+ - spec/ext/open_struct_spec.rb
179
+ - spec/ext/string_spec.rb
159
180
  - spec/fathom/agent/agent_cluster_spec.rb
160
181
  - spec/fathom/agent_spec.rb
161
- - spec/fathom/data_node_spec.rb
162
182
  - spec/fathom/distributions/discrete_gaussian_spec.rb
163
183
  - spec/fathom/distributions/discrete_uniform_spec.rb
164
184
  - spec/fathom/distributions/gaussian_spec.rb
165
185
  - spec/fathom/distributions/uniform_spec.rb
166
- - spec/fathom/enforced_name_spec.rb
167
186
  - spec/fathom/import/csv_import_spec.rb
168
187
  - spec/fathom/import/import_node_spec.rb
169
188
  - spec/fathom/import/yaml_import_spec.rb
170
189
  - spec/fathom/import_spec.rb
171
190
  - spec/fathom/knowledge_base_spec.rb
172
- - spec/fathom/mc_node_spec.rb
173
191
  - spec/fathom/monte_carlo_set_spec.rb
192
+ - spec/fathom/node/belief_node_spec.rb
193
+ - spec/fathom/node/cpm_node_spec.rb
194
+ - spec/fathom/node/data_collection_spec.rb
195
+ - spec/fathom/node/data_node_spec.rb
196
+ - spec/fathom/node/decision_spec.rb
197
+ - spec/fathom/node/discrete_node_spec.rb
198
+ - spec/fathom/node/fact_spec.rb
199
+ - spec/fathom/node/mc_node_spec.rb
200
+ - spec/fathom/node/node_extensions/enforced_name_spec.rb
201
+ - spec/fathom/node/node_extensions/numeric_methods_spec.rb
202
+ - spec/fathom/node/plausible_range_spec.rb
174
203
  - spec/fathom/node_spec.rb
175
- - spec/fathom/numeric_methods_spec.rb
176
- - spec/fathom/plausible_range_spec.rb
177
204
  - spec/fathom/simulation/tick_simulation_spec.rb
178
205
  - spec/fathom/simulation_spec.rb
179
206
  - spec/fathom/value_description_spec.rb
@@ -1,18 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'fathom'))
2
- module Fathom
3
- class ValueMultiplier < ValueDescription
4
-
5
- def default_process
6
- obj.values.inject(0.0) do |s, e|
7
- s *= e
8
- end
9
- end
10
- protected :default_process
11
- end
12
- end
13
-
14
- if __FILE__ == $0
15
- include Fathom
16
- # TODO: Is there anything you want to do to run this file on its own?
17
- # ValueMultiplier.new
18
- end