Method: Sbn::NumericVariable#initialize

Defined in:
lib/sbn/numeric_variable.rb

#initialize(net, name, probabilities = [], state_thresholds = [], options = {}) ⇒ NumericVariable

Returns a new instance of NumericVariable.



8
9
10
11
12
13
14
15
16
# File 'lib/sbn/numeric_variable.rb', line 8

def initialize(net, name, probabilities = [], state_thresholds = [], options = {})
  @state_count_one = options.fetch(:first_stdev_state_count, DEFAULT_FIRST_STDEV_STATE_COUNT).to_f.round
  @state_count_two = options.fetch(:second_stdev_state_count, DEFAULT_SECOND_STDEV_STATE_COUNT).to_f.round
  @state_count_one += 1 if @state_count_one.odd?
  @state_count_two += 1 if @state_count_two.odd?
  @state_thresholds = state_thresholds
  states = generate_states_from_thresholds
  super(net, name, probabilities, states)
end