MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / classify_row

Function classify_row

analysis.py:120–150  ·  view source on GitHub ↗

Classify an experiment row (dict or pandas Series) into one of: 'kept' -- correctness PASS and tagged as kept / speedup > 1 'failed' -- correctness FAIL or crash 'reverted'-- correct but slower (reverted / not kept)

(row)

Source from the content-addressed store, hash-verified

118# ---------------------------------------------------------------------------
119
120def classify_row(row) -> str:
121 """
122 Classify an experiment row (dict or pandas Series) into one of:
123 'kept' -- correctness PASS and tagged as kept / speedup > 1
124 'failed' -- correctness FAIL or crash
125 'reverted'-- correct but slower (reverted / not kept)
126 """
127 raw_correctness = row.get("correctness", "")
128 correctness = str(raw_correctness).upper() if pd.notna(raw_correctness) else ""
129 if correctness in ("FAIL", "CRASH", "ERROR"):
130 return "failed"
131
132 # If speedup_vs_pytorch is available and > 1, or if there's no explicit
133 # revert indicator, use speedup to decide
134 speedup = row.get("speedup_vs_pytorch", "")
135 raw_tag = row.get("tag", "")
136 tag = str(raw_tag).lower() if pd.notna(raw_tag) else ""
137
138 if tag in ("revert", "reverted", "discard"):
139 return "reverted"
140
141 if isinstance(speedup, (int, float)) and pd.notna(speedup):
142 if float(speedup) >= 1.0:
143 return "kept"
144 return "reverted"
145
146 # Default: if correctness is PASS and we can't tell, treat as kept
147 if correctness == "PASS":
148 return "kept"
149
150 return "reverted"
151
152
153# ---------------------------------------------------------------------------

Callers 2

make_progress_plotFunction · 0.85
print_terminal_summaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected