Skip to content

AnwarDebes/Multi-HGTM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Multi-HGTM banner

release python license tests paper

One Graph Tsetlin Machine tower per view, fused by an interpretable head that learns cross-view conjunctions.

Multi-View Hierarchical Graph Tsetlin Machine. One Graph Tsetlin Machine tower per view of the input, fused by an interpretable Tsetlin head that learns conjunctive rules across views. Multi-HGTM is the canonical generalisation of the ad-hoc dual-graph / tri-graph / multi-graph Tsetlin systems, and it keeps the views modular, which buys missing-view inference, per-view attribution, and cross-view rule interpretability.

University of Agder (UiA).

Where it sits

The Tsetlin Machine learns propositional clauses. The Graph Tsetlin Machine (GraphTM) lifts that to graphs with per-node clause evaluation, OR-across-nodes voting and hypervector message passing. HGTM stacks GraphTM layers in depth. Multi-HGTM stacks them in width: a tower per view, glued by a fusion head.

      view G^(1) ──► [ GraphTM tower 1 ] ──► clause-firing Ο†^(1) ─┐
      view G^(2) ──► [ GraphTM tower 2 ] ──► clause-firing Ο†^(2) ──
          ...                                                     β”œβ”€β–Ί [ Tsetlin fusion head ] ──► class
      view G^(V) ──► [ GraphTM tower V ] ──► clause-firing Ο†^(V) β”€β”˜     learns cross-view conjunctions

Each tower is trained on the label directly, so unlike HGTM's depth stacking the fusion head always receives a real supervised signal. The clause fusion head learns rules such as (view-A clause i fired) AND (view-B clause j did not) => class c, which read back as named cross-view logic.

Honest status

 +------------------------------------------------------------------+
 |  v0.1.0                                                           |
 |                                                                  |
 |  Library:           complete; CPU (NumPy) + GPU (GraphTM) paths. |
 |  Core TM:           XOR + multi-class verified; deterministic.   |
 |  Load-bearing result (cross-view conjunction, graph towers,      |
 |    5 seeds, V100):                                               |
 |       best single view  0.690 +/- 0.022                          |
 |       late fusion       0.727 +/- 0.077                          |
 |       CLAUSE fusion     0.968 +/- 0.040                          |
 |    clause vs late +0.241 (95% CI [+0.16,+0.33]), Wilcoxon        |
 |    p = 0.03125 (clause wins on all five seeds).                  |
 |  Real data (breast cancer, 3 views, 5 seeds):                    |
 |       best single view  0.908 +/- 0.038                          |
 |       late fusion       0.925 +/- 0.012                          |
 |       clause fusion     0.928 +/- 0.022  (clause ~ late when     |
 |       views are redundant; both beat the best single view).      |
 |  Interpretability:  77-93% of fusion clauses span both views.    |
 |  Tests:             25 passing (CPU); GPU tests skip w/o CUDA.   |
 |  Target venue:      ISTM 2026.                                   |
 +------------------------------------------------------------------+

