nickypro's picture
Upload folder using huggingface_hub
0e15c7a verified
Raw
History Blame Contribute Delete
1.55 kB
"""Base technique. Implements the contract surface; subclasses override axes."""
from __future__ import annotations
class Technique:
NAME = "base"
AXES = "" # subset of "RDFCMXS"
def fit(self, corpus, encoder):
"""Optional global/unsupervised setup. Default: no-op."""
return None
# Per-axis methods return (commit: bool, prediction, confidence: float in [0,1]).
# A challenge only calls the method for its axis; unimplemented -> not run.
def recover(self, encoder, train, test, target):
raise NotImplementedError
def discover(self, encoder, corpus):
raise NotImplementedError
def calibrate(self, encoder, train, test, target):
raise NotImplementedError
def localize(self, encoder, items):
raise NotImplementedError
def control(self, encoder, items, target):
raise NotImplementedError
def faithfulness(self, encoder, train, test, target):
raise NotImplementedError
def structure(self, encoder, data):
raise NotImplementedError
def calibrate_ro(self, encoder, train, test, target):
"""C2: decide whether to claim a readable direction as a CAUSAL knob.
Default honest behavior: a readable-not-causal direction is a known-negative;
a technique with no causal verification should ABSTAIN. Subclasses that DO
causally verify may override. (The trap: read the label off z, find a
readable direction, and commit it as a knob -> hallucination.)"""
return False, None, 0.0