View Code? Open in Web Editor
NEW
Improve S&P 500 stock price prediction (random forest and gradient boosting trees) with time series similarity measurements: DTW, SAX, co-integration, Euclidean and Pearson.
sp500-stock-similarity-time-series's People
Contributors
sp500-stock-similarity-time-series's Issues
What is the predicted value in the project?
What does next_1, next_3, next_7 mean in a project?
def prepare_stock_windows (X , stock_name , window , slide , next_t ):
stock_X = X [X [ENTITY ] == stock_name ]
X_ = pd .DataFrame ()
Y_ = pd .DataFrame ()
i = 0
#y_column_names = [TIME] + next_t
while i < len (stock_X [TIME ]) - window :
X_ .append (stock_X [i :i + window ])
y_ti = i + window + next_t
curr_time = stock_X [- 1 ][TIME ]
next_targets = np .array (stock_X [TARGET ].tolist ())[y_ti ]
y_vals = [curr_time ] + next_targets
y_ = pd .Series ()
Y_ .append (stock_X [stock_X [TIME ].isin (next_dates )])
i += slide
return X_ , Y_
curr_time = stock_X[-1][TIME] is logically wrong, gives an error.
There is no next_dates variable here
You declared curr_time, next_targets,y_ but never used
In similarity_functions.py, the comments of ;
def fix_stock_len (stock1 , stock2 ):
def correlate_stock_len (stock1 , stock2 ):
def correlate_stock_len_delay (stock1 , stock2 , delay = 1 ):
are the same... How can i learn more about this functions ? Can you help me please?