huseinzol05 / Stock-Prediction-Models

Gathers machine learning and deep learning models for Stock forecasting including trading bots and simulations
Apache License 2.0
7.95k stars 2.81k forks source link

stock-forecasting-js gives error in console: Uncaught Error: Error in slice1D: begin[0] + size[0] (41) would overflow input.shape[0] (40) #95

Open itemx opened 4 years ago

itemx commented 4 years ago

Hi,

I tried to import my own data sample to stock-forecasting-js but received errors.

0050TW.csv.txt

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

https://huseinhouse.com/stock-forecasting-js/init.js:432 setTimeout handler* https://huseinhouse.com/stock-forecasting-js/init.js:427 jQuery 9 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 https://huseinhouse.com/stock-forecasting-js/init.js:432 (Async: setTimeout handler) https://huseinhouse.com/stock-forecasting-js/init.js:427 jQuery 9 https://huseinhouse.com/stock-forecasting-js/init.js:411 ` Did I mess up something in my sample data? Thanks for checking.
eranotz50 commented 3 years ago

@itemx did you ever find a solution for this ?

soyoeml commented 2 years ago

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

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 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 file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/init.js:432 (Async: setTimeout handler) file:///Volumes/SSD/ws/Stock-Prediction-Models/stock-forecasting-js/init.js:427`
soyoeml commented 2 years ago

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.