Implement typed evidence latent training and benchmarks
CI / test (push) Failing after 6s

This commit is contained in:
2026-10-01 22:44:07 +08:00
parent 1d798cb73f
commit b3774e783c
22 changed files with 747 additions and 119 deletions
+24 -3
View File
@@ -8,9 +8,15 @@ SHAPES = ("circle", "square", "triangle", "star")
RELATIONS = ("left_of", "right_of", "above", "below")
CLASSES = ("alpha", "beta", "gamma", "delta")
OBJECT_IDS = ("obj1", "obj2", "obj3")
VARIABLES = ("var_x",)
PREDICATES = ("color", "shape", "left_of", "right_of", "above", "below", "implies_class")
ENTITIES = OBJECT_IDS + COLORS + SHAPES + CLASSES
PREDICATES = ("color", "shape", "left_of", "right_of", "above", "below", "class")
ENTITIES = OBJECT_IDS + COLORS + SHAPES + CLASSES + VARIABLES
NULL_TYPE = 0
FACT_TYPE = 1
RULE_TYPE = 2
NUM_STATE_TYPES = 3
SUBJECT_TO_ID = {value: index for index, value in enumerate(ENTITIES)}
PREDICATE_TO_ID = {value: index for index, value in enumerate(PREDICATES)}
@@ -31,6 +37,22 @@ class Fact:
return cls(**value)
@dataclass(frozen=True)
class Rule:
variable: str
antecedent_predicate: str
antecedent_object: str
consequent_predicate: str
consequent_object: str
def to_dict(self) -> dict[str, str]:
return asdict(self)
@classmethod
def from_dict(cls, value: dict[str, str]) -> "Rule":
return cls(**value)
@dataclass(frozen=True)
class SceneObject:
object_id: str
@@ -41,4 +63,3 @@ class SceneObject:
def to_dict(self) -> dict[str, Any]:
return asdict(self)