Class: WeightNet
- Inherits:
-
Object
- Object
- WeightNet
- Defined in:
- lib/scratch.rb
Instance Attribute Summary collapse
-
#net ⇒ Object
Returns the value of attribute net.
Instance Method Summary collapse
-
#initialize(dag) ⇒ WeightNet
constructor
Use a DAG generated by StructureLearning to create an unweighted Bayes net.
Constructor Details
#initialize(dag) ⇒ WeightNet
Use a DAG generated by StructureLearning to create an unweighted Bayes net
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/scratch.rb', line 5 def initialize(dag) vars = {} @net = Sbn::Net.new(title) vertices.each do |v| vars[v] = Sbn::Variable.new(@net, v.name.to_sym) end edges.each do |e| vars[e.source].add_child(vars[e.target]) end end |
Instance Attribute Details
#net ⇒ Object
Returns the value of attribute net.
2 3 4 |
# File 'lib/scratch.rb', line 2 def net @net end |