I am training the
htm.core.algorithms.predictor on some EEG data, since it has negative amplitude, its giving me this error:
This makes me wonder if it can accept negative values , since when I take the absolute values it works fine.
This is a part of my code:
for count, record in enumerate(y): print("active cells" , tm.getActiveCells()) if count%10000==0: print(count/len(y)*100) consumption = float(record) #p # print(consumption) #print(count, record) # Call the encoders to create bit representations for each value. These are SDR objects. consumptionBits = scalarEncoder.encode(record) # Concatenate all these encodings into one large encoding for Spatial Pooling. encoding = consumptionBits #print(encoding) enc_info.addData(encoding) # Create an SDR to represent active columns, This will be populated by the # compute method below. It must have the same dimensions as the Spatial Pooler. activeColumns = SDR(sp.getColumnDimensions()) # Execute Spatial Pooling algorithm over input space. overlaps = sp.compute(encoding, True, activeColumns) sp_info.addData(activeColumns) # Execute Temporal Memory algorithm over active mini-columns. tm.compute(activeColumns, learn=True) tm_info.addData(tm.getActiveCells().flatten()) # Predict what will happen, and then train the predictor based on what just happened. pdf = predictor.infer(tm.getActiveCells()) for n in (1, step): if pdf[n]: predictions[n].append(np.argmax(pdf[n]) * predictor_resolution) else: predictions[n].append(float('nan')) anomaly_Likelihood = anomaly_history.anomalyProbability(record, tm.anomaly) anomaly.append(tm.anomaly) logAnomalyLikelihood = np.log(1.0000000001 - anomaly_Likelihood) / -23.02585084720009 anomalyLikelihood.append(anomaly_Likelihood) log_anomalyLikelihood.append(logAnomalyLikelihood) print("Int is " , int(consumption / predictor_resolution)) predictor.learn(count, tm.getActiveCells(), int(consumption / predictor_resolution) )