numenta / htm.java

Hierarchical Temporal Memory implementation in Java - an official Community-Driven Java port of the Numenta Platform for Intelligent Computing (NuPIC).
GNU Affero General Public License v3.0
308 stars 160 forks source link

Bug in util/ArrayUtils.java clip #534

Open angers2807 opened 6 years ago

angers2807 commented 6 years ago

public static double[] clip(double[] values, double min, double max) { for (int i = 0; i < values.length; i++) { values[i] = Math.min(1, Math.max(0, values[i])); } return values; } Doesn't ever reference the min and max parameters, instead it always clips to 0,1 This doesn't currently cause a problem because the only usages (in SpatialPooler) call it with params that currently happen to be 0,1 (c.getSynPermMin(), c.getSynPermMax()) However this is a bug just waiting to happen

Sorry, I'm not setup to make contributions

cogmission commented 6 years ago

Hi @angers2807,

Thanks! good catch! We'll take a look...