CausalDiscoveryResult<T>

Models & Types · AiDotNet.CausalDiscovery

Contains the results of a causal discovery analysis, including the learned graph and convergence metrics.

For Beginners

After running causal discovery, this object tells you:

  • The causal graph itself (which variables cause which others)
  • Which algorithm was used
  • How well the algorithm converged (did it find a good solution?)
  • How sparse the graph is (fewer edges = more interpretable)

How It Works

This result object is populated when ConfigureCausalDiscovery() is used on the AiModelBuilder. It contains the discovered causal graph along with algorithm-specific metrics about the optimization process.

Constructors

Constructor Summary
CausalDiscoveryResult(CausalGraph<T> graph, CausalDiscoveryAlgorithmType algorithmUsed, CausalDiscoveryCategory category, int iterations, double finalLoss, double acyclicityConstraint, bool converged, TimeSpan elapsedTime, Dictionary<string, double> additionalMetrics) Initializes a new CausalDiscoveryResult with full convergence metrics.

Properties

Property Summary
CausalDiscoveryAlgorithmType AlgorithmUsed { get; } Gets the algorithm that was used for discovery.
CausalDiscoveryCategory Category { get; } Gets the category of the algorithm used.
CausalGraph<T> Graph { get; } Gets the discovered causal graph (DAG).
Dictionary<string, double> AdditionalMetrics { get; } Gets optional additional metrics specific to the algorithm used.
TimeSpan ElapsedTime { get; } Gets the wall-clock time the algorithm took to run.
bool Converged { get; } Gets whether the algorithm converged successfully.
double AcyclicityConstraint { get; } Gets the final acyclicity constraint value h(W).
double FinalLoss { get; } Gets the final loss/objective value at convergence.
double GraphDensity { get; } Gets the graph density (fraction of possible edges present).
int EdgeCount { get; } Gets the number of edges in the discovered graph.
int Iterations { get; } Gets the number of iterations the algorithm performed.