Skip to main content

Crate deep_causality_discovery

Crate deep_causality_discovery 

Source
Expand description

§Causal Discovery Language (CDL)

CDL hosts two discovery algorithms — SURD and BRCD — as two compile-time-isolated typestate sub-pipelines that converge on a shared analyze/finalize tail. A sub-pipeline is seeded by CdlBuilder::build_surd / CdlBuilder::build_brcd from a run config built by CdlConfigBuilder.

§Compile-time sub-pipeline isolation

Each algorithm’s stage methods exist only on its own states, so crossing the sub-pipelines does not compile. Calling a BRCD stage on a SURD state:

use deep_causality_discovery::{CDL, SurdData};
fn cross(c: CDL<SurdData<f64>>) {
    let _ = c.brcd_discover(); // error[E0599]: no method named `brcd_discover`
}

Calling a SURD analyze on a BRCD state:

use deep_causality_discovery::{CDL, BrcdLoaded};
fn cross(c: CDL<BrcdLoaded<f64>>) {
    let _ = c.surd_analyze(); // error[E0599]: no method named `surd_analyze`
}

Feature selection is unavailable to the BRCD sub-pipeline:

use deep_causality_discovery::{CDL, BrcdConfigured};
fn cross(c: CDL<BrcdConfigured<f64>>) {
    let _ = c.feature_select(); // error[E0599]: no method named `feature_select`
}

Modules§

brcd_analyze_config
brcd_loader_config
causal_discovery_config
data_csv_config
data_loader_config
data_parquet_config
data_preprocess_config
feature_selector_config
mrmr_config
surd_analyze_config
surd_config
surd_loader_config

Structs§

BrcdAnalyzeConfig
Configuration for the BRCD analysis phase of the CDL pipeline.
BrcdConfig
Configuration for a BRCD run.
BrcdConfigured
BRCD entry state, carrying the run config from CdlBuilder::build_brcd.
BrcdError
The error type returned by every fallible BRCD operation.
BrcdInput
The fully-prepared input for a BRCD discovery run.
BrcdLoaded
BRCD state after the input bundle has been loaded.
BrcdLoaderConfig
The fully-specified configuration for a BRCD CDL run.
BrcdResult
A structured result for a BRCD root-cause discovery run.
BrcdResultAnalyzer
An implementation of ProcessResultAnalyzer for BrcdResult.
BrcdResults
BRCD state after the BRCD algorithm has run.
CDL
The core builder for the Causal Discovery Language (CDL) pipeline.
CdlBuilder
Entry point for constructing and running a CDL pipeline.
CdlConfigBuilder
Entry point for the staged CDL config builders.
CdlEffect
CdlEffectWitness
A witness type that “fixes” the Error (E) and Warning Log (WLog) types for CdlEffect, implementing the HKT and HKT3 traits.
CdlReport
Aggregates all significant findings from a CDL pipeline execution.
CdlWarningLog
ConsoleFormatter
A concrete implementation of ProcessResultFormatter that formats an analysis for display in the console.
CsvConfig
Configuration for loading data from a CSV file.
CsvDataLoader
A concrete implementation of ProcessDataLoader for reading data from CSV files.
DataDiscretizer
A concrete implementation of DataPreprocessor that discretizes continuous data into bins.
MissingValueImputer
A pre-processor for handling missing numerical data in a CausalTensor.
MixedGraph
A mixed graph over num_vertices nodes with typed edge endpoints.
MrmrConfig
Configuration for the MRMR (Max-Relevance, Min-Redundancy) feature selector.
MrmrFeatureSelector
A concrete implementation of the FeatureSelector trait that uses the MRMR algorithm.
OptionNoneDataCleaner
ParquetConfig
Configuration for loading data from a Parquet file.
ParquetDataLoader
A concrete implementation of ProcessDataLoader for reading data from Parquet files.
PreprocessConfig
Configuration for a data discretization pre-processing step.
ProcessAnalysis
A wrapper struct holding the results of an analysis as a vector of strings.
ProcessFormattedResult
A wrapper struct holding the final, formatted output of the CDL pipeline.
SurdAnalyzeConfig
Configuration for the SURD analysis phase of the CDL pipeline.
SurdCausalDiscovery
A concrete implementation of the CausalDiscovery trait using the SURD algorithm.
SurdCleaned
SURD state after data has been cleaned (masked to Option<T>).
SurdConfig
Configuration for the SURD (Synergistic, Unique, Redundant Decomposition) algorithm.
SurdConfigured
SURD entry state, carrying the run config from CdlBuilder::build_surd.
SurdData
SURD state after data has been loaded.
SurdFeatures
SURD state after feature selection has been applied.
SurdLoaderConfig
The fully-specified configuration for a SURD CDL run.
SurdResultAnalyzer
An implementation of ProcessResultAnalyzer for SurdResult.
SurdResults
SURD state after the SURD algorithm has run.
WithAnalysis
State after the raw discovery result has been analyzed. Both sub-pipelines converge here, carrying the polymorphic CdlDiscoveryOutcome.

Enums§

AnalyzeError
BinningStrategy
BrcdLoadError
Failure cases for [crate::BrcdDataLoader] building a crate::BrcdInput.
CausalDiscoveryConfig
An enum representing the configuration for a specific causal discovery algorithm.
CausalDiscoveryError
CdlDiscoveryOutcome
The algorithm-specific result of a CDL discovery run.
CdlError
CdlWarning
ColumnSelector
CpdagError
Failure cases for reading or writing a CPDAG CSV file.
DataCleaningError
DataLoaderConfig
An enum representing the configuration for a specific data loader.
DataLoadingError
FamilyKind
The likelihood family BRCD scores each node with.
FeatureSelectError
FeatureSelectorConfig
An enum representing the configuration for a specific feature selection algorithm.
FinalizeError
Mark
The mark at one endpoint of an edge, in the typed-endpoint calculus shared by CPDAGs, MAGs, and PAGs.
MaxOrder
Defines the maximum order of interactions to consider in the SURD analysis.
PreprocessError

Traits§

CausalDiscovery
Defines the contract for causal discovery algorithms.
DataCleaner
DataLoader
Defines the contract for loading data from a source into a CausalTensor.
DataPreprocessor
Defines the contract for data pre-processing steps.
FeatureSelector
Defines the contract for feature selection algorithms.
Precision
Precision bound for the CDL compute pipeline.
ProcessResultAnalyzer
Defines the contract for analyzing the raw results of a causal discovery algorithm.
ProcessResultFormatter
Defines the contract for formatting an analysis into a final output string.

Functions§

brcd_run
Runs BRCD on the normal/anomalous datasets and returns the candidate root-cause sets ranked by descending posterior.
load_cpdag_csv
Reads a CPDAG CSV file from path into a unit-payload MixedGraph.
mrmr_features_selector
Selects features using the mRMR (Maximum Relevance, Minimum Redundancy) algorithm.
save_cpdag_csv
Writes graph to path as a CPDAG CSV file.
surd_states_cdl
Decomposes mutual information into its Synergistic, Unique, and Redundant components for each state of the target variable, based on the SURD-states algorithm, specifically designed to handle input tensors with Option<T> values.