Class: TLearn::Run

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

Instance Method Summary collapse

Constructor Details

#initialize(config, out = STDOUT) ⇒ Run

Returns a new instance of Run.



4
5
6
7
# File 'lib/tlearn/run.rb', line 4

def initialize(config, out=STDOUT)
  @config = config
  @out = out
end

Instance Method Details

#fitness(data, number_of_sweeps = nil, working_dir = nil) ⇒ Object



22
23
24
25
26
# File 'lib/tlearn/run.rb', line 22

def fitness(data, number_of_sweeps = nil, working_dir = nil)
  run_tlearn = RunTLearn.new(@config, working_dir)

  run_tlearn.fitness(FitnessData.new(data), number_of_sweeps)
end

#train(data, number_of_sweeps = nil, working_dir = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tlearn/run.rb', line 9

def train(data, number_of_sweeps = nil, working_dir = nil)
  run_tlearn = RunTLearn.new(@config, working_dir)

  results = run_tlearn.train(TrainingData.new(data), number_of_sweeps)
  
  if results
    results.each{|r| @out.puts(r.inspect)}
    results
  else
    @out.puts("[Error] Training failed") 
  end
end