Module: Fathom
- Defined in:
- lib/fathom/import.rb,
lib/fathom.rb,
lib/fathom/distributions.rb,
lib/fathom/knowledge_base.rb,
lib/fathom/archive/concept.rb,
lib/fathom/agent/properties.rb,
lib/fathom/archive/inverter.rb,
lib/fathom/import/csv_import.rb,
lib/fathom/value_description.rb,
lib/fathom/archive/causal_graph.rb,
lib/fathom/node/plausible_range.rb,
lib/fathom/knowledge_base/search.rb,
lib/fathom/simulation/tick_methods.rb,
lib/fathom/simulation/tick_simulation.rb,
lib/fathom/node/node_extensions/enforced_name.rb,
lib/fathom/node/node_extensions/numeric_methods.rb
Overview
The import scripts are meant to make it easier to build up a knowledge base from
real data. There are a lot of ways we could get our data: YAML files, spreadsheets,
web crawlers, relational databases, RDF data. The Import class creates a regular
way to create nodes in the knowledge base. The following example would be a
simple way to import some data about weekend trips:
class WeekendPlanningImport < Import
def import_plausible_data
values = [
{:name => 'Chance of Rain', :min => 0.2, :max => 0.3, :confidence_interval => 0.8},
{:name => 'Would Go to the Beach Despite the Rain', :min => 0, :max => 0.2},
{:name => 'Would Go to the Movies if Something Good Was Playing', :min => 0.8, :max => 1.0},
{:name => 'Would Go to the Movies Despite the Rain', :min => 0.9, :max => 1.0}
]
return [PlausibleRange, values]
end
def import_destination_data
value_hash = FasterCSV...
return [DataNode, value_hash]
end
end
Each import method is starts with 'import_' and returns an array of [NodeClass, values_hash].
The Import class will then create a series of nodes and insert them into the active knowledge
base.
There are a number of useful Import classes that make most data imports fairly straight forward.
This way data from spreadsheets or YAML files can easily be added to the knowledge base.
Defined Under Namespace
Modules: Distributions, EnforcedName, NumericMethods, Properties, Search, TickMethods Classes: Agent, AgentCluster, BeliefNode, CPMNode, CSVImport, CausalGraph, Concept, DataCollection, DataNode, Decision, DiscreteNode, Fact, Import, ImportNode, Invertor, KnowledgeBase, MCNode, MonteCarloSet, Node, PlausibleRange, Simulation, TickSimulation, ValueDescription, YAMLImport
Instance Method Summary collapse
- #knowledge_base ⇒ Object (also: #kb)
-
#repo ⇒ Object
Go ahead and create a generic repo for Fathom.
Instance Method Details
#knowledge_base ⇒ Object Also known as: kb
65 66 67 |
# File 'lib/fathom.rb', line 65 def knowledge_base @knowledge_base ||= KnowledgeBase.new end |
#repo ⇒ Object
Go ahead and create a generic repo for Fathom
34 35 36 |
# File 'lib/fathom/archive/concept.rb', line 34 def repo @repo ||= RDF::DataObjects::Repository.new('sqlite3:/tmp/test.db') end |