caelum0x 174222bcaa feat: Builder-Track named-user tools, bio + evidence-intelligence platform, Apache-2.0
Builds PaperTrail from the base skeleton into a full evidence-verification platform
for the "Built with Claude: Life Sciences" hackathon (Builder Track).

New named-user features (Build Beyond the Bench):
- Lab Notebook Companion — rough bench notes -> structured, searchable, grounded
  experiment records (lib/labNotebook, /console/lab-notebook, migration 0059)
- Clinical Trial Matcher — de-identified patient notes -> ranked eligible
  ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning
  (lib/trialMatcher, /console/trial-matcher, migrations 0060)

Platform:
- Deterministic verification moat (biostats recompute, exact-span grounding)
- 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar,
  PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier)
- Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise
  governance (RBAC, /api/v1 gateway, metering, audit chain, retention)
- 17 OSS projects assimilated into native TypeScript on our stack (backend/engines
  retained + credited in NOTICE)
- Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site
- Next.js 16 upgrade, benchmark harness (honest smoke-test caveat)

Licensing: Apache-2.0 (LICENSE + NOTICE).
2026-07-10 16:23:13 +03:00

44 lines
1.5 KiB
Python

"""Demonstrate creating a model with a combine representation."""
import torch
from pykeen.models import ERModel
from pykeen.nn import CombinedRepresentation, ConcatProjectionCombination, Embedding
from pykeen.triples.generation import generate_triples_factory
from pykeen.typing import FloatTensor
n_entities = 15
n_relations = 3
n_triples = 100
feature_dim = 35
pre_combination_embedding_dim = 32
post_combination_embedding_dim = 16
# mock some triples
triples_factory = generate_triples_factory(n_entities, n_relations, n_triples)
# mock some feature tensor
features = torch.rand(n_entities, feature_dim)
# note that the embedding doesn't need the same dimension as the
embedding = Embedding(max_id=n_entities, shape=pre_combination_embedding_dim)
# this embedding is a combination of the features and a learnable embedding.
entity_representation = CombinedRepresentation(
max_id=n_entities,
base=[embedding, features],
combination=ConcatProjectionCombination,
combination_kwargs={"output_dim": post_combination_embedding_dim},
)
# we're going to use DistMult as the interaction, so we need a relation
# representation of the same shape as the result of the combine representation
relation_representation = Embedding(max_id=n_relations, embedding_dim=post_combination_embedding_dim)
model = ERModel[FloatTensor, FloatTensor, FloatTensor](
triples_factory=triples_factory,
interaction="DistMult",
entity_representations=entity_representation,
relation_representations=relation_representation,
)