Skip to main content

coreason-inference

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coreason_inference-0.3.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coreason_inference-0.3.0-py3-none-any.whl (41.9 kB view details)

Uploaded Python 3

File details

Details for the file coreason_inference-0.3.0.tar.gz.

File metadata

  • Download URL: coreason_inference-0.3.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for coreason_inference-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4014988d208f9a09d4b944e6d6e189181b9081dd9123831832802b5b708ea3e0
MD5 9889d38c31cbbf65ee3d808073911406
BLAKE2b-256 9995f2cb537f342bfb9ed09a3da94e630b471d312e5e9d2c0533e19a298d3e1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_inference-0.3.0.tar.gz:

Publisher: publish.yml on CoReason-AI/coreason-inference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file coreason_inference-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coreason_inference-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e939fc9fe92e0cd9e8d88c955d949e7d23bbc210237ca26d373bc546f3ece74e
MD5 2d6adad047604c38388327328416fbbb
BLAKE2b-256 deea3692b3a3c88dfc5b35305821c33aa5f83fe856c18d2d46d972feb1ab30c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_inference-0.3.0-py3-none-any.whl:

Publisher: publish.yml on CoReason-AI/coreason-inference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page