计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
score_function_estimator【效率与协作】Compute REINFORCE score-function update terms for sampled stochastic policy actions with scalar rewards and baselines.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a recovery or implementation needs the local REINFORCE likelihood-ratio primitive for a sampled stochastic action. Do not use it for deterministic argmax policies, supervised cross-entropy labels, or value-function-only updates.
prob_action_one in (0, 1).0 or 1.grad_log_prob: derivative of the sampled action log probability with respect to the Bernoulli logit.advantage: reward - baseline.update: advantage * grad_log_prob.grad_log_prob = action - prob_action_one for a Bernoulli logit policy.Run:
python scripts/score_estimator.py --prob 0.4 --action 1 --reward 1.0 --baseline 0.2
python -m pytest tests
The tests verify update signs and that a baseline changes magnitude but preserves the ascent direction in a high-reward action example.
This skill implements the Bernoulli-logit case used by the bounded recovery. Categorical policies use the same score-function principle but require vector log-probability gradients.