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.1.0.tar.gz (31.4 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.1.0-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_inference-0.1.0.tar.gz
  • Upload date:
  • Size: 31.4 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.1.0.tar.gz
Algorithm Hash digest
SHA256 33f1263ab56c9a5c9f17e7629edc46d97cc49da65967ee6be828b07a84e2f2d9
MD5 9238dcbed8968cfa5e98167444653853
BLAKE2b-256 89a8a7f03b3935e1456fdc8e4ff29d454a0fb1ff90439af508d72b6fca1c2efa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for coreason_inference-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 804627fb00a39719bcf9e8144fd28a94e690ad7717c9c37d69c52a3632e8bc51
MD5 2423ac7d59a8e63ae7a6c0046fc66c0b
BLAKE2b-256 a82b936d94191192d3e0e41ac6a4b9bed24b66aec896bccfa1bd9496e30dc1c1

See more details on using hashes here.

Provenance

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