fathom 0.3.7 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/.autotest +7 -5
  2. data/.document +2 -2
  3. data/Gemfile +9 -10
  4. data/{LICENSE → LICENSE.txt} +1 -1
  5. data/README.md +29 -90
  6. data/Rakefile +34 -32
  7. data/VERSION +1 -1
  8. data/fathom.gemspec +105 -0
  9. data/features/fathom.feature +26 -0
  10. data/features/step_definitions/fathom_steps.rb +23 -0
  11. data/features/support/env.rb +13 -0
  12. data/lib/ext/array.rb +6 -2
  13. data/lib/ext/string.rb +86 -7
  14. data/lib/fathom.rb +51 -88
  15. data/lib/fathom/behaviors/attribute_system.rb +91 -0
  16. data/lib/fathom/behaviors/context_behavior.rb +28 -0
  17. data/lib/fathom/behaviors/plugins.rb +16 -0
  18. data/lib/fathom/contexts/network_population.rb +47 -0
  19. data/lib/fathom/contexts/network_traversal.rb +4 -0
  20. data/lib/fathom/data/adjacency_matrix.rb +27 -0
  21. data/lib/fathom/data/definition.rb +22 -0
  22. data/lib/fathom/data/edge.rb +58 -0
  23. data/lib/fathom/data/network.rb +35 -0
  24. data/lib/fathom/data/outcome.rb +30 -0
  25. data/lib/fathom/data/property.rb +31 -0
  26. data/lib/fathom/data/variable.rb +59 -0
  27. data/lib/fathom/roles/general_graph_tools.rb +87 -0
  28. data/lib/fathom/roles/network_builder.rb +61 -0
  29. data/spec/fathom/behaviors/attribute_system_spec.rb +141 -0
  30. data/spec/fathom/behaviors/context_behavior_spec.rb +15 -0
  31. data/spec/fathom/behaviors/plugins_spec.rb +80 -0
  32. data/spec/fathom/contexts/network_population_spec.rb +55 -0
  33. data/spec/fathom/contexts/network_traversal_spec.rb +11 -0
  34. data/spec/fathom/data/adjacency_matrix_spec.rb +42 -0
  35. data/spec/fathom/data/definition_spec.rb +19 -0
  36. data/spec/fathom/data/edge_spec.rb +77 -0
  37. data/spec/fathom/data/network_spec.rb +72 -0
  38. data/spec/fathom/data/outcome_spec.rb +17 -0
  39. data/spec/fathom/data/property_spec.rb +17 -0
  40. data/spec/fathom/data/variable_spec.rb +101 -0
  41. data/spec/fathom/ext/array_spec.rb +17 -0
  42. data/spec/fathom/ext/string_spec.rb +90 -0
  43. data/spec/fathom/roles/general_graph_tools_spec.rb +95 -0
  44. data/spec/fathom/roles/network_builder_spec.rb +90 -0
  45. data/spec/fathom_spec.rb +28 -49
  46. data/spec/spec_helper.rb +7 -11
  47. data/spec/support/context_behavior.rb +14 -0
  48. data/spec/support/custom_matchers.rb +12 -0
  49. data/spec/support/files.rb +8 -0
  50. data/spec/support/network.yml +42 -0
  51. metadata +133 -174
  52. data/.bundle/config +0 -2
  53. data/.gitignore +0 -6
  54. data/Gemfile.lock +0 -42
  55. data/TODO.md +0 -127
  56. data/autotest/discover.rb +0 -1
  57. data/lib/ext/faster_csv.rb +0 -1
  58. data/lib/ext/open_struct.rb +0 -17
  59. data/lib/fathom/agent.rb +0 -48
  60. data/lib/fathom/agent/agent_cluster.rb +0 -23
  61. data/lib/fathom/agent/properties.rb +0 -48
  62. data/lib/fathom/archive/causal_graph.rb +0 -12
  63. data/lib/fathom/archive/concept.rb +0 -83
  64. data/lib/fathom/archive/conditional_probability_matrix.rb +0 -119
  65. data/lib/fathom/archive/inverter.rb +0 -20
  66. data/lib/fathom/archive/n2.rb +0 -198
  67. data/lib/fathom/archive/n3.rb +0 -119
  68. data/lib/fathom/archive/node.rb +0 -97
  69. data/lib/fathom/archive/noodle.rb +0 -136
  70. data/lib/fathom/archive/scratch.rb +0 -45
  71. data/lib/fathom/distributions.rb +0 -8
  72. data/lib/fathom/distributions/discrete_gaussian.rb +0 -44
  73. data/lib/fathom/distributions/discrete_uniform.rb +0 -25
  74. data/lib/fathom/distributions/gaussian.rb +0 -46
  75. data/lib/fathom/distributions/uniform.rb +0 -35
  76. data/lib/fathom/import.rb +0 -85
  77. data/lib/fathom/import/csv_import.rb +0 -59
  78. data/lib/fathom/import/import_node.rb +0 -17
  79. data/lib/fathom/import/yaml_import.rb +0 -74
  80. data/lib/fathom/knowledge_base.rb +0 -46
  81. data/lib/fathom/knowledge_base/search.rb +0 -19
  82. data/lib/fathom/monte_carlo_set.rb +0 -152
  83. data/lib/fathom/node.rb +0 -139
  84. data/lib/fathom/node/belief_node.rb +0 -121
  85. data/lib/fathom/node/cpm_node.rb +0 -100
  86. data/lib/fathom/node/data_collection.rb +0 -97
  87. data/lib/fathom/node/data_node.rb +0 -22
  88. data/lib/fathom/node/decision.rb +0 -11
  89. data/lib/fathom/node/discrete_node.rb +0 -41
  90. data/lib/fathom/node/fact.rb +0 -24
  91. data/lib/fathom/node/mc_node.rb +0 -70
  92. data/lib/fathom/node/node_extensions/enforced_name.rb +0 -12
  93. data/lib/fathom/node/node_extensions/numeric_methods.rb +0 -68
  94. data/lib/fathom/node/plausible_range.rb +0 -98
  95. data/lib/fathom/simulation.rb +0 -59
  96. data/lib/fathom/simulation/tick_methods.rb +0 -25
  97. data/lib/fathom/simulation/tick_simulation.rb +0 -12
  98. data/lib/fathom/value_description.rb +0 -79
  99. data/lib/options_hash.rb +0 -186
  100. data/spec/ext/array_spec.rb +0 -10
  101. data/spec/ext/faster_csv_spec.rb +0 -10
  102. data/spec/ext/open_struct_spec.rb +0 -20
  103. data/spec/ext/string_spec.rb +0 -7
  104. data/spec/fathom/agent/agent_cluster_spec.rb +0 -17
  105. data/spec/fathom/agent_spec.rb +0 -51
  106. data/spec/fathom/distributions/discrete_gaussian_spec.rb +0 -64
  107. data/spec/fathom/distributions/discrete_uniform_spec.rb +0 -0
  108. data/spec/fathom/distributions/gaussian_spec.rb +0 -64
  109. data/spec/fathom/distributions/uniform_spec.rb +0 -0
  110. data/spec/fathom/import/csv_import_spec.rb +0 -52
  111. data/spec/fathom/import/import_node_spec.rb +0 -10
  112. data/spec/fathom/import/yaml_import_spec.rb +0 -73
  113. data/spec/fathom/import_spec.rb +0 -36
  114. data/spec/fathom/knowledge_base_spec.rb +0 -20
  115. data/spec/fathom/monte_carlo_set_spec.rb +0 -149
  116. data/spec/fathom/node/belief_node_spec.rb +0 -180
  117. data/spec/fathom/node/cpm_node_spec.rb +0 -144
  118. data/spec/fathom/node/data_collection_spec.rb +0 -26
  119. data/spec/fathom/node/data_node_spec.rb +0 -102
  120. data/spec/fathom/node/decision_spec.rb +0 -15
  121. data/spec/fathom/node/discrete_node_spec.rb +0 -56
  122. data/spec/fathom/node/fact_spec.rb +0 -33
  123. data/spec/fathom/node/mc_node_spec.rb +0 -66
  124. data/spec/fathom/node/node_extensions/enforced_name_spec.rb +0 -15
  125. data/spec/fathom/node/node_extensions/numeric_methods_spec.rb +0 -124
  126. data/spec/fathom/node/plausible_range_spec.rb +0 -151
  127. data/spec/fathom/node_spec.rb +0 -172
  128. data/spec/fathom/simulation/tick_simulation_spec.rb +0 -32
  129. data/spec/fathom/simulation_spec.rb +0 -24
  130. data/spec/fathom/value_description_spec.rb +0 -70
  131. data/spec/support/demo.yml +0 -17
  132. data/spec/support/demo_agent.rb +0 -8
  133. data/spec/support/dummy_numeric_node.rb +0 -8
  134. data/spec/support/fact.yml +0 -11
