|
27 | 27 | from research.rrc_compactification import model25 as model |
28 | 28 | from research.deletion_memory_barrier_v1.reference import ( |
29 | 29 | deletion_law, finite_prior_ceiling, optimal_terminal_success_weighted, |
30 | | - streaming_laws_for_words, |
| 30 | + streaming_laws_for_words, guarded_first_nonempty_laws, |
31 | 31 | ) |
32 | 32 |
|
33 | 33 | STATUS="FROZEN_TRAINED_RRC25_RANKING_DELETION_DIAGNOSTIC" |
@@ -77,17 +77,22 @@ def one_prior_report(prior:dict[str,Fraction],q:Fraction, |
77 | 77 | base=max(prior.values()) |
78 | 78 | for m in counts: |
79 | 79 | for B in bits: |
80 | | - laws=streaming_laws_for_words(prior,q,m,B) |
81 | | - value=optimal_terminal_success_weighted(laws,prior) |
82 | 80 | limit=finite_prior_ceiling(prior,B) |
83 | | - if not base<=value<=limit: |
84 | | - raise AssertionError("monitor prior ceiling violated") |
85 | | - rows.append({"m":m,"B":B,"success":str(value), |
86 | | - "success_float":float(value), |
87 | | - "prior_topK_ceiling":str(limit), |
88 | | - "prior_topK_ceiling_float":float(limit), |
89 | | - "terminal_state_alphabet":1<<B, |
90 | | - "decoder_static_codebook_source_atoms":len(prior)}) |
| 81 | + for method,build_law in ( |
| 82 | + ("rolling_hash",streaming_laws_for_words), |
| 83 | + ("protected_first_nonempty",guarded_first_nonempty_laws) |
| 84 | + ): |
| 85 | + laws=build_law(prior,q,m,B) |
| 86 | + value=optimal_terminal_success_weighted(laws,prior) |
| 87 | + if not base<=value<=limit: |
| 88 | + raise AssertionError("monitor prior ceiling violated") |
| 89 | + rows.append({"m":m,"B":B,"method":method, |
| 90 | + "success":str(value), |
| 91 | + "success_float":float(value), |
| 92 | + "prior_topK_ceiling":str(limit), |
| 93 | + "prior_topK_ceiling_float":float(limit), |
| 94 | + "terminal_state_alphabet":1<<B, |
| 95 | + "decoder_static_codebook_source_atoms":len(prior)}) |
91 | 96 | unrestricted=full_one_trace_success(prior,q) |
92 | 97 | if any(row["success_float"] > float(unrestricted)+1e-12 |
93 | 98 | for row in rows if row["m"]==1): |
@@ -166,7 +171,7 @@ def main(argv=None)->int: |
166 | 171 | compact.append({ |
167 | 172 | "q":q["deletion_q"], |
168 | 173 | "full_one_trace_MAP":q["one_trace_MAP_float"], |
169 | | - "monitor":[{"m":x["m"],"B":x["B"], |
| 174 | + "monitor":[{"m":x["m"],"B":x["B"],"method":x["method"], |
170 | 175 | "success":round(x["success_float"],6), |
171 | 176 | "upper":round(x["prior_topK_ceiling_float"],6)} |
172 | 177 | for x in q["monitor_grid"] if |
|
0 commit comments