Does anyone have a solution? I tried to run the return statement only if the length of rate_of_return is not null, but then i get a followup error like IndexError.
I'm trying to run this code:
`#Read RL Agent experiment
data_test_rlagent = dataTest_patternBased.data if dataTest_patternBased is not None else None
Does anyone have a solution? I tried to run the return statement only if the length of rate_of_return is not null, but then i get a followup error like IndexError.
I'm trying to run this code: `#Read RL Agent experiment data_test_rlagent = dataTest_patternBased.data if dataTest_patternBased is not None else None
rlAgent = RLTrain(dataTrain_patternBased.data, data_test_rlagent, data_loader.patterns, DATASET_NAME, n=n, num_iteration=num_iteration, gamma=gamma, alpha=alpha, epsilon=epsilon)
rlAgent.training() rlAgent.write_to_file()
rlAgent.read_from_file('GOOGL-TRAIN_TEST_SPLIT(True)-NUM_ITERATIONS10000-N_STEP10-GAMMA1-ALPHA0.1-EPSILON0.1-EXPERIMENT(1).pkl')
rlAgent.read_from_file('AAPL-TRAIN_TEST_SPLIT(True)-NUM_ITERATIONS1000-N_STEP10-GAMMA1-ALPHA0.1-EPSILON0.1-EXPERIMENT.pkl')
rlAgent.read_from_file('BTC-USD-TRAIN_TEST_SPLIT(True)-NUM_ITERATIONS10000-N_STEP10-GAMMA0.9-ALPHA0.1-EPSILON0.1-EXPERIMENT.pkl')
rlAgent.read_from_file('KSS-TRAIN_TEST_SPLIT(True)-NUM_ITERATIONS10000-N_STEP10-GAMMA0.9-ALPHA0.1-EPSILON0.1-EXPERIMENT(1).pkl')
ev_rlAgent = rlAgent.test(test_type= 'train') print('train') ev_rlAgent.evaluate() rlAgent_portfolio_train = ev_rlAgent.get_daily_portfolio_value() ev_rlAgent = rlAgent.test(test_type= 'test') print('test') ev_rlAgent.evaluate() rlAgent_portfolio_test = ev_rlAgent.get_daily_portfolio_value()
model_kind = f'RL'
model_kind = f'RL-{n}'
add_train_portfo(model_kind, rlAgent_portfolio_train) add_test_portfo(model_kind, rlAgent_portfolio_test)`