tensortrade.agents.rl.tensorflow_agent module¶
-
class
tensortrade.agents.rl.tensorflow_agent.
TensorflowAgent
(env, feature_pipeline)[source]¶ Bases:
tensortrade.agents.trading_agent.TradingAgent
A trading agent capable of self tuning, training, and evaluating with the TensorFlow 2 agents API.
-
__init__
(env, feature_pipeline)[source]¶ - Parameters
env (
TradingEnvironment
) – A TradingEnvironment instance for the agent to trade within.feature_pipeline (
FeaturePipeline
) – A FeaturePipeline instance of feature transformations.
-
evaluate
(steps, callback)[source]¶ Evaluate the agent’s performance within the environment.
- Parameters
steps (
int
) – The number of steps to train the model within the environment.step_cb (optional) – A callback function for monitoring progress of the evaluation process. step_cb(pd.DataFrame) -> bool: A history of the agent’s trading performance is passed on each iteration. If the callback returns True, the training process will stop early.
- Return type
pandas.DataFrame
- Returns
A history of the agent’s trading performance during evaluation
-
train
(steps, callback)[source]¶ Train the agent’s underlying model on the environment.
- Parameters
steps (
int
) – The number of steps to train the model within the environment.step_cb (optional) – A callback function for monitoring progress of the training process. step_cb(pd.DataFrame) -> bool: A history of the agent’s trading performance is passed on each iteration. If the callback returns True, the training process will stop early.
- Return type
pandas.DataFrame
- Returns
A history of the agent’s trading performance during training
-
tune
(steps_per_train, steps_per_test, step_cb)[source]¶ Tune the agent’s hyper-parameters and feature set for the environment.
- Parameters
steps_per_train (
int
) – The number of steps per training of each hyper-parameter set.steps_per_test (
int
) – The number of steps per evaluation of each hyper-parameter set.step_cb (optional) – A callback function for monitoring progress of the tuning process. step_cb(pd.DataFrame) -> bool: A history of the agent’s trading performance is passed on each iteration. If the callback returns True, the training process will stop early.
- Return type
pandas.DataFrame
- Returns
A history of the agent’s trading performance during tuning
-