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
When I run the first cell of the notebook stock_keras.ipynb, i got the following error. This is appearing after doing all the labels for every technical indicators except the IBR.
Here is the context :
running stock_cnn.py ['./train.py', 'WMT', 'original']
../stock_history/WMT
../outputs/fresh_rolling_train
../stock_history/WMT/WMT.csv
1 ) 28-07-2020 16_40_55 MainThread INFO\ Initialized logging at path ../outputs/fresh_rolling_train/logs/log_WMT_original_fresh_rolling_train_28-07-2020_16_40_55.log
Tensorflow devices
path to company data: ../stock_history/WMT/WMT.csv
2 ) 28-07-2020 16_40_55 MainThread DEBUG\ Data for WMT ready to use
3 ) 28-07-2020 16_40_55 MainThread DEBUG\ Technical indicators already calculated. Loading...
4 ) 28-07-2020 16_40_55 MainThread DEBUG\ Dropped 26 nan rows before label calculation
5 ) 28-07-2020 16_40_55 MainThread DEBUG\ creating label with original paper strategy
Calculating labels
HBox(children=(IntProgress(value=0, max=5007), HTML(value='')))
IndexError Traceback (most recent call last)
~/Downloads/stock_cnn_blog_pub-master/src/train.py in
71
72 start_time = time.time()
---> 73 data_gen = DataGenerator(company_code, PATH_TO_COMPANY_DATA, OUTPUT_PATH, strategy_type, False, logger)
74 # exit here, since training is done with stock_keras.ipynb.
75 # comment sys.exit() if you want to try out rolling window training.
In your while loop, window_middle is divided by 2 and it becomes a float.
Cast it back as an integer or you can try to use int(window_middle) instead of window_middle
When I run the first cell of the notebook stock_keras.ipynb, i got the following error. This is appearing after doing all the labels for every technical indicators except the IBR.
Here is the context :
running stock_cnn.py ['./train.py', 'WMT', 'original']
../stock_history/WMT
../outputs/fresh_rolling_train
../stock_history/WMT/WMT.csv
1 ) 28-07-2020 16_40_55 MainThread INFO\ Initialized logging at path ../outputs/fresh_rolling_train/logs/log_WMT_original_fresh_rolling_train_28-07-2020_16_40_55.log
Tensorflow devices
path to company data: ../stock_history/WMT/WMT.csv
2 ) 28-07-2020 16_40_55 MainThread DEBUG\ Data for WMT ready to use
3 ) 28-07-2020 16_40_55 MainThread DEBUG\ Technical indicators already calculated. Loading...
4 ) 28-07-2020 16_40_55 MainThread DEBUG\ Dropped 26 nan rows before label calculation
5 ) 28-07-2020 16_40_55 MainThread DEBUG\ creating label with original paper strategy
Calculating labels
HBox(children=(IntProgress(value=0, max=5007), HTML(value='')))
IndexError Traceback (most recent call last)
~/Downloads/stock_cnn_blog_pub-master/src/train.py in
71
72 start_time = time.time()
---> 73 data_gen = DataGenerator(company_code, PATH_TO_COMPANY_DATA, OUTPUT_PATH, strategy_type, False, logger)
74 # exit here, since training is done with stock_keras.ipynb.
75 # comment sys.exit() if you want to try out rolling window training.
~/Downloads/stock_cnn_blog_pub-master/src/data_generator.py in init(self, company_code, data_path, output_path, strategy_type, update, logger)
40 self.update = update
41 self.download_stock_data()
---> 42 self.df = self.create_features()
43 self.feat_idx = self.feature_selection()
44 self.one_hot_enc = OneHotEncoder(sparse=False, categories='auto')
~/Downloads/stock_cnn_blog_pub-master/src/data_generator.py in create_features(self)
266 short = self.strategy_type.split('')[0]
267 long = self.strategy_type.split('')[1]
--> 268 df['labels'] = self.create_label_short_long_ma_crossover(df, 'close', short, long)
269 else:
270 df['labels'] = self.create_labels(df, 'close')
~/Downloads/stock_cnn_blog_pub-master/src/data_generator.py in create_labels(self, df, col_name, window_size)
142
143 labels[window_middle] = 1
--> 144 else:
145
146 labels[window_middle] = 2
IndexError: only integers, slices (
:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indicesThe text was updated successfully, but these errors were encountered: