Class Cdnod.Builder

java.lang.Object
edu.cmu.tetrad.search.Cdnod.Builder
Enclosing class:
Cdnod

public static final class Cdnod.Builder extends Object
Builder class for creating instances of the Cdnod class with customized parameters. The Builder provides a flexible and fluent API for setting optional configurations in the resulting Cdnod instance.
  • Constructor Details

    • Builder

      public Builder()
      Constructs a new instance of the Builder class. Instantiates an object used for configuring and creating instances of Cdnod.
  • Method Details

    • test

      Sets the IndependenceTest instance to be used by the Builder.
      Parameters:
      t - The IndependenceTest instance to be set. This parameter must not be null.
      Returns:
      The current Builder instance for method chaining.
      Throws:
      NullPointerException - If the provided IndependenceTest instance is null.
    • data

      public Cdnod.Builder data(DataSet dataWithC)
      Provide a DataSet that ALREADY ends with C as the last column.
      Parameters:
      dataWithC - The DataSet instance to be set. This parameter must not be null.
      Returns:
      The current Builder instance for method chaining.
    • dataAndIndex

      public Cdnod.Builder dataAndIndex(DataSet dataX, double[] cIndex, String cName)
      Provide X and a continuous change index C to append as the last column.
      Parameters:
      dataX - The DataSet instance to be set. This parameter must not be null.
      cIndex - The continuous change index C to be appended. This parameter must not be null.
      cName - The name of the continuous change index C. This parameter must not be null.
      Returns:
      The current Builder instance for method chaining.
    • alpha

      public Cdnod.Builder alpha(double a)
      Sets the alpha value to be used by the Builder. The alpha value typically represents the significance level for statistical tests in the constructed object.
      Parameters:
      a - The alpha value to be set. This parameter must be a non-negative double.
      Returns:
      The current Builder instance for method chaining.
    • stable

      public Cdnod.Builder stable(boolean s)
      Configures whether the builder operates in a stable mode. This can affect the behavior of the resulting object to ensure stability.
      Parameters:
      s - A boolean indicating whether stability should be enabled (true) or disabled (false).
      Returns:
      The current Builder instance for method chaining.
    • colliderStyle

      Sets the Cdnod.ColliderOrientationStyle to be used by the Builder. The Cdnod.ColliderOrientationStyle determines the strategy for orienting colliders in causal discovery, such as separating sets, conservative approaches, or using maximum p-value margins.
      Parameters:
      c - The Cdnod.ColliderOrientationStyle to be set. This parameter must not be null.
      Returns:
      The current Builder instance for method chaining.
      Throws:
      NullPointerException - If the provided Cdnod.ColliderOrientationStyle is null.
    • knowledge

      public Cdnod.Builder knowledge(Knowledge k)
      Sets the Knowledge instance to be used by the Builder. If the provided Knowledge instance is null, a new instance of Knowledge is created.
      Parameters:
      k - The Knowledge instance to be set. This parameter can be null.
      Returns:
      The current Builder instance for method chaining.
    • verbose

      public Cdnod.Builder verbose(boolean v)
      Configures whether the builder operates in verbose mode. When enabled, verbose mode may produce more detailed logs, messages, or debug outputs during the building process, depending on the specific implementation of the builder or the constructed object.
      Parameters:
      v - A boolean indicating whether verbose mode should be enabled (true) or disabled (false).
      Returns:
      The current Builder instance for method chaining.
    • maxPMargin

      public Cdnod.Builder maxPMargin(double m)
      Sets the maximum p-value margin to be used by the Builder. If the provided value is negative, it is set to 0.0.
      Parameters:
      m - The maximum p-value margin to be set. This parameter must be a non-negative double.
      Returns:
      The current Builder instance for method chaining.
    • depth

      public Cdnod.Builder depth(int d)
      Sets the depth to be used by the Builder. The depth typically represents a parameter for controlling the extent or level of operations in the constructed object.
      Parameters:
      d - The depth value to be set. This parameter must be a valid integer.
      Returns:
      The current Builder instance for method chaining.
    • build

      public Cdnod build()
      Builds and returns an instance of Cdnod using the parameters specified in the Builder. The method constructs the Cdnod object based on the provided or default configurations, ensuring that all required parameters have been properly initialized.
      Returns:
      A newly constructed Cdnod instance.
      Throws:
      IllegalStateException - If the IndependenceTest is not set before invoking this method.