This commit is contained in:
+4
-6
@@ -17,13 +17,11 @@ MAX_MAXNET_ITER = 100
|
||||
|
||||
def recall_hamming(pattern_vectors, input_vec)
|
||||
eps = 0.9 / pattern_vectors.length
|
||||
|
||||
outputs = hamming_layer(pattern_vectors, input_vec)
|
||||
MAX_MAXNET_ITER.times do
|
||||
next_out = maxnet_step(outputs, eps)
|
||||
return next_out.each_with_index.max_by { |v, _| v }[1] if next_out.count { |v| v > 1e-9 } <= 1
|
||||
outputs = next_out
|
||||
iter = 0
|
||||
while outputs.count { |v| v > 1e-9 } > 1 && iter < MAX_MAXNET_ITER
|
||||
outputs = maxnet_step(outputs, eps)
|
||||
iter += 1
|
||||
end
|
||||
|
||||
outputs.each_with_index.max_by { |v, _| v }[1]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user