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).
93 lines
2.8 KiB
Python
93 lines
2.8 KiB
Python
"""Test for sLCWA and LCWA."""
|
|
|
|
from pykeen.losses import CrossEntropyLoss, MarginRankingLoss, NSSALoss, SoftplusLoss
|
|
from pykeen.sampling.filtering import BloomFilterer, PythonSetFilterer
|
|
from pykeen.training import LCWATrainingLoop, SLCWATrainingLoop, SymmetricLCWATrainingLoop
|
|
from tests.test_training import cases
|
|
|
|
|
|
class MRUnfilteredSLCWATrainingLoopTestCase(cases.SLCWATrainingLoopTestCase):
|
|
"""Test sLCWA with unfiltered negative sampling with margin ranking loss."""
|
|
|
|
cls = SLCWATrainingLoop
|
|
filterer_cls = None
|
|
loss_cls = MarginRankingLoss
|
|
|
|
|
|
class NSSAUnfilteredSLCWATrainingLoopTestCase(cases.SLCWATrainingLoopTestCase):
|
|
"""Test sLCWA with unfiltered negative sampling with NSSA loss."""
|
|
|
|
cls = SLCWATrainingLoop
|
|
filterer_cls = None
|
|
loss_cls = NSSALoss
|
|
|
|
|
|
class SoftplusUnfilteredSLCWATrainingLoopTestCase(cases.SLCWATrainingLoopTestCase):
|
|
"""Test sLCWA with unfiltered negative sampling with softplus loss."""
|
|
|
|
cls = SLCWATrainingLoop
|
|
filterer_cls = None
|
|
loss_cls = SoftplusLoss
|
|
|
|
|
|
class MRSetFilteredSLCWATrainingLoopTestCase(cases.SLCWATrainingLoopTestCase):
|
|
"""Test sLCWA with set filtered negative sampling with margin ranking loss."""
|
|
|
|
cls = SLCWATrainingLoop
|
|
filterer_cls = PythonSetFilterer
|
|
loss_cls = MarginRankingLoss
|
|
|
|
|
|
class NSSASetFilteredSLCWATrainingLoopTestCase(cases.SLCWATrainingLoopTestCase):
|
|
"""Test sLCWA with set filtered negative sampling with NSSA loss."""
|
|
|
|
cls = SLCWATrainingLoop
|
|
filterer_cls = PythonSetFilterer
|
|
loss_cls = NSSALoss
|
|
|
|
|
|
class SoftplusSetFilteredSLCWATrainingLoopTestCase(cases.SLCWATrainingLoopTestCase):
|
|
"""Test sLCWA with set filtered negative sampling with softplus loss."""
|
|
|
|
cls = SLCWATrainingLoop
|
|
filterer_cls = PythonSetFilterer
|
|
loss_cls = SoftplusLoss
|
|
|
|
|
|
# Multiple permutations of loss not necessary for bloom filter since it's more of a
|
|
# filter vs. no filter thing.
|
|
class BloomFilteredSLCWATrainingLoopTestCase(cases.SLCWATrainingLoopTestCase):
|
|
"""Test sLCWA with bloom filtered negative sampling."""
|
|
|
|
cls = SLCWATrainingLoop
|
|
filterer_cls = BloomFilterer
|
|
loss_cls = MarginRankingLoss
|
|
|
|
|
|
class MRLossLCWATrainingLoopTestCase(cases.TrainingLoopTestCase):
|
|
"""Test LCWA with margin ranking loss."""
|
|
|
|
cls = LCWATrainingLoop
|
|
loss_cls = MarginRankingLoss
|
|
|
|
|
|
class NSSALossLCWATrainingLoopTestCase(cases.TrainingLoopTestCase):
|
|
"""Test LCWA with NSSA loss."""
|
|
|
|
cls = LCWATrainingLoop
|
|
loss_cls = NSSALoss
|
|
|
|
|
|
class SoftPlusLCWATrainingLoopTestCase(cases.TrainingLoopTestCase):
|
|
"""Test LCWA with softplus loss."""
|
|
|
|
cls = LCWATrainingLoop
|
|
loss_cls = SoftplusLoss
|
|
|
|
|
|
class SymmetricLCWATrainingLoopTestCase(cases.TrainingLoopTestCase):
|
|
"""Test for symmetric LCWA with cross-entropy."""
|
|
|
|
cls = SymmetricLCWATrainingLoop
|
|
loss_cls = CrossEntropyLoss
|