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
print(mid_prices)
[20.25 19.865 20.34 ... 27.97 27.62 27.3425] main:1: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead. main:2: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
smoothing_window_size = 2500
for di in range(0,10000,smoothing_window_size):
scaler.fit(train_data[di:di+smoothing_window_size,:])
train_data[di:di+smoothing_window_size,:] = scaler.transform(train_data[di:di+smoothing_window_size,:])
This is probably because you aren't using as many data points as the tutorial. To fix this, simply lower the smoothing_window_size variable. The end of the for loop in the next line should be smaller than the length of your test data.
Everything runs normally up until the MinMaxScaler is called in the for loop.
high_prices = df.loc[:,'High'].as_matrix()
low_prices = df.loc[:,'Low'].as_matrix()
mid_prices = (high_prices+low_prices)/2.0
print(mid_prices)
[20.25 19.865 20.34 ... 27.97 27.62 27.3425]
main:1: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
main:2: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
smoothing_window_size = 2500
for di in range(0,10000,smoothing_window_size):
scaler.fit(train_data[di:di+smoothing_window_size,:])
train_data[di:di+smoothing_window_size,:] = scaler.transform(train_data[di:di+smoothing_window_size,:])
You normalize the last bit of remaining data
scaler.fit(train_data[di+smoothing_window_size:,:])
train_data[di+smoothing_window_size:,:] = scaler.transform(train_data[di+smoothing_window_size:,:])
Traceback (most recent call last):
File "", line 3, in
scaler.fit(train_data[di:di+smoothing_window_size,:])
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py", line 325, in fit
return self.partial_fit(X, y)
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py", line 353, in partial_fit
force_all_finite="allow-nan")
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 550, in check_array
context))
ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required by MinMaxScaler.
The text was updated successfully, but these errors were encountered: