class Newral::Probability

Attributes

apriori[R]
key[R]
probability[R]

Public Class Methods

new( key, probability, apriori:nil ) click to toggle source
# File lib/newral/probability.rb, line 5
def initialize( key, probability, apriori:nil )
  @key = key 
  @probability = probability
  @apriori = apriori
  @key = "#{key}|#{apriori}" if apriori
end

Public Instance Methods

!() click to toggle source
# File lib/newral/probability.rb, line 20
def !
  Probability.new("!#{key}",1-probability)
end
*( other_probability ) click to toggle source
# File lib/newral/probability.rb, line 12
def *( other_probability )
  Probability.new("#{self.key}*#{other_probability.key}",self.probability*other_probability.probability)
end
+(other_probability) click to toggle source
# File lib/newral/probability.rb, line 24
def+(other_probability)
  Probability.new("#{self.key}+#{other_probability.key}",self.probability+other_probability.probability)
end
/( other_probability ) click to toggle source
# File lib/newral/probability.rb, line 16
def /( other_probability )
  Probability.new("#{self.key}/#{other_probability.key}",self.probability/other_probability.probability)
end
and( other_probability ) click to toggle source
# File lib/newral/probability.rb, line 32
def and( other_probability )
  Probability.new("#{self.key}^#{other_probability.key}",self.probability*other_probability.probability)
end
apriori=( apriori: other_probability, probability: nil ) click to toggle source
# File lib/newral/probability.rb, line 28
def apriori=( apriori: other_probability, probability: nil )
   Probability.new("#{self.key}|#{other_probability.key}",probability)
end
or( other_probability ) click to toggle source
# File lib/newral/probability.rb, line 36
def or( other_probability )
  Probability.new("#{self.key}*#{other_probability.key}",self.probability*other_probability.probability)
end