Class: WeightNet

Inherits:
Object
  • Object
show all
Defined in:
lib/scratch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#netObject

Returns the value of attribute net.



2
3
4
# File 'lib/scratch.rb', line 2

def net
  @net
end