Download examples/minimal_policy.py from PureOne/Infinite-Players: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/PureOne/Infinite-Players/resolve/main/examples/minimal_policy.py
- Command line
-
hf download hf://datasets/PureOne/Infinite-Players/examples/minimal_policy.py
-
curl -L -o minimal_policy.py https://huggingface.co/datasets/PureOne/Infinite-Players/resolve/main/examples/minimal_policy.py
1.11 kB
| """Inspect compatible improvement in the supplied finite synthetic arena.""" | |
| from pathlib import Path | |
| import sys | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'src')) | |
| import numpy as np | |
| from infinite_players.arena import make_arena | |
| from infinite_players.fidelity import policy_iteration, semantic_law, signature_residual | |
| def main(): | |
| mdp, anchor, targets = make_arena(seed=1, theta=1) | |
| descendant, value, audit = policy_iteration(mdp, targets, kind='path') | |
| source_value, _ = mdp.evaluate(anchor) | |
| path_tv = np.abs(semantic_law(mdp, anchor, 6) - semantic_law(mdp, descendant, 6)).sum()/2 | |
| print(f'Normalized source value: {(1-mdp.gamma)*source_value.mean():.6f}') | |
| print(f'Normalized descendant value: {(1-mdp.gamma)*value.mean():.6f}') | |
| print(f'Six-step semantic TV: {path_tv:.3e}') | |
| print(f'Maximum signature residual: {signature_residual(mdp, descendant, targets):.3e}') | |
| print(f'Policy iteration steps: {audit["iterations"]}') | |
| print('Scope: one synthetic known-model arena; no human or commercial-game evaluation.') | |
| if __name__ == '__main__': | |
| main() | |