stock-forecasting-js gives error in console: Uncaught Error: Error in slice1D: begin[0] + size[0] (41) would overflow input.shape[0] (40)
itemx opened this issue · 3 comments
Hi,
I tried to import my own data sample to stock-forecasting-js but received errors.
My sample data is above. It is converted by referencing the file format under /dataset/ in this project and it can be parsed and displayed in the candlestick chart. But the console will show error and can not continue while I press TRAIN button.
The output looks like:
Uncaught Error: Error in slice1D: begin[0] + size[0] (41) would overflow input.shape[0] (40) assert https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 assertParamsValid https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 slice https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 value https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 tidy https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 value https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 slice https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 <anonymous> https://huseinhouse.com/stock-forecasting-js/init.js:432 setTimeout handler* https://huseinhouse.com/stock-forecasting-js/init.js:427 jQuery 9 <anonymous> https://huseinhouse.com/stock-forecasting-js/init.js:411 tf.js:1:3012 assert https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 assertParamsValid https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 slice https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 value https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 tidy https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 value https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 slice https://huseinhouse.com/stock-forecasting-js/js/tf.js:1 <anonymous> https://huseinhouse.com/stock-forecasting-js/init.js:432 (Async: setTimeout handler) <anonymous> https://huseinhouse.com/stock-forecasting-js/init.js:427 jQuery 9 <anonymous> https://huseinhouse.com/stock-forecasting-js/init.js:411
Did I mess up something in my sample data?
Thanks for checking.
I got same error as yours:
Uncaught Error: Error in slice1D: begin[0] + size[0] (276) would overflow input.shape[0] (275) assert file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 assertParamsValid file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 slice file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 value file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 tidy file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 value file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 slice file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 <anonymous> file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/init.js:432 setTimeout handler* file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/init.js:427 jQuery 9 <anonymous> file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/init.js:411 [tf.js:1:3012](file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js) assert file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 assertParamsValid file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 slice file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 value file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 tidy file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 value file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 slice file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/js/tf.js:1 <anonymous> file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/init.js:432 (Async: setTimeout handler) <anonymous> file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/init.js:427
I found a temporary solution. Just delete 1 line of your csv data. It will work. Because the js script doesn't handle the border well.