data/.autotest CHANGED
@@ -1,10 +1,12 @@
1
- # require 'autotest/fsevent'
2
- # require 'autotest/growl'
1
+ begin
2
+ require 'autotest/fsevent'
3
+ require 'autotest/growl'
4
+ rescue
5
+ # Don't complain if this OS X-specific functionality isn't available.
6
+ end
3
7
 
4
8
  Autotest.add_hook :initialize do |autotest|
5
- # Keeps me from calling something document_spec.rb
6
- # %w{.git .svn .hg .DS_Store ._* vendor tmp log doc}.each do |exception|
7
9
  %w{.git .svn .hg .DS_Store ._* vendor tmp log}.each do |exception|
8
10
  autotest.add_exception(exception)
9
11
  end
10
- end
12
+ end
data/.document CHANGED
@@ -1,5 +1,5 @@
1
- README.rdoc
2
1
  lib/**/*.rb
3
2
  bin/*
3
+ -
4
4
  features/**/*.feature
5
- LICENSE
5
+ LICENSE.txt
data/Gemfile CHANGED
@@ -1,14 +1,13 @@
1
- source 'http://rubygems.org'
1
+ source "http://rubygems.org"
2
2
 
3
- gem "fastercsv"
4
3
  gem 'uuid'
5
- # gem 'spira'
6
- # gem 'rdf'
7
- gem 'sparql-algebra'
8
4
 
9
- group :test do
10
- gem "ruby-debug"
11
- gem "rspec"
12
- gem "ZenTest"
5
+ # Add dependencies to develop your gem here.
6
+ # Include everything needed to run rake, tests, features, etc.
7
+ group :development do
8
+ gem "rspec", "~> 2.3.0"
9
+ gem "cucumber", ">= 0"
10
+ gem "jeweler", "~> 1.6.4"
11
+ gem "rcov", ">= 0"
12
+ gem "ruby-debug19"
13
13
  end
14
-
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 David
1
+ Copyright (c) 2011 David Richards
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -10,115 +10,54 @@ Welcome to Fathom. Fathom is a library for building decision support tools. Fa
10
10
  Stability Note
11
11
  ==============
12
12
 
13
- Please note that Fathom is not ready for production at this time. I happen to be using it in production for a few modeling projects, but it is undergoing some major architectural changes that won't be stabilized until I have release version 0.4, which will contain the Belief Networks, the Knowledge Base API, and a more complete cleanup of the code. One major change that's already in the system is the simulations and imports are all building a knowledge base as a graph. This makes it natural to use the output of a simulation as the input of a different model.
13
+ I've recently refactored this library. That makes the core Fathom quite stable, but much less useful. The specific functionality (various databases, say, GSL support, various graphical model algorithms) will be in yet-to-be-released gems. I'm going to stabilize these before releasing them to the public.
14
14
 