The numbers above are produced by experiments/run_experiments.py and stored in experiments/results/*.jsonl. See paper/ for the write-up and docs/benchmarks.md for the full tables.

Why clause fusion, not just an ensemble

We construct a task that separates the two: y = (a1 AND b1) OR (a2 AND b2), with the a-bits in view A and the b-bits in view B. This label is provably not expressible as a sum of per-view scores, so additive late fusion (a GraphTM voting ensemble) cannot solve it, while every bit is still marginally predictive so each greedy tower learns to expose it. Only a head that forms conjunctions across views solves the task. That is the contribution.

Install

pip install -e .                       # NumPy core (CPU path, tests, fusion head)
pip install pycuda                     # graph towers (needs a CUDA device)
export HGTM_PATH=/path/to/HGTM         # the HierarchicalGraphTsetlinMachine project

The tabular reference path and the fusion head run on NumPy alone. Graph towers need a CUDA GPU and the sibling HGTM library.

Quickstart

from MultiHGTM import MultiViewHGTM, datasets

ds = datasets.make_cross_view_conjunction(seed=0, kind="graph")  # or kind="tabular"

specs = [dict(kind="graph", name=n, number_of_clauses=80, T=80, s=5.0,
              depth=2, message_size=32, epochs=20) for n in ds["view_names"]]

model = MultiViewHGTM(specs, fusion="clause",
                      fusion_params=dict(number_of_clauses=160, T=22, s=4.0),
                      fusion_epochs=60, seed=0)
model.fit(ds["views_train"], ds["y_train"])

preds = model.predict(ds["views_test"])                       # full multi-view
one_view = model.predict(ds["views_test"], views_present=[True, False])  # missing view
imp = model.view_importance(ds["views_test"], ds["y_test"])   # per-view attribution
rules = model.explain(class_id=1)                             # readable cross-view rules

GPU-free path: pass kind="tabular" everywhere and use kind="tabular" tower specs; the whole pipeline runs in NumPy.

Reproduce the results

python experiments/run_experiments.py cross_view            # the load-bearing proof (GPU)
python experiments/run_experiments.py complementary         # routing + missing-view (GPU)
python experiments/run_experiments.py bcw                   # real data: breast cancer, 3 views (CPU)
python experiments/run_experiments.py cross_view_tabular    # GPU-free reproduction of the proof
python experiments/analyse.py                               # tables + figures from results/

Public API

from MultiHGTM import MultiViewHGTM            # the orchestrator
from MultiHGTM.tsetlin import MultiClassTsetlinMachine   # NumPy TM (fusion head + reference tower)
from MultiHGTM.views import GraphViewTower, TabularViewTower
from MultiHGTM import datasets
call what it does
MultiViewHGTM(view_specs, fusion="clause"/"late", ...) build a multi-view model
.fit(views_train, Y) train towers on Y, then the fusion head
.predict(views, views_present=None) predict; drop any subset of views via the mask
.predict_single_view(views, v) the single-view baseline
.view_importance(views, Y) leave-one-view-out accuracy drop and flip rate
.fusion_clause_view_usage() cross-view clause fraction
.explain(class_id) readable cross-view fusion rules

What Multi-HGTM builds on

Source Role
Granmo 2018 (arXiv:1804.01508) the Tsetlin Machine learning rule
Granmo et al. 2025 (arXiv:2507.14874), cair/GraphTsetlinMachine the GraphTM towers
HGTM (UiA, 2026) depth-stacking predecessor; transform + inter-layer encoding
Glimsdal & Granmo 2021 (arXiv:2108.07594) multi-output clause sharing (orthogonal axis)
Blum & Mitchell 1998; Xu et al. 2013 multi-view learning lineage

See docs/novelty_audit.md for the full positioning and docs/canonical_definition.md for the formal definition.

Repository layout

MultiHGTM/        tsetlin.py  views.py  model.py  datasets.py
experiments/      protocol.py  run_experiments.py  analyse.py  results/*.jsonl
examples/         runnable demos (CPU and GPU)
tests/            CPU tests + GPU-skippable tests
docs/             canonical_definition, novelty_audit, ARCHITECTURE, benchmarks
paper/            the ISTM-style write-up + figures

License

MIT. See LICENSE, including the attribution to cair/GraphTsetlinMachine and the HGTM project.

Citation

@misc{anwar2026multihgtm,
  author = {Anwar},
  title  = {Multi-HGTM: a Multi-View Hierarchical Graph Tsetlin Machine},
  year   = {2026},
  note   = {University of Agder},
  howpublished = {\url{https://github.com/AnwarDebes/Multi-HGTM}}
}

About

Multi-view Graph Tsetlin Machine: one tower per view, fused by an interpretable head that learns cross-view conjunctive rules an additive vote cannot represent. Built for the University of Agder πŸŸ₯ πŸ”΄ πŸŽ“ πŸ›οΈ

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors