Complete M2 validation and lock the G1 evaluation protocol
Run and record both blind LLM validation passes and the external cross-checks. Freeze the evaluation inputs, well splits, and reporting scope with a SHA-256 checksum. Use NPT definition b for DDR-code prediction with definition a as a sensitivity analysis. Retain the class reporting thresholds and record the empty set of eligible classes. Make T4 and OCR fidelity the headline analyses and align the progress report and project documentation. Co-authored-by: OpenAI Codex <noreply@openai.com>
This commit is contained in:
@@ -13,6 +13,8 @@ import math
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from volve_dia import paths
|
||||
|
||||
#: Values the rater may choose (labels.yaml t2.cause_groups without hse, t1.op_classes without interruption).
|
||||
CAUSES = ("equipment", "weather", "waiting", "stuck_fishing", "lost_circulation", "well_control", "sidetrack",
|
||||
"operation_failed", "unspecified")
|
||||
@@ -20,6 +22,17 @@ OP_CLASSES = ("drill_ream", "trip", "casing_cement", "circulate", "bop_wellhead"
|
||||
"perforate", "wireline", "plug_abandon", "rig_move", "rig_up_down", "wait", "other")
|
||||
|
||||
|
||||
def load_activity_labels() -> pd.DataFrame:
|
||||
d = paths.outputs_dir() / "labels"
|
||||
x = pd.read_parquet(d / "t2_inputs.parquet")
|
||||
lab = pd.read_parquet(d / "t2_labels.parquet")[["act_id", "npt_a", "npt_b", "cause_a", "cause_b"]]
|
||||
ops = pd.read_parquet(d / "t1_activities.parquet")[["act_id", "op_class"]]
|
||||
x = x.sort_values(["report_id", "seq"])
|
||||
g = x.groupby("report_id")["comments"]
|
||||
x["prev_comment"], x["next_comment"] = g.shift(1), g.shift(-1)
|
||||
return x.merge(lab, on="act_id", validate="1:1").merge(ops, on="act_id", validate="1:1")
|
||||
|
||||
|
||||
def allocate(sizes: dict[str, int], k: int, minimum: int) -> dict[str, int]:
|
||||
"""Split k items over strata: `minimum` each (or the whole stratum if smaller), the rest proportional to the
|
||||
square root of the stratum size, by largest remainder, never more than a stratum holds."""
|
||||
@@ -84,7 +97,8 @@ def cohen_kappa(a: pd.Series, b: pd.Series, weight: pd.Series | None = None) ->
|
||||
po = float(w[a == b].sum() / w.sum())
|
||||
pa = w.groupby(a).sum() / w.sum()
|
||||
pb = w.groupby(b).sum() / w.sum()
|
||||
pe = float(sum(pa.get(c, 0.0) * pb.get(c, 0.0) for c in set(pa.index) | set(pb.index)))
|
||||
categories = sorted(set(pa.index) | set(pb.index))
|
||||
pe = float(sum(pa.get(c, 0.0) * pb.get(c, 0.0) for c in categories))
|
||||
return None if pe >= 1.0 else (po - pe) / (1.0 - pe)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user