Kandidat GEGEN_GROSS=0.2,river,ab:0.75,allin, aus = bitgleich. Holdout River: Jams +9886 bb [+5607, +14177], grosse Einsaetze ohne All-in +1317, Raises +44; eigene Haende +0,37 bb/100. Ohne allin verliert der Schalter an grossen Nicht-All-in-Einsaetzen (-11766). Nicht live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
2.0 KiB
Python
48 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
||
"""bb/100 eigener Haende: Δ je Spot (Kandidat − live, IPW-Mittel, Bootstrap ueber Setzer) auf River-Spots mit Einsatz
|
||
>= ab Topf, getrennt all-in / nicht all-in, mal Haeufigkeit je 100 eigene Haende.
|
||
|
||
python -I -X utf8 messung/stackoff/je100.py <spots.jsonl> <antw-live.jsonl> <antw-arm.jsonl> <rate_allin> <rate_sonst> [--ab 0.75]
|
||
"""
|
||
import collections
|
||
import json
|
||
import os
|
||
import random
|
||
import sys
|
||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "grosse_calls"))
|
||
import population as P # noqa: E402
|
||
|
||
a = sys.argv[1:]
|
||
ab = float(a[a.index("--ab") + 1]) if "--ab" in a else 0.75
|
||
lade = lambda p: {json.loads(z)["id"]: (str(json.loads(z).get("action") or "").upper(), json.loads(z).get("size")) for z in open(p, encoding="utf-8")}
|
||
L, K = lade(a[1]), lade(a[2])
|
||
rate = {"allin": float(a[3]), "sonst": float(a[4])}
|
||
G = collections.defaultdict(lambda: collections.defaultdict(lambda: [0.0, 0.0]))
|
||
for z in open(a[0], encoding="utf-8"):
|
||
sp = json.loads(z)
|
||
if sp["id"] not in L or sp["id"] not in K or sp["strasse"] != 3 or sp["tc"] / max(sp["topf"] - sp["tc"], 1e-9) < ab:
|
||
continue
|
||
sp.pop("req", None)
|
||
art = "allin" if "allin" in sp["linien"] else "sonst"
|
||
d = P.ev_aktion(sp, *K[sp["id"]]) - P.ev_aktion(sp, *L[sp["id"]])
|
||
g = G[art][sp["pid_o"]]
|
||
g[0] += sp["w"] * d
|
||
g[1] += sp["w"]
|
||
rnd = random.Random(20261120)
|
||
tot = [0.0] * 400
|
||
for art, s in G.items():
|
||
gr = list(s.values())
|
||
m = sum(x[0] for x in gr) / sum(x[1] for x in gr)
|
||
bs = []
|
||
for i in range(400):
|
||
x = [gr[rnd.randrange(len(gr))] for _ in gr]
|
||
v = sum(y[0] for y in x) / sum(y[1] for y in x)
|
||
bs.append(v)
|
||
tot[i] += v * rate[art]
|
||
bs.sort()
|
||
print(f"{art}: Spots-Setzer {len(gr)}, Δ je Spot {m:+.2f} bb [{bs[10]:+.2f}, {bs[389]:+.2f}] -> {m * rate[art]:+.3f} bb/100 "
|
||
f"[{bs[10] * rate[art]:+.3f}, {bs[389] * rate[art]:+.3f}]")
|
||
tot.sort()
|
||
print(f"zusammen bb/100 [{tot[10]:+.3f}, {tot[389]:+.3f}]")
|