First of all, thanks for sharing this code.
I'm trying to run the notebook keras-ddpg
and I ran into this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-20-982fd62f6724> in <module>()
6 TrainIntervalLoggerTQDMNotebook(),
7 TrainEpisodeLoggerPortfolio(10),
----> 8 ModelIntervalCheckpoint(save_path, 10*1440, 1)
9 ]
10 )
/usr/local/lib/python3.4/dist-packages/rl/core.py in fit(self, env, nb_steps, action_repetition, callbacks, verbose, visualize, nb_max_start_steps, start_step_policy, log_interval, nb_max_episode_steps)
160 'nb_steps': self.step,
161 }
--> 162 callbacks.on_episode_end(episode, episode_logs)
163
164 episode += 1
/usr/local/lib/python3.4/dist-packages/rl/callbacks.py in on_episode_end(self, episode, logs)
55 # If not, fall back to `on_epoch_end` to be compatible with built-in Keras callbacks.
56 if callable(getattr(callback, 'on_episode_end', None)):
---> 57 callback.on_episode_end(episode, logs=logs)
58 else:
59 callback.on_epoch_end(episode, logs=logs)
<ipython-input-19-9b518044e729> in on_episode_end(self, episode, logs)
16 accumulated_portfolio_value=df.portfolio_value.iloc[-1],
17 #mean_market_return=df.mean_market_returns.cumprod().iloc[-1],
---> 18 cash_bias=df.weights.apply(lambda x:x[0]).mean()
19 )
20
/usr/local/lib/python3.4/dist-packages/pandas/core/generic.py in __getattr__(self, name)
3079 if name in self._info_axis:
3080 return self[name]
-> 3081 return object.__getattribute__(self, name)
3082
3083 def __setattr__(self, name, value):
AttributeError: 'DataFrame' object has no attribute 'weights'
1440/|/reward=-0.0000 info=(return: 0.9938, portfolio_value: 0.7632, cost: 0.0000, weights_std: 0.3301, reward: -0.0000, weights_mean: 0.1667, steps: 1441.0000, market_value: 1.2144, rate_of_return: -0.0026, date: 1445472000.0000, log_return: -0.0026, ) 0%|| 1440/2000000.0 [03:30<83:43:20, 6.63it/s]