Skip to main content

coreason-inference

Causal Discovery, Representation Learning, Active Experimentation, & Trial Optimization

License Build Status Ruff Documentation

coreason-inference is the Causal Intelligence engine of the CoReason ecosystem. Unlike probabilistic models that predict correlation, this engine is designed to uncover Mechanism and Heterogeneity. It serves as the "Principal Investigator," discovering biological feedback loops, identifying latent confounders, and optimizing clinical trials through causal stratification and virtual simulation.

Features

  • Cyclic Discovery (Dynamics Engine): Uses Neural ODEs to discover feedback loops and system dynamics in biological systems (Directed Cyclic Graphs).
  • Latent Phenotyping (Latent Miner): Disentangles hidden confounders using Causal VAEs to identify unmeasured variables driving outcomes.
  • Heterogeneous Stratification (Causal Estimator): Estimates Individual Treatment Effects (CATE) using Causal Forests to identify Super-Responders.
  • Active Experimentation (Active Scientist): Proposes physical experiments (e.g., Gene Knockouts) to resolve causal ambiguity using Information Gain heuristics.
  • Protocol Optimization (Rule Inductor): Translates CATE scores into human-readable clinical protocol rules to maximize Phase 3 Probability of Success (PoS).
  • Virtual Trials (Virtual Simulator): Simulates Phase 3 trials in-silico using synthetic "Digital Twins" to predict efficacy and scan for safety risks.

Installation

pip install coreason-inference

Usage

Here is a quick example of how to initialize and use the InferenceEngine:

import pandas as pd
from coreason_inference.engine import InferenceEngine

# 1. Initialize the Engine
engine = InferenceEngine()

# 2. Load your data
# Data should contain time-series or observational data
data = pd.read_csv("patient_data.csv")
variable_cols = ["Glucose", "Insulin", "HbA1c"]
time_col = "Time"

# 3. Analyze: Discover Dynamics & Latents
result = engine.analyze(
    data=data,
    time_col=time_col,
    variable_cols=variable_cols,
    estimate_effect_for=("Insulin", "Glucose")
)

# 4. Inspect the Causal Graph
print(f"Discovered Graph Edges: {result.graph.edges}")
print(f"Detected Loops: {result.graph.loop_dynamics}")

# 5. Optimize for Heterogeneity (Identify Super-Responders)
# Estimate CATE for a specific treatment
engine.analyze_heterogeneity(
    treatment="Insulin",
    outcome="Glucose",
    confounders=["Age", "BMI"] + list(result.latents.columns)
)

# Induce rules to find the best subgroup
optimization_output = engine.induce_rules()

print("Recommended Protocol Criteria:")
for rule in optimization_output.new_criteria:
    print(f" - {rule.feature} {rule.operator} {rule.value} ({rule.rationale})")

print(f"Projected Probability of Success: {optimization_output.optimized_pos:.2f}")

Documentation

For detailed requirements and architectural philosophy, please refer to the Product Requirements Document.

Metadata

Release files for coreason-inference 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coreason-inference 0.3.0
File Size Uploaded
coreason_inference-0.3.0.tar.gz 34.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coreason-inference 0.3.0
File Interpreter ABI Platform
coreason_inference-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 76.1 kB

Release files / coreason_inference-0.3.0.tar.gz

Download URL coreason_inference-0.3.0.tar.gz
Size 34.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4014988d208f9a09d4b944e6d6e189181b9081dd9123831832802b5b708ea3e0
BLAKE2b-256 checksum
How to use checksums
9995f2cb537f342bfb9ed09a3da94e630b471d312e5e9d2c0533e19a298d3e1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release files / coreason_inference-0.3.0-py3-none-any.whl

Download URL coreason_inference-0.3.0-py3-none-any.whl
Size 41.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e939fc9fe92e0cd9e8d88c955d949e7d23bbc210237ca26d373bc546f3ece74e
BLAKE2b-256 checksum
How to use checksums
deea3692b3a3c88dfc5b35305821c33aa5f83fe856c18d2d46d972feb1ab30c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page