15
+ The gems I am actively working on are:
16
+
17
+ * fm-belief-network: a general gem for Bayesian inference
18
+ * fm-amalgalite-beliefs: a specific gem for Bayesian networks using SQLite3 and [Amalgalite](https://github.com/copiousfreetime/amalgalite)
19
+ * fm-goliath: A simple web service API using the wonderful network of gems associated with [Goliath](https://github.com/postrank-labs/goliath)
20
+
21
+ There are at least another dozen fm-* gems that live in some level of development. These are gems like fm-redis-beliefs, fm-clinical-decision-support, and fm-apophenia. I'll release these slowly and carefully as they go into production on real systems. That helps keep me from getting ahead of myself. If you're starting to see the power of how these tools can be used for your work, drop me a note and I could see if I can get your kind of analysis out in the Fathom set of gems.
15
22
 
16
23
  Inspiration for the Project
17
- ---------------------------
24
+ ===========================
18
25
 
19
26
  The ideas for this gem are coming from a lot of places:
20
27
 
21
28
  * Judea Pearl's work on causal graphs and belief networks. See [Causality](http://www.amazon.com/Causality-Reasoning-Inference-Judea-Pearl/dp/052189560X/ref=sr_1_1?s=books&ie=UTF8&qid=1288840948&sr=1-1) and [Probabilistic Reasoning in Intelligent Systems](http://www.amazon.com/Probabilistic-Reasoning-Intelligent-Systems-Plausible/dp/1558604790/ref=ntt_at_ep_dpi_2)
22
29
  * Douglas Hubbard's ideas on decision support. See [How to Measure Anything](http://www.amazon.com/How-Measure-Anything-Intangibles-Business/dp/0470539399/ref=sr_1_1?ie=UTF8&qid=1288840870&sr=8-1)
23
30
  * Ben Klemens' ideas on data analysis. See [Modeling with Data](http://modelingwithdata.org/about_the_book.html)
31
+ * Daphne Koller and Nir Friedman's ideas on [Probabilistic Graphical Models](http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=11886)
32
+
33
+ Goals
34
+ =====
24
35
 
25
36
  The goals of this project are:
26
37
 
27
- * Build a decoupled library with Ruby and the GSL
38
+ * Build a decoupled library with Ruby and the GSL (currently optional)
28
39
  * Make it easy to gather information of all types
29
40
  * Add tools to analyze the integration of knowledge
30
41
 
31
- Decoupled Library with Ruby and the GSL
32
- --------------------------------------------------------
33
-
34
- I use Ruby because it's very flexible and fast to write. I use the GSL because it's very fast, robust, and well-tested. I decouple the library so that it's easy to use the parts that are worthwhile for your problem and ignore the rest.
35
-
36
- Most of the library is about coordinating data nodes. So, an educated guess or the data that came out of a spreadsheet will sit in a particular kind of node. The system then allows us to relate this information. For example, a node that defines the income for a company would relate to the nodes that define the revenue and expenses of the company. All of this is done with some simple Ruby libraries to make things easy to coordinate.
37
-
38
- The statistics that we run are usually run on a GSL::Vector using various random number generators coming from the GSL. This is really the heart of what the GSL does for Fathom. A lot of the other tools may be used by some plugins for Fathom, and anyone using their computer to do open source data analysis probably has a good installation of the GSL in it.
39
-
40
- There are two bindings for Ruby and the GSL that I know of: [Ruby/GSL](http://rb-gsl.rubyforge.org/) and [ruby-gsl](https://github.com/codahale/ruby-gsl). Ruby/GSL is still maintained and has the syntax that we're using here.
41
-
42
- The decoupling is based on making every file as stand-alone as possible. What that means is we use autoload quite a bit in the library. Each file references the main lib/fathom.rb file, so that it can autoload any dependencies it may have. Also, most files have a test to see if they are being run from the command line at the bottom of the file. The goal is to make it fairly easy to run a single class in a message queue system, say, or as part of another script to get data into our knowledge base. In this sense, we're trying to follow some of the design principles of Unix: simple scripts that do one thing well and can combine with other scripts.
43
-
44
- Gathering Information
45
- -----------------------------
46
-
47
- Decision support is about making rational choices from the information available. This means that we do several things:
48
-
49
- * Make it fairly easy to load spreadsheet data in a CSV format
50
- * Add support for listing assumptions in a YAML file
51
- * Make it possible to link to RDF data and all of the external context that can be useful
52
- * Create links to richer data, such as ERP installations, databases, and web crawlers
53
-
54
- The data we gather is organized as a bunch of nodes in a graph. We also try to create ranges or probability distributions for everything, so that things become comparable and we can add things together fairly well. We also always know explicitly what our uncertainty is, so that we're not misleading ourselves. Importing conflicting data should be manageable if you're careful to document what you're loading.
55
-
56
- Also, we keep track of meta data. So, specific decisions are described in the knowledge base, as are references to other material, or other ways to describe what we're doing. In this way, we should be able to work on convincing the appropriate people (employees, executives, review boards) that we've made sound decisions and that we should commit resources to execute the plan.
57
-
58
- Tools for Analysis and Integration
59
- --------------------------------------------
60
-
61
- The integration tools in Fathom are:
62
-
63
- * Monte Carlo Simulations
64
- * Agent Based Models
65
- * Belief Networks
66
- * Causal Graphs
67
-
68
- These tools allow us to combine information in our knowledge base and run simulations or update beliefs to be able to see the larger perspective. These tools also offer insight into areas where more information should have the most return on investment. So, given a fairly limited amount of information, we can draw conclusions about what's going on, and pinpoint areas where we can refine our models and get more certain results.
69
-
70
- We are also adding Apophenia to the library. We'll be able to build data analysis tools outside of Fathom and then bring their results into our knowledge base and integrate it with the bigger picture. In this way, we'll be able to do all sorts of statistical analysis, machine learning, data mining, and other information-generating tasks without making Fathom too complicated.
71
-
72
- Apophenia is the pragmatic analysts dream. It's a C-based library that uses the GSL to do its analysis very quickly. It uses SQLite for data management, which makes set operations in memory optimal. It stores the models in consistent ways, so that it won't be hard to use this information inside of Fathom.
73
-
74
- There are also other kinds of external libraries whose analysis could be brought into Fathom through the import tools.
75
-
76
- The ultimate integration tool for Fathom is the web service. We are exposing access to all of the tools through a RESTful, JSON interface so that Fathom can be part of any sort of application. We also expect to publish basic HTML support for these same functions so that users can input and read their knowledge base without too much trouble.
77
-
78
- Further Information
79
- -------------------
80
-
81
- * You can use our [Wiki](https://github.com/davidrichards/fathom/wiki) to get code examples and see how things are coming along.
82
- * You can go to the [TODO](https://github.com/davidrichards/fathom/blob/master/TODO.md) page to see how current development is mapped out.
83
- * You can go to the [Fleet Ventures Blog](http://fleetventures.com) to get more in-depth tutorials and commentary about how to use these types of tools in business as well as a broader perspective of other technologies we use to solve these kinds of problems.
84
-
85
- Dependencies and Extensions
86
- ---------------------------
87
-
88
- This project relies on the [GNU Scientific Library](http://www.gnu.org/software/gsl/) and the [ruby/gsl](http://rb-gsl.rubyforge.org/) bindings for the GSL.
89
-
90
- Fathom has only minimal extensions on external libraries:
91
-
92
- * Array responds to rand (so [1,2,3].rand returns a random value from that array)
93
- * OpenStruct exposes it's underlying table, keys, and values
94
- * FasterCSV has a :strip header converter now
95
- * String has the constantize method added to it from the ActiveSupport library
42
+ Architecture
43
+ ============
96
44
 
97
- In the future, more optional dependencies will be introduced for parts of the library:
45
+ I've worked on this system for several years, rewriting it every once in a while. It has taught me more about analysis and software architecture than any other endeavor of my life. I've come to appreciate a few things in my work:
98
46
 
99
- * EventMachine is one that I'm sure will be added.
100
- * RDF.rb and related gems will be used for some of the KnowledgeBase
101
- * SQLite will be available for some set operations
102
- * One of the key/value data stores will be used for the KnowledgeBase (Riak, CouchDB, MongDO, Redis, or similar)
47
+ * Testing: I have thrown away a lot of hastily-written work that I could not come back and test properly. It's hard enough to have solid software with solid tests, it's insane to work on this kind of software without testing.
48
+ * Modularity: I'm learning a style of development that loosely follows [DCI](http://en.wikipedia.org/wiki/Data,_Context_and_Interaction) philosophies. I don't know if I've mastered these ideas, but it is a lot easier for me to have thin data models, contexts that support business goals, and interactions that can be well-monitored.
49
+ * Incremental Enhancement: It's nice when an idea can be expressed simply. If I need to get more complicated, I can mix in more specific code, or require another gem. In this way, I have Fathom that knows a little about graph algorithms, but fm-belief-networks that knows more about prior and posterior probabilities, conditional probability tables, and the workings of a Bayesian network. I further enhance these ideas in fm-amalgalite-beliefs with specific implementations of this data, stored in SQLite tables for the flexibility and speed of set operations in this embedded system. fm-redis-beliefs won't have the benefit of SQL for a query language, but will have the benefit of a federated key-value store for larger networks.
103
50
 
104
- It should be easy to avoid the parts of the library that use dependencies that you don't want to have. The goal for dependencies is:
51
+ I probably could/should write a book someday about what I'm learning about architecture. What this means for the practicing analyst is that we should have a fairly easy way of building models with tools that are appropriate to your problem. There should be little coupling, and lot of graceful experimentation between various tools that are being produced.
105
52
 
106
- * To use the best tool available for the job
107
- * Make it easy to avoid those parts of the library that use those dependencies
53
+ Contributing
54
+ ============
108
55
 
109
- For example, the in-memory version of the Knowledge Base will remain available for quick and dirty analysis.
56
+ If you'd like to contribute, you're welcome to do lots of things:
110
57
 
111
- Note on Patches/Pull Requests
112
- -----------------------------
113
-
114
- * Fork the project.
115
- * Make your feature addition or bug fix.
116
- * Add tests for it. This is important so I don't break it in a
117
- future version unintentionally.
118
- * Commit, do not mess with rakefile, version, or history.
119
- (if you want to have your own version, that is fine but
120
- bump version in a commit by itself I can ignore when I pull)
121
- * Send me a pull request. Bonus points for topic branches.
58
+ * fork a Fathom branch, write code with tests, and submit a merge request.
59
+ * write another fm-* gem that adds these tools with other tools you use.
60
+ * drop me a line and setup a pair programming session. We can build some tools together and get you on your way quickly.
122
61
 
123
62
  Copyright
124
63
  ---------
@@ -128,7 +67,7 @@ Copyright
128
67
  * FasterCSV is released under the [GPL Version 2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) license.
129
68
  * Ruby is released under [this license](http://www.ruby-lang.org/en/LICENSE.txt).
130
69
 
131
- Copyright (c) 2010 David Richards
70
+ Copyright (c) 2010-2011 Fleet Ventures, Inc.
132
71
 
133
72
  Permission is hereby granted, free of charge, to any person obtaining
134
73
  a copy of this software and associated documentation files (the
@@ -147,4 +86,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
147
86
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
148
87
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
149
88
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
150
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
89
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,47 +1,49 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
2
12
  require 'rake'
3
13
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "fathom"
8
- gem.summary = %Q{Decision Support in Ruby}
9
- gem.description = %Q{Collecting some decision support tools in a decoupled Ruby library.}
10
- gem.email = "davidlamontrichards@gmail.com"
11
- gem.homepage = "http://github.com/davidrichards/fathom"
12
- gem.authors = ["David"]
13
- gem.add_development_dependency "rspec"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "fathom"
18
+ gem.homepage = "http://github.com/davidrichards/fathom"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Decision support in Ruby}
21
+ gem.description = %Q{A framework for building analytical models in Ruby and supporting systems. This is meant to be a flexible tool for many kinds of models, and should grow gently over time.}
22
+ gem.email = "davidlamontrichards@gmail.com"
23
+ gem.authors = ["David Richards"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
19
32
  end
20
33
 
21
- require "rspec/core/rake_task"
22
- RSpec::Core::RakeTask.new(:core) do |spec|
23
- spec.pattern = 'spec/fathom/*_spec.rb'
24
- # spec.rspec_opts = ['--backtrace']
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
25
37
  end
26
38
 
27
- #
28
- # Spec::Rake::SpecTask.new(:rcov) do |spec|
29
- # spec.libs << 'lib' << 'spec'
30
- # spec.pattern = 'spec/**/*_spec.rb'
31
- # spec.rcov = true
32
- # end
33
- #
34
- # task :spec => :check_dependencies
39
+ require 'cucumber/rake/task'
40
+ Cucumber::Rake::Task.new(:features)
35
41
 
36
42
  task :default => :spec
37
43
 
38
44
  require 'rake/rdoctask'
39
45
  Rake::RDocTask.new do |rdoc|
40
- if File.exist?('VERSION')
41
- version = File.read('VERSION')
42
- else
43
- version = ""
44
- end
46
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
47
 
46
48
  rdoc.rdoc_dir = 'rdoc'
47
49
  rdoc.title = "fathom #{version}"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.7
1
+ 0.5.0
@@ -0,0 +1,105 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "fathom"
8
+ s.version = "0.5.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["David Richards"]
12
+ s.date = "2011-10-31"
13
+ s.description = "A framework for building analytical models in Ruby and supporting systems. This is meant to be a flexible tool for many kinds of models, and should grow gently over time."
14
+ s.email = "davidlamontrichards@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".autotest",
21
+ ".document",
22
+ ".rspec",
23
+ "Gemfile",
24
+ "LICENSE.txt",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "fathom.gemspec",
29
+ "features/fathom.feature",
30
+ "features/step_definitions/fathom_steps.rb",
31
+ "features/support/env.rb",
32
+ "lib/ext/array.rb",
33
+ "lib/ext/string.rb",
34
+ "lib/fathom.rb",
35
+ "lib/fathom/behaviors/attribute_system.rb",
36
+ "lib/fathom/behaviors/context_behavior.rb",
37
+ "lib/fathom/behaviors/plugins.rb",
38
+ "lib/fathom/contexts/network_population.rb",
39
+ "lib/fathom/contexts/network_traversal.rb",
40
+ "lib/fathom/data/adjacency_matrix.rb",
41
+ "lib/fathom/data/definition.rb",
42
+ "lib/fathom/data/edge.rb",
43
+ "lib/fathom/data/network.rb",
44
+ "lib/fathom/data/outcome.rb",
45
+ "lib/fathom/data/property.rb",
46
+ "lib/fathom/data/variable.rb",
47
+ "lib/fathom/roles/general_graph_tools.rb",
48
+ "lib/fathom/roles/network_builder.rb",
49
+ "spec/fathom/behaviors/attribute_system_spec.rb",
50
+ "spec/fathom/behaviors/context_behavior_spec.rb",
51
+ "spec/fathom/behaviors/plugins_spec.rb",
52
+ "spec/fathom/contexts/network_population_spec.rb",
53
+ "spec/fathom/contexts/network_traversal_spec.rb",
54
+ "spec/fathom/data/adjacency_matrix_spec.rb",
55
+ "spec/fathom/data/definition_spec.rb",
56
+ "spec/fathom/data/edge_spec.rb",
57
+ "spec/fathom/data/network_spec.rb",
58
+ "spec/fathom/data/outcome_spec.rb",
59
+ "spec/fathom/data/property_spec.rb",
60
+ "spec/fathom/data/variable_spec.rb",
61
+ "spec/fathom/ext/array_spec.rb",
62
+ "spec/fathom/ext/string_spec.rb",
63
+ "spec/fathom/roles/general_graph_tools_spec.rb",
64
+ "spec/fathom/roles/network_builder_spec.rb",
65
+ "spec/fathom_spec.rb",
66
+ "spec/spec_helper.rb",
67
+ "spec/support/context_behavior.rb",
68
+ "spec/support/custom_matchers.rb",
69
+ "spec/support/files.rb",
70
+ "spec/support/network.yml"
71
+ ]
72
+ s.homepage = "http://github.com/davidrichards/fathom"
73
+ s.licenses = ["MIT"]
74
+ s.require_paths = ["lib"]
75
+ s.rubygems_version = "1.8.11"
76
+ s.summary = "Decision support in Ruby"
77
+
78
+ if s.respond_to? :specification_version then
79
+ s.specification_version = 3
80
+
81
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
82
+ s.add_runtime_dependency(%q<uuid>, [">= 0"])
83
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
84
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
85
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
86
+ s.add_development_dependency(%q<rcov>, [">= 0"])
87
+ s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
88
+ else
89
+ s.add_dependency(%q<uuid>, [">= 0"])
90
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
91
+ s.add_dependency(%q<cucumber>, [">= 0"])
92
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
93
+ s.add_dependency(%q<rcov>, [">= 0"])
94
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
95
+ end
96
+ else
97
+ s.add_dependency(%q<uuid>, [">= 0"])
98
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
99
+ s.add_dependency(%q<cucumber>, [">= 0"])
100
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
101
+ s.add_dependency(%q<rcov>, [">= 0"])
102
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
103
+ end
104
+ end
105
+
@@ -0,0 +1,26 @@
1
+ Feature: Graph Methods
2
+ In order to store knowledge in graphs
3
+ As an analyst
4
+ I want to be able to build a graph from a complete description
5
+
6
+ Scenario: Building with a Hash
7
+ Given a full description of a graph in a Hash format
8
+ When I build a network from that description
9
+ Then I should get a network with variables
10
+
11
+ Scenario: Building with YAML
12
+ Given a full description of a graph in a YAML format
13
+ When I build a network from that description
14
+ Then I should get a network with variables
15
+
16
+ Scenario: Building with XMLBIF
17
+ Given a full description of a graph in a XMLBIF format
18
+ When I build a network from that description
19
+ Then I should get a network with variables
20
+
21
+ Scenario: Building a directed adjacency matrix
22
+ Given a defined network
23
+ When I ask it to build the adjacency matrix
24
+ Then I should have a matrix that marks the edges between variables
25
+
26
+ # Possibly I'll build more of the graph features here. Certainly I'll finish them in the specs.
@@ -0,0 +1,23 @@
1
+ Given /^a full description of a graph in a (.+) format$/ do |format|
2
+ pending # express the regexp above with the code you wish you had
3
+ end
4
+
5
+ When /^I build a network from that description$/ do
6
+ pending # express the regexp above with the code you wish you had
7
+ end
8
+
9
+ Then /^I should get a network with variables$/ do
10
+ pending # express the regexp above with the code you wish you had
11
+ end
12
+
13
+ Given /^a defined network$/ do
14
+ pending # express the regexp above with the code you wish you had
15
+ end
16
+
17
+ When /^I ask it to build the adjacency matrix$/ do
18
+ pending # express the regexp above with the code you wish you had
19
+ end
20
+
21
+ Then /^I should have a matrix that marks the edges between variables$/ do
22
+ pending # express the regexp above with the code you wish you had
23
+ end