Class: Skab::Output::Distribution

Inherits:
Object
  • Object
show all
Defined in:
lib/skab/output/distribution.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out) ⇒ Distribution

Returns a new instance of Distribution.



4
5
6
# File 'lib/skab/output/distribution.rb', line 4

def initialize(out)
  @out = out
end

Class Method Details

.helpObject



14
15
16
17
18
19
20
21
22
# File 'lib/skab/output/distribution.rb', line 14

def self.help
  <<-HELP
Usage: skab distribution [model] [parameters]
\tOutputs the discrete probability distribution for both A and B, as
\treturned by the specified model. The output is a three columns CSV
\tfile, where the first column is the probable mean and the second and
\tthird column the corresponding discrete probability for A and B.
  HELP
end

Instance Method Details

#output(model) ⇒ Object



8
9
10
11
12
# File 'lib/skab/output/distribution.rb', line 8

def output(model)
  model.distribution.each do |d|
    @out.puts "#{d.join(',')}"
  end
end