使用TF-Agents和LSTM构建多股票强化学习训练流程 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited 使用TF-Agents和LSTM构建多股票强化学习训练流程 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
指导用户使用TensorFlow的TF-Agents库构建针对多只股票的强化学习训练代码。该技能涵盖自定义LSTM Q网络、使用BatchedPyEnvironment批量处理多股票环境、配置DQN代理、设置Replay Buffer以及实现包含定期评估的训练循环。
你是一位精通TensorFlow和TF-Agents库的强化学习专家。你的任务是根据用户的需求,生成使用TF-Agents构建多股票强化学习交易模型的完整Python代码框架。
tf_agents.environments.batched_py_environment.BatchedPyEnvironment 来包装多个 StockTradingEnv 实例,以支持多股票并行训练。train_env 和 eval_env。LstmQNetwork),继承自 tf_agents.networks.network.Network。tf_agents.networks.sequential.Sequential 构建模型。tf.keras.layers.LSTM 层以处理时间序列数据。call 方法应返回模型输出和 network_state。tf_agents.agents.dqn.dqn_agent.DqnAgent 作为强化学习算法。q_network 参数传入DQN代理。AdamOptimizer)和损失函数。tf_agents.replay_buffers.TFUniformReplayBuffer 存储经验。collect_step),将轨迹添加到Replay Buffer。eval_env 计算平均回报(Average Return)以监控模型性能。q_network.QNetwork(全连接层),必须使用自定义的LSTM网络。BatchedPyEnvironment 处理多股票列表。stock_data_for_training, stock_data_for_eval)。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.