Package edu.cmu.tetrad.search
Class Cdnod.Builder
java.lang.Object
edu.cmu.tetrad.search.Cdnod.Builder
- Enclosing class:
Cdnod
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalpha(double a) Sets the alpha value to be used by theBuilder.build()Builds and returns an instance ofCdnodusing the parameters specified in theBuilder.Sets theCdnod.ColliderOrientationStyleto be used by theBuilder.Provide a DataSet that ALREADY ends with C as the last column.dataAndIndex(DataSet dataX, double[] cIndex, String cName) Provide X and a continuous change index C to append as the last column.depth(int d) Sets the depth to be used by theBuilder.Sets theKnowledgeinstance to be used by theBuilder.maxPMargin(double m) Sets the maximum p-value margin to be used by theBuilder.stable(boolean s) Configures whether the builder operates in a stable mode.Sets theIndependenceTestinstance to be used by theBuilder.verbose(boolean v) Configures whether the builder operates in verbose mode.
-
Constructor Details
-
Builder
public Builder()Constructs a new instance of the Builder class. Instantiates an object used for configuring and creating instances ofCdnod.
-
-
Method Details
-
test
Sets theIndependenceTestinstance to be used by theBuilder.- Parameters:
t- TheIndependenceTestinstance to be set. This parameter must not be null.- Returns:
- The current Builder instance for method chaining.
- Throws:
NullPointerException- If the providedIndependenceTestinstance is null.
-
data
Provide a DataSet that ALREADY ends with C as the last column.- Parameters:
dataWithC- TheDataSetinstance to be set. This parameter must not be null.- Returns:
- The current Builder instance for method chaining.
-
dataAndIndex
Provide X and a continuous change index C to append as the last column.- Parameters:
dataX- TheDataSetinstance 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
Sets the alpha value to be used by theBuilder. 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
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 theCdnod.ColliderOrientationStyleto be used by theBuilder. TheCdnod.ColliderOrientationStyledetermines the strategy for orienting colliders in causal discovery, such as separating sets, conservative approaches, or using maximum p-value margins.- Parameters:
c- TheCdnod.ColliderOrientationStyleto be set. This parameter must not be null.- Returns:
- The current
Builderinstance for method chaining. - Throws:
NullPointerException- If the providedCdnod.ColliderOrientationStyleis null.
-
knowledge
Sets theKnowledgeinstance to be used by theBuilder. If the providedKnowledgeinstance is null, a new instance ofKnowledgeis created.- Parameters:
k- TheKnowledgeinstance to be set. This parameter can be null.- Returns:
- The current
Builderinstance for method chaining.
-
verbose
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
Sets the maximum p-value margin to be used by theBuilder. 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
Builderinstance for method chaining.
-
depth
Sets the depth to be used by theBuilder. 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
Builderinstance for method chaining.
-
build
Builds and returns an instance ofCdnodusing the parameters specified in theBuilder. The method constructs theCdnodobject based on the provided or default configurations, ensuring that all required parameters have been properly initialized.- Returns:
- A newly constructed
Cdnodinstance. - Throws:
IllegalStateException- If theIndependenceTestis not set before invoking this method.
-