Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae370329e3 | ||
|
|
5f080e0a82 | ||
|
|
d0141f2d9c | ||
|
|
036c86a1d1 | ||
|
|
99563a59ea | ||
|
|
d606ed1651 |
@@ -10,9 +10,11 @@
|
||||
# DK_ACCOUNT_SALT the salt account names are hashed with (the same one every time)
|
||||
# ATLAS_BOT_TOKEN as in update-sources.yml
|
||||
name: Bot cycle
|
||||
# Not scheduled: no runner has the `bot-host` label yet (issue #27), and the bot's data already arrives through the
|
||||
# daily source check. Put the schedule back once Ken adds a runner on the bot's machine:
|
||||
# schedule:
|
||||
# - cron: "41 */4 * * *"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "41 */4 * * *"
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
cycle:
|
||||
|
||||
@@ -16,6 +16,10 @@ on:
|
||||
schedule:
|
||||
- cron: "23 10 * * *" # daily
|
||||
workflow_dispatch:
|
||||
# one check at a time: a second dispatch waits instead of building and pushing alongside the first
|
||||
concurrency:
|
||||
group: update-sources
|
||||
cancel-in-progress: false
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest # a runner label on the server (act_runner)
|
||||
|
||||
+1
-2
@@ -166,8 +166,7 @@ venv.bak/
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs/Zensical documentation
|
||||
/site
|
||||
# (mkdocs' /site is not ignored: site/ here is the Atlas page)
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
@@ -186,9 +186,20 @@ def build():
|
||||
("combat_second", "The dagger"), ("resolution", "The bullies' fate"), ("post_path", "The fork")):
|
||||
t = collections.Counter(r[col] for r in S1)
|
||||
L.append(f"- **{label}:** " + ", ".join(f"{k} {v}" for k, v in t.most_common()))
|
||||
outside = [r for r in runs if r["saw_shadow"] and not (r["scream"] == "Investigate & help" and r["hour"] == "Tree")]
|
||||
facts["shadow_routes"] = {"runs": len(S1), "routes": len({tuple(r[k] for k in ROUTE) for r in S1}), "off_gate": len(outside)}
|
||||
L += ["", f"Shadows reported without both gates: {len(outside)} (likely mis-entered).", ""]
|
||||
# a gate counts as missed only when the run answers it otherwise; a run that does not say (a short Reddit
|
||||
# comment, a blank form answer) is not a contradiction
|
||||
def stated(v):
|
||||
return bool(v) and v != "Unknown" and not str(v).startswith("(")
|
||||
|
||||
def contradicts(r):
|
||||
return (stated(r["scream"]) and r["scream"] != "Investigate & help") or (stated(r["hour"]) and r["hour"] != "Tree")
|
||||
outside = [r for r in runs if r["saw_shadow"] and contradicts(r)]
|
||||
unstated = [r for r in runs if r["saw_shadow"] and not contradicts(r)
|
||||
and not (r["scream"] == "Investigate & help" and r["hour"] == "Tree")]
|
||||
facts["shadow_routes"] = {"runs": len(S1), "routes": len({tuple(r[k] for k in ROUTE) for r in S1}),
|
||||
"off_gate": len(outside), "gates_unstated": len(unstated)}
|
||||
L += ["", f"Shadows reported with an answer that contradicts a gate: {len(outside)} (likely mis-entered or misread). "
|
||||
f"Another {len(unstated)} do not say whether they passed both gates.", ""]
|
||||
|
||||
# 5. after the shadow
|
||||
SH = [r for r in runs if r["saw_shadow"]]
|
||||
|
||||
@@ -56,7 +56,7 @@ The 97 form runs with a shadow (all attempts) took 47 different recorded routes:
|
||||
- **The bullies' fate:** Squadmate's revenge 61, Left bullies to the dragons 25, Killed the bullies yourself 9, Unknown 2
|
||||
- **The fork:** West 46, Forest 36, East 14, Unknown 1
|
||||
|
||||
Shadows reported without both gates: 17 (likely mis-entered).
|
||||
Shadows reported with an answer that contradicts a gate: 3 (likely mis-entered or misread). Another 14 do not say whether they passed both gates.
|
||||
|
||||
## 5. After the shadow: the Blue, then the Black
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
# (not blank), {any: [condition, ...]} (at least one). Several fields in one condition must all hold.
|
||||
version: 1
|
||||
|
||||
# Which runs of data/public/runs_clean.csv the statistics use (its `source` column). Runs from the other sources
|
||||
# (reported, bot, Reddit result pages) are in the published file but not in these statistics yet: they are coded
|
||||
# from different questions, and the bot follows a strategy, so pooling them needs its own review.
|
||||
sources: [reddit spreadsheet]
|
||||
# Which runs of data/public/runs_clean.csv the statistics use (its `source` column): every source that records the
|
||||
# route (the community form, "Report a run", the Reddit megathread comments, the DragonKind bot). The Reddit result
|
||||
# pages and the register record only the end, so they stay out. The bot plays to a strategy and burns on purpose at
|
||||
# encounters it is not chasing: like every rider's deliberate death (`_deliberate`, the route model's rule), those
|
||||
# burns are left out of the bond rates, never counted as failed bonds.
|
||||
sources: [reddit spreadsheet, reported, reddit comment, bot]
|
||||
|
||||
colours: [Red, Green, Orange, Brown, Blue, Black]
|
||||
|
||||
@@ -25,7 +27,7 @@ outcomes:
|
||||
event: { saw_shadow: true }
|
||||
bond_blue_meadow:
|
||||
label: Bond, given you approached the meadow Blue
|
||||
denom: { branch: "Passed the Red: meadow", enc_Blue: { in: ["Bonded!", "Incinerated"] } }
|
||||
denom: { branch: "Passed the Red: meadow", enc_Blue: { in: ["Bonded!", "Incinerated"] }, _deliberate: { not: true } }
|
||||
event: { enc_Blue: "Bonded!" }
|
||||
reach_hour:
|
||||
label: Survive to the hour (tree/valley choice)
|
||||
@@ -34,7 +36,7 @@ outcomes:
|
||||
# one more outcome per colour: "Run ends bonded to <colour>", among runs that reached the hour
|
||||
bonded_outcome:
|
||||
label: Run ends bonded to {colour}
|
||||
denom: { hour: { in: [Tree, Valley] } }
|
||||
denom: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } }
|
||||
event: { outcome: Bonded, outcome_color: "{colour}" }
|
||||
|
||||
# Factors compared in the factor tables (each answer against the other answers to the same question)
|
||||
@@ -43,15 +45,15 @@ factors: [company, direction, first_sighting, scream, resolution, combat_first,
|
||||
|
||||
# Route targets: the outcome (event) and which runs could have reached it at all (pool)
|
||||
targets:
|
||||
bond_Blue: { label: Bond Blue, colour: Blue, event: { outcome: Bonded, outcome_color: Blue }, pool: { hour: Valley } }
|
||||
bond_Black: { label: Bond Black, colour: Black, event: { outcome: Bonded, outcome_color: Black }, pool: { hour: Tree } }
|
||||
bond_Blue: { label: Bond Blue, colour: Blue, event: { outcome: Bonded, outcome_color: Blue }, pool: { hour: Valley, _deliberate: { not: true } } }
|
||||
bond_Black: { label: Bond Black, colour: Black, event: { outcome: Bonded, outcome_color: Black }, pool: { hour: Tree, _deliberate: { not: true } } }
|
||||
see_Blue: { label: Meet a Blue (meadow), colour: Blue, event: { saw_blue_meadow: true }, pool: { branch: "Passed the Red: meadow" } }
|
||||
see_shadow: { label: Get the tree shadow, colour: Black, event: { saw_shadow: true }, pool: { hour: Tree, branch: { exists: true } } }
|
||||
bond_Red: { label: Bond Red, colour: Red, event: { outcome: Bonded, outcome_color: Red }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
bond_Green: { label: Bond Green, colour: Green, event: { outcome: Bonded, outcome_color: Green }, pool: { hour: Tree } }
|
||||
bond_Orange: { label: Bond Orange, colour: Orange, event: { outcome: Bonded, outcome_color: Orange }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
bond_Brown: { label: Bond Brown, colour: Brown, event: { outcome: Bonded, outcome_color: Brown }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
bond_any: { label: Bond any dragon, colour: null, event: { outcome: Bonded }, pool: { hour: { in: [Tree, Valley] } } }
|
||||
bond_Red: { label: Bond Red, colour: Red, event: { outcome: Bonded, outcome_color: Red }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
bond_Green: { label: Bond Green, colour: Green, event: { outcome: Bonded, outcome_color: Green }, pool: { hour: Tree, _deliberate: { not: true } } }
|
||||
bond_Orange: { label: Bond Orange, colour: Orange, event: { outcome: Bonded, outcome_color: Orange }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
bond_Brown: { label: Bond Brown, colour: Brown, event: { outcome: Bonded, outcome_color: Brown }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
bond_any: { label: Bond any dragon, colour: null, event: { outcome: Bonded }, pool: { hour: { in: [Tree, Valley] }, _deliberate: { not: true } } }
|
||||
|
||||
# Bonding encounters: which recorded attempt (column) belongs to which in-game encounter (where)
|
||||
encounters:
|
||||
@@ -80,6 +82,8 @@ presets:
|
||||
all: { label: All runs, filters: { source: all, goal: all, excludeFlagged: false } }
|
||||
form: { label: Form submissions only, filters: { source: form, goal: all, excludeFlagged: false } }
|
||||
bulk: { label: Bulk logs only (imports), filters: { source: bulk, goal: all, excludeFlagged: false } }
|
||||
reddit: { label: Reddit comments only, filters: { source: reddit, goal: all, excludeFlagged: false } }
|
||||
bot: { label: DragonKind bot only, filters: { source: bot, goal: all, excludeFlagged: false } }
|
||||
not_chasing: { label: Not chasing Blue/Black, filters: { source: all, goal: exclude_rare, excludeFlagged: false } }
|
||||
chasing: { label: Chasing Blue/Black, filters: { source: all, goal: only_rare, excludeFlagged: false } }
|
||||
unflagged: { label: Rows without data-quality flags, filters: { source: all, goal: all, excludeFlagged: true } }
|
||||
|
||||
@@ -95,7 +95,18 @@ def is_rare(goal):
|
||||
return goal in M["rare_goals"]
|
||||
|
||||
|
||||
# sources other than the community spreadsheet: their own group wherever runs are split by where they came from
|
||||
SOURCE_LABEL = {"reddit comment": "Reddit comments", "bot": "DragonKind bot", "reported": "Reported on the Atlas"}
|
||||
|
||||
|
||||
def entry_group(r):
|
||||
"""Where a run came from: the spreadsheet's entry type (Form, Data Import, ...) or the source's own label."""
|
||||
return SOURCE_LABEL.get(r["source"]) or r["entry"]
|
||||
|
||||
|
||||
def stratum(r):
|
||||
if r["source"] in SOURCE_LABEL:
|
||||
return SOURCE_LABEL[r["source"]]
|
||||
if r["entry"] != "Form":
|
||||
return "Bulk logs (imports)"
|
||||
g = r["goal"]
|
||||
@@ -108,9 +119,14 @@ def goal2(r):
|
||||
|
||||
def apply_filters(runs, f):
|
||||
def ok(r):
|
||||
if f.get("source") == "form" and r["entry"] != "Form":
|
||||
sheet = r["source"] == "reddit spreadsheet"
|
||||
if f.get("source") == "form" and not (sheet and r["entry"] == "Form"):
|
||||
return False
|
||||
if f.get("source") == "bulk" and r["entry"] == "Form":
|
||||
if f.get("source") == "bulk" and not (sheet and r["entry"] != "Form"):
|
||||
return False
|
||||
if f.get("source") == "reddit" and r["source"] != "reddit comment":
|
||||
return False
|
||||
if f.get("source") == "bot" and r["source"] != "bot":
|
||||
return False
|
||||
if f.get("goal") == "exclude_rare" and is_rare(r["goal"]):
|
||||
return False
|
||||
@@ -197,7 +213,7 @@ def analyse(all_runs, filters):
|
||||
dates = sorted(r["date"] for r in runs if r.get("date"))
|
||||
outs = group_by(runs, lambda r: r["outcome"] + (" " + r["outcome_color"] if r.get("outcome_color") else ""))
|
||||
res["meta"] = {
|
||||
"sources": {k: len(v) for k, v in group_by(runs, "entry").items()},
|
||||
"sources": {k: len(v) for k, v in group_by(runs, entry_group).items()},
|
||||
"date_min": dates[0] if dates else None, "date_max": dates[-1] if dates else None,
|
||||
"n_flagged": sum(1 for r in runs if r["data_flags"]), "flag_counts": flag_counts,
|
||||
"outcomes": {k: len(v) for k, v in outs.items()},
|
||||
@@ -220,13 +236,14 @@ def analyse(all_runs, filters):
|
||||
res["encounters"] = []
|
||||
for e in M["encounters"]:
|
||||
col, colour = e["column"], e["colour"]
|
||||
A = [r for r in runs if match(r, e["where"]) and r.get(col) in ("Bonded!", "Incinerated")]
|
||||
# a rider who chose to burn here (chasing another colour) did not fail this encounter
|
||||
A = [r for r in runs if match(r, e["where"]) and r.get(col) in ("Bonded!", "Incinerated") and not r.get("_deliberate")]
|
||||
win = lambda r, col=col: r.get(col) == "Bonded!" # noqa: E731
|
||||
intent = [r for r in A if r["goal"] == colour or r["goal"].startswith("Any") or (r["goal"] == "Blue or Black" and colour in ("Blue", "Black"))]
|
||||
res["encounters"].append({"context": e["context"], "color": colour, "overall": rate(A, win), "intent_matched": rate(intent, win),
|
||||
"by_stratum": {s: rate(g, win) for s, g in sorted(group_by(A, stratum).items())}})
|
||||
greens_where = next(e["where"] for e in M["encounters"] if e["colour"] == "Green")
|
||||
greens = [r for r in runs if match(r, greens_where) and r.get("enc_Green")]
|
||||
greens = [r for r in runs if match(r, greens_where) and r.get("enc_Green") and not r.get("_deliberate")]
|
||||
g = {"green_encounters": len(greens),
|
||||
"bonded_green": sum(1 for r in greens if r["enc_Green"] == "Bonded!"),
|
||||
"rescued_orange": sum(1 for r in greens if r["rescued"] and r.get("outcome_color") == "Orange"),
|
||||
@@ -240,7 +257,7 @@ def analyse(all_runs, filters):
|
||||
|
||||
first2 = lambda r: r["first_sighting"] if r["first_sighting"] in ("Red", "Brown", "Orange", "Green") else None # noqa: E731
|
||||
known = lambda f: (lambda r: None if is_missing(r.get(f)) else r[f]) # noqa: E731
|
||||
src2 = lambda r: "Form submission" if r["entry"] == "Form" else "Bulk log (import)" # noqa: E731
|
||||
src2 = lambda r: SOURCE_LABEL.get(r["source"]) or ("Form submission" if r["entry"] == "Form" else "Bulk log (import)") # noqa: E731
|
||||
res["models"] = {
|
||||
"blue_meadow": fit_model(runs, "blue_meadow", {"source": src2, "goal": goal2, "direction": known("direction"),
|
||||
"first_sighting": first2, "resolution": known("resolution"), "company": known("company")}),
|
||||
@@ -257,7 +274,7 @@ def analyse(all_runs, filters):
|
||||
"blue": W(bk, len(m)), "shadow": W(sk, len(t))})
|
||||
|
||||
res["source_rates"] = {key: {s: rate([r for r in g if match(r, OUTCOMES[key]["denom"])], lambda r, k=key: match(r, OUTCOMES[k]["event"]))
|
||||
for s, g in group_by(runs, "entry").items()} for key in ("blue_meadow", "shadow")}
|
||||
for s, g in group_by(runs, entry_group).items()} for key in ("blue_meadow", "shadow")}
|
||||
return res
|
||||
|
||||
|
||||
@@ -302,9 +319,11 @@ def route_map(runs):
|
||||
"""The route map: nodes and links with run counts, and for every target the hits and their Wilson interval."""
|
||||
nodes, links = {}, {}
|
||||
hits = {t: {} for t in TARGETS}
|
||||
tries = {t: {} for t in TARGETS} # runs that count for the target (no deliberate deaths for a bond)
|
||||
for r in runs:
|
||||
prev = None
|
||||
hit = {t: match(r, T["event"]) for t, T in TARGETS.items()}
|
||||
counts = {t: not (r.get("_deliberate") and t.startswith("bond_")) for t in TARGETS}
|
||||
for si, s in enumerate(STAGES):
|
||||
v = stage_value(r, s["key"])
|
||||
if v is None:
|
||||
@@ -314,15 +333,18 @@ def route_map(runs):
|
||||
nd["n"] += 1
|
||||
for t in TARGETS:
|
||||
hits[t][nid] = hits[t].get(nid, 0) + hit[t]
|
||||
tries[t][nid] = tries[t].get(nid, 0) + counts[t]
|
||||
if prev:
|
||||
lid = prev + "→" + nid
|
||||
ln = links.setdefault(lid, {"id": lid, "source": prev, "target": nid, "n": 0, "chance": bool(s.get("chance"))})
|
||||
ln["n"] += 1
|
||||
for t in TARGETS:
|
||||
hits[t][lid] = hits[t].get(lid, 0) + hit[t]
|
||||
tries[t][lid] = tries[t].get(lid, 0) + counts[t]
|
||||
prev = nid
|
||||
nl, ll = list(nodes.values()), list(links.values())
|
||||
by_target = {t: {"nodes": [W(hits[t][n["id"]], n["n"]) for n in nl], "links": [W(hits[t][l["id"]], l["n"]) for l in ll]} for t in TARGETS}
|
||||
by_target = {t: {"nodes": [W(hits[t][n["id"]], tries[t][n["id"]]) for n in nl],
|
||||
"links": [W(hits[t][l["id"]], tries[t][l["id"]]) for l in ll]} for t in TARGETS}
|
||||
return {"nodes": nl, "links": ll, "by_target": by_target}
|
||||
|
||||
|
||||
@@ -551,6 +573,8 @@ def main(argv=None):
|
||||
ap.add_argument("--out", default=str(ROOT / "data/public/stats.json"))
|
||||
a = ap.parse_args(argv)
|
||||
runs = runs_io.read(a.data, sources=M["sources"])
|
||||
for r in runs:
|
||||
r["_deliberate"] = deliberate(r)
|
||||
out = build(runs, len(runs), exported(), every_run=runs_io.read(a.data))
|
||||
Path(a.out).write_text(json.dumps(out, separators=(",", ":"), ensure_ascii=False), encoding="utf-8")
|
||||
print(f"{a.out}: {len(runs)} runs, {len(out['presets'])} presets, {Path(a.out).stat().st_size / 1e6:.1f} MB")
|
||||
|
||||
@@ -112,10 +112,13 @@ def build(dictionary=None):
|
||||
"citeAs": ds["citation"].format(repository=forge.repo_url(fg)),
|
||||
"isLiveDataset": True,
|
||||
"isBasedOn": [
|
||||
{"@type": "sc:CreativeWork", "name": s["label"], "url": next(iter(s["links"].values()))}
|
||||
{"@type": "sc:CreativeWork", "url": s["links"][k],
|
||||
"name": s["label"] + (f" ({k.replace('part', 'part ')})" if len(s.get("cite") or ()) > 1 else "")}
|
||||
for s in sources.values()
|
||||
# the route PDF is only fingerprinted, never redistributed; the bot's repo is private
|
||||
if (s.get("privacy") or {}).get("redistribute", True) and s.get("links")
|
||||
# `cite` (collection/pipeline.yaml) names the links the source is based on; default: the first link
|
||||
for k in (s.get("cite") or [next(iter(s["links"]))])
|
||||
],
|
||||
"distribution": distribution,
|
||||
"recordSet": [
|
||||
|
||||
@@ -57,6 +57,7 @@ sources:
|
||||
runs: null # a flowchart of the routes, not a log of runs (see collection/README.md)
|
||||
|
||||
reddit_thread:
|
||||
cite: [part3, part4] # both megathreads, in the dataset's isBasedOn
|
||||
label: Runs posted in the r/fourthwing Dragonkind megathreads
|
||||
run_source: reddit thread
|
||||
links:
|
||||
@@ -70,6 +71,7 @@ sources:
|
||||
runs: reddit_results
|
||||
|
||||
reddit_comments:
|
||||
cite: [part3, part4] # both megathreads, in the dataset's isBasedOn
|
||||
label: Runs riders describe in the r/fourthwing Dragonkind megathread comments
|
||||
run_source: reddit comment
|
||||
links:
|
||||
|
||||
+22
-12
@@ -66,23 +66,33 @@
|
||||
"isBasedOn": [
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"name": "Threshing Routes form and spreadsheet (u/ClumsyBadger, linked from the r/fourthwing megathreads)",
|
||||
"url": "https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0"
|
||||
"url": "https://docs.google.com/spreadsheets/d/1gnw1AdRg1XT4JsOfRM6QTA0jSaS3n9ZF-rPWnYewzv0",
|
||||
"name": "Threshing Routes form and spreadsheet (u/ClumsyBadger, linked from the r/fourthwing megathreads)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"name": "Unofficial Dragon Register (which dragon each rider bonded)",
|
||||
"url": "https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ"
|
||||
"url": "https://docs.google.com/spreadsheets/d/1KMiE9sec0l597Pzue1OhGYf07NF4howtQ_lPeqx7jXQ",
|
||||
"name": "Unofficial Dragon Register (which dragon each rider bonded)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"name": "Runs posted in the r/fourthwing Dragonkind megathreads",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/"
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/",
|
||||
"name": "Runs posted in the r/fourthwing Dragonkind megathreads (part 3)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/"
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wz5cnj/",
|
||||
"name": "Runs posted in the r/fourthwing Dragonkind megathreads (part 4)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wvwfp9/",
|
||||
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments (part 3)"
|
||||
},
|
||||
{
|
||||
"@type": "sc:CreativeWork",
|
||||
"url": "https://www.reddit.com/r/fourthwing/comments/1wz5cnj/",
|
||||
"name": "Runs riders describe in the r/fourthwing Dragonkind megathread comments (part 4)"
|
||||
}
|
||||
],
|
||||
"distribution": [
|
||||
@@ -143,8 +153,8 @@
|
||||
"description": "Every number the Atlas page shows, for six filter presets (analysis/stats/site_stats.py; what is measured is analysis/stats/measures.yaml).",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/stats.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "bb401225065ae17311bbd02fd63acd4010f4e325d7eab74e044115b98d04bec4",
|
||||
"contentSize": "5498476 B"
|
||||
"sha256": "89a6246da2495685733e20f2de9897299bd19d469aaeadbd8883972856787ce5",
|
||||
"contentSize": "5151910 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
@@ -153,8 +163,8 @@
|
||||
"description": "The route model: the game (core/spec/game.yaml), the count tables behind every roll, and the best decision tree for every dragon colour under two goals, with posterior intervals (planner/build_policy.py).",
|
||||
"contentUrl": "https://git.kenschiano.net/DragonKind/threshing-atlas/raw/branch/main/data/public/policy.json",
|
||||
"encodingFormat": "application/json",
|
||||
"sha256": "f65aaebb23cb3f56dad0387a94113857eb44c4ba077cfe5fc6215c202546588c",
|
||||
"contentSize": "987411 B"
|
||||
"sha256": "d464fb6c90b1c3b56e8ac1a90aa86e23d0cfde617b7aeb1d601233ed8a1872cc",
|
||||
"contentSize": "987551 B"
|
||||
},
|
||||
{
|
||||
"@type": "cr:FileObject",
|
||||
|
||||
@@ -116,7 +116,8 @@
|
||||
"shadow_routes": {
|
||||
"runs": 97,
|
||||
"routes": 47,
|
||||
"off_gate": 17
|
||||
"off_gate": 3,
|
||||
"gates_unstated": 14
|
||||
},
|
||||
"after_shadow": {
|
||||
"reached_black": 89,
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -31,18 +31,21 @@ def low_bias(r, lb=CONFIG["low_bias"]):
|
||||
"""Kept in the low-bias sample: every run of an always-kept source, bulk logs, and riders not chasing a rare dragon."""
|
||||
if r["source"] in lb["always"]:
|
||||
return True
|
||||
if r["source"] in (lb.get("never") or ()):
|
||||
return False
|
||||
if r["source"] == "reddit spreadsheet" and "bulk" in lb["entries_kept"] and r["entry"] not in (None, "Form"):
|
||||
return True
|
||||
return r["goal"] not in lb["rare_goals"]
|
||||
|
||||
|
||||
def drop_flagged(runs, cfg=CONFIG.get("drop_flagged") or {}):
|
||||
"""Without the flagged runs of the sources read automatically from free text (planner/policy.yaml drop_flagged)."""
|
||||
sources, keep = set(cfg.get("sources") or ()), tuple(cfg.get("except") or ())
|
||||
"""Without the runs of the sources read automatically from free text that break a game rule
|
||||
(planner/policy.yaml drop_flagged): every other run is kept, however partial."""
|
||||
sources, rules = set(cfg.get("sources") or ()), tuple(cfg.get("rules") or ())
|
||||
|
||||
def problems(r):
|
||||
return [f for f in (r.get("data_flags") or "").split("; ") if f and not f.startswith(keep)] if keep else [f for f in (r.get("data_flags") or "").split("; ") if f]
|
||||
return [r for r in runs if r["source"] not in sources or not problems(r)]
|
||||
def impossible(r):
|
||||
return any(rule in f for f in (r.get("data_flags") or "").split("; ") for rule in rules)
|
||||
return [r for r in runs if r["source"] not in sources or not impossible(r)]
|
||||
|
||||
|
||||
def clean(o):
|
||||
|
||||
+15
-6
@@ -6,21 +6,29 @@
|
||||
version: 1
|
||||
|
||||
# the `source` values of data/public/runs_clean.csv the model learns from
|
||||
sources: [reddit spreadsheet, reported, bot]
|
||||
sources: [reddit spreadsheet, reported, bot, reddit comment]
|
||||
|
||||
# Sources read automatically from free text: a run with any data flag (a broken game rule, an unrecognised answer)
|
||||
# is left out of the model, since the flag may mean the text was misread or misremembered. Flags that only say where
|
||||
# the run came from (`except`, matched at the start of a flag) do not count. A hand fix that clears the flags
|
||||
# brings the run back. Applies once the source is also listed in `sources` above.
|
||||
# Sources read automatically from free text: only a run that breaks one of the game's rules (the checks of
|
||||
# collection/etl/runs.py rule_flags, matched as text inside its flags) is left out of the model, since it cannot have
|
||||
# happened as read. Every other run is kept, however partial. A hand fix that clears the flag brings the run back.
|
||||
# The first-sighting pool is not here: form runs outside it are kept too, so these are kept for the same reason.
|
||||
drop_flagged:
|
||||
sources: [reddit comment]
|
||||
except: ["read from a Reddit comment"]
|
||||
rules:
|
||||
- "encounter, which has only"
|
||||
- "Green recorded on a Valley run"
|
||||
- "does not follow"
|
||||
- "fight answers on a run that did not help"
|
||||
- "a path after the fight on a run without a fight"
|
||||
- "a second fight move without pausing to assess"
|
||||
- "died before the hour, yet reached"
|
||||
|
||||
# Two samples. "all" is every run above. "lowBias" leaves out runs where a rare sighting is more likely to have
|
||||
# been reported than a miss: form submissions and reports from riders chasing Blue or Black. The bot logs every
|
||||
# run, and bulk-pasted logs record every run of the players who kept them, so both stay in.
|
||||
low_bias:
|
||||
always: [bot] # sources whose every run is kept
|
||||
never: [reddit comment] # riders posting a run in a thread pick the notable ones, like rare-chasers
|
||||
entries_kept: [bulk] # spreadsheet rows whose `entry` is not "Form" (bulk-pasted logs)
|
||||
rare_goals: [Blue, Black, Blue or Black]
|
||||
|
||||
@@ -46,3 +54,4 @@ reporting_bias:
|
||||
- { name: "form, chasing Blue/Black", when: { source: reddit spreadsheet, goal: rare } }
|
||||
- { name: "form, other", when: { source: reddit spreadsheet } }
|
||||
- { name: reported, when: { source: reported }, same_as: "form, other" }
|
||||
- { name: reddit comments, when: { source: reddit comment } } # self-selected: its own reporting rate
|
||||
|
||||
+1
-1
@@ -554,7 +554,7 @@
|
||||
</tbody></table></div><p class="small">Bulk logs come from players who recorded every run, so they are the least selective rows. Their rare-dragon rates are several times lower than the form's, which is the strongest sign of reporting bias in this data.</p></div>
|
||||
<div class="panel"><h3>Rows flagged for contradictions</h3><p class="small muted">${m.n_flagged} of ${r.n} rows (${pct(m.n_flagged / r.n)}). Flagged rows stay in unless you pick "Rows without data-quality flags" above.</p><div class="tbl-wrap"><table><tbody>${flags.map(([f, n]) => `<tr><td>${esc(f)}</td><td class="num">${n}</td></tr>`).join("") || `<tr><td>None</td></tr>`}</tbody></table></div></div>
|
||||
<div class="panel"><h3>How runs ended</h3><div class="tbl-wrap"><table><tbody>${outs.map(([f, n]) => `<tr><td>${esc(f)}</td><td class="num">${n}</td><td class="num">${pct(n / r.n)}</td></tr>`).join("")}</tbody></table></div><p class="small muted">"No outcome recorded" rows reached the hour but the form shows no Bonded or Incinerated. They count toward reaching a branch but not toward bond rates.</p></div>
|
||||
<div class="panel"><h3>Independence</h3><p class="small">The form has no player ID. One player's 50 runs count as 50 independent runs, so intervals are somewhat narrower than they should be. ${pct((r.n - (m.sources["Form"] || 0)) / r.n, 0)} of rows arrived as bulk imports, each probably one player's or one group's log.</p></div>
|
||||
<div class="panel"><h3>Independence</h3><p class="small">The form has no player ID. One player's 50 runs count as 50 independent runs, so intervals are somewhat narrower than they should be. ${pct(Object.entries(m.sources).filter(([k]) => !["Form", "Reddit comments", "DragonKind bot", "Reported on the Atlas"].includes(k)).reduce((s, [, n]) => s + n, 0) / r.n, 0)} of rows arrived as bulk imports, each probably one player's or one group's log.</p></div>
|
||||
<div class="panel"><h3>What the form does not ask</h3><p class="small">The redesigned form asks how you reacted to the first dragon (answered in ${r.factors.reach_hour.rows.filter((x) => x.factor === "sighting_action" && !["Unknown", "(not asked)"].includes(x.level)).reduce((a, x) => a + x.n, 0)} rows; most riders answer "Unsure") and how the bully fight went (${r.factors.reach_hour.rows.filter((x) => x.factor === "combat_first" && x.level !== "(not recorded)").reduce((a, x) => a + x.n, 0)} rows). It still does not record most choices inside the bonding encounters. Theories that rely on those choices cannot be confirmed or refuted here.</p></div>`;
|
||||
}
|
||||
const sourceRate = (outKey, source) => state.res.source_rates[outKey][source];
|
||||
|
||||
Reference in New Issue
Block a user