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.2.0.tar.gz (33.8 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.2.0-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_inference-0.2.0.tar.gz
  • Upload date:
  • Size: 33.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 dedca08ad1c70304e075df8205e53dc920a2c24a2280cdf0a673f3652100bc35
MD5 b027045827dea7c1351a6242a2d1f747
BLAKE2b-256 0d3352e30e2a610f04ac695fae3d58f1c5329da719446c82697ab9fa1396443b

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_inference-0.2.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coreason_inference-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22be6bf4e7cc488a047eb9e0c786a60d2df18829eea322b03b8e2fdc7710ac37
MD5 8704aa7ca3355905327cc811402b8e96
BLAKE2b-256 eb9d327919db7eae0f4b4d8b6306731ec825daaad61d934805118060618b0358

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_inference-0.2.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