Module: Prolly::RandVar::Infogain

Included in:
Prolly::RandVar
Defined in:
lib/prolly/rand_var/infogain.rb

Instance Method Summary collapse

Instance Method Details

#infogainObject

I(Y | X) I(Y | X, A = a) I(Y | X, A = a, B = b)



9
10
11
12
13
14
15
16
17
# File 'lib/prolly/rand_var/infogain.rb', line 9

def infogain
  raise "Need given var" if @uspec_gv.empty? and @spec_gv.empty?
  raise "Need unspecified given var" if @uspec_gv.empty?
  raise "Need unspecified rand var" if @uspec_rv.empty?

  # puts "I(#{@rv} | #{@gv})"
  Ps.rv(*@uspec_rv).given(@spec_gv).entropy -
    Ps.rv(*@uspec_rv).given(*@uspec_gv, @spec_gv).entropy
end