examples/ocr.rb in neuro-0.4.2 vs examples/ocr.rb in neuro-0.4.3

- old
+ new

@@ -40,11 +40,11 @@ CHARACTERS = [] ('A'..'Z').each_with_index do |char, number| vector = [] 7.times do |j| c = CHAR_BTIMAP[j][6 * number, 5] - vector += c.enum_for(:each_byte).map { |x| x == ?* ? 1.0 : -1.0 } + vector += c.split(//).map { |x| x == '*' ? 1.0 : -1.0 } end CHARACTERS << Character.new(char, number, vector) end def initialize @@ -60,10 +60,10 @@ @network.debug_step = 100 max_error = 1.0E-5 eta = 0.2 max_count = CHARACTERS.size * 10 count = max_count - until count < max_error + until count < max_count count = 0 CHARACTERS.sort_by { rand }.each do |character| count += @network.learn(character.vector, make_result_vector(character.number), max_error, eta) end