lib/cerebrum/cerebrum.rb in cerebrum-0.1.1 vs lib/cerebrum/cerebrum.rb in cerebrum-0.1.2
- old
+ new
@@ -38,11 +38,11 @@
current_iteration = 0
input_size = training_set[0][:input].length
output_size = training_set[0][:output].length
- hidden_layer_sizes = [ [3, (input_size/2).floor].max ] unless @hidden_layers
- layer_sizes = [input_size, hidden_layer_sizes, output_size].flatten
+ @hidden_layers ||= [ [3, (input_size/2).floor].max ]
+ layer_sizes = [input_size, @hidden_layers, output_size].flatten
construct_network(layer_sizes)
iterations.times do |i|
current_iteration = i
training_set_errors = training_set.map { |ex| train_pattern(ex[:input], ex[:output], learning_rate) }