max_features='sqrt', n_estimators=800, random_state=42))]) Balanced Accuracy Score (Overall): 0.5281114056513132 Balanced Crosstab Rank (Overall): Predicted +/-1% 1-5% Down 1-5% Up 5+% Down 5+% Up Actual +/-1% 57 18 51 1 2 1-5% Down 26 69 27 7 0 1-5% Up 28 12 157 1 7 5+% Down 1 12 3 12 0 5+% Up 0 0 26 0 23 ''' aapl_reg = cl.prepare_classical('AAPL') #instantiate the object import_df = aapl_reg.get_prepare_stock_data() dataset = aapl_reg.process_data(import_df) dataset = dataset.drop(['adj close', 'day', 'ticker'], axis=1) df_reshape = aapl_reg.reshape_dataset(np.array(dataset), 1) X, y = aapl_reg.to_supervised_classical(df_reshape, 15, 5) X_classical = pd.DataFrame(aapl_reg.reshape_X_classical( X)) #Reshapes X into 1 row and all columns for the features y_classical = aapl_reg.reshape_y_classical( y, n_out=5) #Reshapes y to calculate % change nday_chg, intraday_max = aapl_reg.get_chg_pc(y_classical) nday_chg_label = pd.DataFrame.from_records(
def instantiate(ticker): '''instantiate 2 class objects for a specific ticker''' return cps.yfinance_scrape (ticker), cl.prepare_classical (ticker)