You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experimenting with GeospatialCoordinateEncoder, CoordinateEncoder and FileSensor
Everything works fine with GeospatialCoordinateEncoder but CoordinateEncoder throws the mentioned exception:
java.lang.IllegalStateException: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
I found that exception is thrown in this line: List<int[]> neighs = neighbors((int[])inputData.get(0), (double)inputData.get(1));
That's because inputData.get(0) is a double value parsed from the input file line string.
At GeospatialCoordinateEncoder the following lines convert the double value to int and than callsCoordinateEncoder.encodeIntoArray without a problem.
java.lang.RuntimeException: Unhandled Exception in Sensor Layer [Region 1:Layer 2/3] Thread
at org.numenta.nupic.network.Layer$6.uncaughtException(Layer.java:2054)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1952)
Caused by: java.lang.IllegalStateException: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:105)
at org.numenta.nupic.encoders.Encoder.encode(Encoder.java:625)
at org.numenta.nupic.network.sensor.HTMSensor.input(HTMSensor.java:429)
at org.numenta.nupic.network.sensor.HTMSensor.lambda$getOutputStream$46(HTMSensor.java:362)
at org.numenta.nupic.network.sensor.HTMSensor$$Lambda$29/1349859160.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$220(StreamSpliterators.java:294)
at java.util.stream.StreamSpliterators$WrappingSpliterator$$Lambda$9/209813603.getAsBoolean(Unknown Source)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at org.numenta.nupic.network.sensor.HTMSensor$Copy.hasNext(HTMSensor.java:280)
at java.util.Iterator.forEachRemaining(Iterator.java:115)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.numenta.nupic.network.Layer$5.run(Layer.java:2037)
Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
at org.numenta.nupic.encoders.CoordinateEncoder.encodeIntoArray(CoordinateEncoder.java:167)
at org.numenta.nupic.encoders.CoordinateEncoder.encodeIntoArray(CoordinateEncoder.java:34)
at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:103)
... 22 more
java.lang.RuntimeException: Unhandled Exception in Sensor Layer [Region 1:Layer 2/3] Thread
at org.numenta.nupic.network.Layer$6.uncaughtException(Layer.java:2054)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1952)
Caused by: java.lang.IllegalStateException: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:105)
at org.numenta.nupic.encoders.Encoder.encode(Encoder.java:625)
at org.numenta.nupic.network.sensor.HTMSensor.input(HTMSensor.java:429)
at org.numenta.nupic.network.sensor.HTMSensor.lambda$getOutputStream$46(HTMSensor.java:362)
at org.numenta.nupic.network.sensor.HTMSensor$$Lambda$29/1349859160.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$220(StreamSpliterators.java:294)
at java.util.stream.StreamSpliterators$WrappingSpliterator$$Lambda$9/209813603.getAsBoolean(Unknown Source)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at org.numenta.nupic.network.sensor.HTMSensor$Copy.hasNext(HTMSensor.java:280)
at java.util.Iterator.forEachRemaining(Iterator.java:115)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.numenta.nupic.network.Layer$5.run(Layer.java:2037)
Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
at org.numenta.nupic.encoders.CoordinateEncoder.encodeIntoArray(CoordinateEncoder.java:167)
at org.numenta.nupic.encoders.CoordinateEncoder.encodeIntoArray(CoordinateEncoder.java:34)
at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:103)
... 22 more
java.lang.RuntimeException: Unhandled Exception in Sensor Layer [Region 1:Layer 2/3] Thread
at org.numenta.nupic.network.Layer$6.uncaughtException(Layer.java:2054)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1952)
Caused by: java.lang.IllegalStateException: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:105)
at org.numenta.nupic.encoders.Encoder.encode(Encoder.java:625)
at org.numenta.nupic.network.sensor.HTMSensor.input(HTMSensor.java:429)
at org.numenta.nupic.network.sensor.HTMSensor.lambda$getOutputStream$46(HTMSensor.java:362)
at org.numenta.nupic.network.sensor.HTMSensor$$Lambda$29/1349859160.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$220(StreamSpliterators.java:294)
at java.util.stream.StreamSpliterators$WrappingSpliterator$$Lambda$9/209813603.getAsBoolean(Unknown Source)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at org.numenta.nupic.network.sensor.HTMSensor$Copy.hasNext(HTMSensor.java:280)
at java.util.Iterator.forEachRemaining(Iterator.java:115)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at org.numenta.nupic.network.Layer$5.run(Layer.java:2037)
Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
at org.numenta.nupic.encoders.CoordinateEncoder.encodeIntoArray(CoordinateEncoder.java:167)
at org.numenta.nupic.encoders.CoordinateEncoder.encodeIntoArray(CoordinateEncoder.java:34)
at org.numenta.nupic.encoders.MultiEncoder.encodeIntoArray(MultiEncoder.java:103)
... 22 more
The text was updated successfully, but these errors were encountered:
I'm experimenting with GeospatialCoordinateEncoder, CoordinateEncoder and FileSensor
Everything works fine with GeospatialCoordinateEncoder but CoordinateEncoder throws the mentioned exception:
java.lang.IllegalStateException: java.lang.ClassCastException: java.lang.Double cannot be cast to [I
I found that exception is thrown in this line:
List<int[]> neighs = neighbors((int[])inputData.get(0), (double)inputData.get(1));
That's because
inputData.get(0)
is a double value parsed from the input file line string.At GeospatialCoordinateEncoder the following lines convert the double value to int and than callsCoordinateEncoder.encodeIntoArray without a problem.
I made a change on FieldMetaType as follows:
And other change on CoordinateEncoder as follows:
/**
* {@inheritdoc}
*/
@OverRide
public void encodeIntoArray(Tuple inputData, int[] output) {
List<int[]> neighs = neighbors((int[])inputData.get(0), Math.max((double)inputData.get(1), w));
int[][] neighbors = new int[neighs.size()][];
for(int i = 0;i < neighs.size();i++) neighbors[i] = neighs.get(i);
And now it's working and doesn't throw any exceptions.
May I request a pull to submit my code?
My .csv file is like this:
The text was updated successfully, but these errors were encountered: