ensemble / tests /test_embedding.py

Commit History

v0.5: factual generalization via dense analogy. learn_relation + solve_analogy implement Mikolov paris-france+spain=madrid in normalized dense space, averaged over known examples, excluding the query slot. Wired into structural answer() so unseen slots get plain-text answers. Measured end-to-end via the Brain with fastText: capitals holdout goes 0% (char) / 0% (structural) -> ~50-67% factual-correct (spain->madrid, portugal->lisbon, greece->athens, norway->oslo recovered correctly). from_fasttext uses batch projection (fast load). The semantic wall is broken. 109 tests.
595d852
verified

thefinalboss commited on

v0.4: optional embedding expert for real semantic similarity. New projection.py (dense->HV via random projection + sign, cosine-preserving). EmbeddingExpert plugs into the brain unchanged (duck-typed Expert contract) and makes spain~portugal similar at the HV level (the missing ingredient for analogy). Two paths: from_corpus_local (PPMI+SVD mini-embedding, numpy-only) and from_fasttext (pretrained .vec). StructuralEncoder.attach_embedding wires semantic slot HVs. Honest: mini-embedding brings semantic similarity (measurable) but factual correctness stays ~0% (needs fastText + better decoding); pipeline ready. 106 tests.
0bee73d
verified

thefinalboss commited on