Class UnmixSpec

java.lang.Object
edu.cmu.tetrad.data.UnmixSpec
All Implemented Interfaces:
Serializable

public final class UnmixSpec extends Object implements Serializable
Minimal, UI-friendly spec for the unmixer. No search/PC/BOSS classes referenced here; we keep it decoupled and translate elsewhere.
Author:
josephramsey
See Also:
  • Constructor Details

    • UnmixSpec

      public UnmixSpec()
      Constructor for the UnmixSpec class. This constructor initializes an instance of the UnmixSpec class.
  • Method Details

    • isLogIntermediate

      public boolean isLogIntermediate()
      Determines if intermediate logging is enabled.
      Returns:
      true if intermediate logging is enabled, false otherwise
    • setLogIntermediate

      public void setLogIntermediate(boolean logIntermediate)
      Sets the logging state for intermediate steps in a process.
      Parameters:
      logIntermediate - a boolean indicating whether intermediate steps should be logged (true) or not (false)
    • isAutoSelectK

      public boolean isAutoSelectK()
      Retrieves the current value of K.
      Returns:
      the value of K.
    • setAutoSelectK

      public UnmixSpec setAutoSelectK(boolean v)
      Sets whether to enable or disable the automatic selection of the best value of K.
      Parameters:
      v - a boolean value indicating whether to enable (true) or disable (false) the automatic selection of K.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getK

      public int getK()
      Retrieves the current value of K.
      Returns:
      the value of K.
    • setK

      public UnmixSpec setK(int k)
      Sets the value of K for the current instance of UnmixSpec. K must be greater than or equal to 1.
      Parameters:
      k - the value to set for K; must be a positive integer >= 1.
      Returns:
      the current instance of UnmixSpec for method chaining.
      Throws:
      IllegalArgumentException - if the provided k is less than 1.
    • getKmin

      public int getKmin()
      Retrieves the minimum allowed value of K.
      Returns:
      the minimum value of K (Kmin).
    • setKmin

      public UnmixSpec setKmin(int kmin)
      Sets the minimum allowed value of K. Ensures that the value of Kmin is at least 1.
      Parameters:
      kmin - the proposed minimum value for K; must be an integer.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getKmax

      public int getKmax()
      Retrieves the maximum allowed value of K (Kmax).
      Returns:
      the maximum value of K (Kmax).
    • setKmax

      public UnmixSpec setKmax(int kmax)
      Sets the maximum allowed value of K (Kmax) for the current instance of UnmixSpec. Ensures that the value of Kmax is at least 1.
      Parameters:
      kmax - the proposed maximum value for K; must be an integer.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getGraphLearner

      public UnmixSpec.GraphLearner getGraphLearner()
      Retrieves the graph learning method currently set for this instance.
      Returns:
      the currently configured GraphLearner, which determines the method used for graph learning (e.g., BOSS or PC_MAX).
    • setGraphLearner

      public UnmixSpec setGraphLearner(UnmixSpec.GraphLearner g)
      Sets the graph learning method for this instance of UnmixSpec. The provided GraphLearner determines the algorithm to be used for graph learning (e.g., BOSS or PC_MAX).
      Parameters:
      g - the GraphLearner to set; must be a valid enumeration value.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getPcAlpha

      public double getPcAlpha()
      Retrieves the alpha value used in the PC algorithm for statistical testing.
      Returns:
      the alpha value for the PC algorithm, which is typically used as a threshold for significance in tests.
    • setPcAlpha

      public UnmixSpec setPcAlpha(double a)
      Sets the alpha value for the PC algorithm. This value is typically used as a significance threshold in statistical testing within the PC algorithm.
      Parameters:
      a - the alpha value to set for the PC algorithm; must be a non-negative double representing the significance level.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getPcColliderStyle

      public UnmixSpec.ColliderStyle getPcColliderStyle()
      Retrieves the collider style used in the PC algorithm for handling colliders during causal discovery. The collider style determines the specific method or approach used to identify colliders in the causal graph.
      Returns:
      the configured UnmixSpec.ColliderStyle for the PC algorithm, which may be one of SEPSETS, CONSERVATIVE, or MAX_P.
    • setPcColliderStyle

      public UnmixSpec setPcColliderStyle(UnmixSpec.ColliderStyle s)
      Sets the collider style to be used in the PC algorithm for identifying colliders during causal graph discovery. The collider style determines the approach applied for handling colliders (e.g., SEPSETS, CONSERVATIVE, or MAX_P).
      Parameters:
      s - the UnmixSpec.ColliderStyle to set; must be a valid enumeration value.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getBossPenaltyDiscount

      public double getBossPenaltyDiscount()
      Retrieves the BOSS penalty discount value. The BOSS penalty discount is used as a parameter in graph learning algorithms to adjust or scale penalties during the learning process.
      Returns:
      the current BOSS penalty discount value as a double.
    • setBossPenaltyDiscount

      public UnmixSpec setBossPenaltyDiscount(double d)
      Sets the BOSS penalty discount value for this instance of UnmixSpec. The BOSS penalty discount is a parameter used in graph learning algorithms to adjust or scale penalties during the learning process.
      Parameters:
      d - the BOSS penalty discount value to set; must be a double.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • isUseParentSuperset

      public boolean isUseParentSuperset()
      Indicates whether the parent superset feature is enabled or disabled.
      Returns:
      true if the parent superset feature is enabled; false otherwise.
    • setUseParentSuperset

      public UnmixSpec setUseParentSuperset(boolean v)
      Sets the parent superset feature to enabled or disabled.
      Parameters:
      v - true to enable the parent superset feature; false to disable.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getSupersetTopM

      public int getSupersetTopM()
      Retrieves the top M value for the parent superset feature.
      Returns:
      the top M value for the parent superset feature.
    • setSupersetTopM

      public UnmixSpec setSupersetTopM(int m)
      Sets the top M value for the parent superset feature.
      Parameters:
      m - the top M value to set; must be greater than or equal to 1.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getSupersetScore

      public UnmixSpec.SupersetScore getSupersetScore()
      Retrieves the score used for parent superset feature.
      Returns:
      the score used for parent superset feature.
    • setSupersetScore

      public UnmixSpec setSupersetScore(UnmixSpec.SupersetScore s)
      Sets the score used for parent superset feature.
      Parameters:
      s - the score to set; must not be null.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • isRobustScaleResiduals

      public boolean isRobustScaleResiduals()
      Indicates whether robust scaling of residuals is enabled.
      Returns:
      true if robust scaling of residuals is enabled; false otherwise.
    • setRobustScaleResiduals

      public UnmixSpec setRobustScaleResiduals(boolean v)
      Sets whether robust scaling of residuals is enabled.
      Parameters:
      v - true to enable robust scaling of residuals; false to disable.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getCovarianceMode

      public UnmixSpec.CovarianceMode getCovarianceMode()
      Retrieves the covariance mode.
      Returns:
      the covariance mode.
    • setCovarianceMode

      public UnmixSpec setCovarianceMode(UnmixSpec.CovarianceMode m)
      Sets the covariance mode.
      Parameters:
      m - the covariance mode to set; must not be null.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getFullSigmaSafetyMargin

      public int getFullSigmaSafetyMargin()
      Retrieves the full sigma safety margin.
      Returns:
      the full sigma safety margin.
    • setFullSigmaSafetyMargin

      public UnmixSpec setFullSigmaSafetyMargin(int m)
      Sets the full sigma safety margin.
      Parameters:
      m - the full sigma safety margin to set; must be non-negative.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getKmeansRestarts

      public int getKmeansRestarts()
      Retrieves the number of k-means restarts.
      Returns:
      the number of k-means restarts.
    • setKmeansRestarts

      public UnmixSpec setKmeansRestarts(int r)
      Sets the number of k-means restarts.
      Parameters:
      r - the number of k-means restarts to set; must be positive.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getEmMaxIters

      public int getEmMaxIters()
      Retrieves the maximum number of iterations for the EM algorithm.
      Returns:
      the maximum number of iterations for the EM algorithm.
    • setEmMaxIters

      public UnmixSpec setEmMaxIters(int it)
      Sets the maximum number of iterations for the EM algorithm.
      Parameters:
      it - the maximum number of iterations to set; must be positive.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getRidge

      public double getRidge()
      Retrieves the ridge parameter.
      Returns:
      the ridge parameter.
    • setRidge

      public UnmixSpec setRidge(double r)
      Sets the ridge parameter.
      Parameters:
      r - the ridge parameter to set; must be non-negative.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getShrinkage

      public double getShrinkage()
      Retrieves the shrinkage parameter.
      Returns:
      the shrinkage parameter.
    • setShrinkage

      public UnmixSpec setShrinkage(double s)
      Sets the shrinkage parameter.
      Parameters:
      s - the shrinkage parameter to set; must be between 0 and 1 inclusive.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getAnnealSteps

      public int getAnnealSteps()
      Retrieves the number of annealing steps.
      Returns:
      the number of annealing steps.
    • setAnnealSteps

      public UnmixSpec setAnnealSteps(int s)
      Sets the number of annealing steps.
      Parameters:
      s - the number of annealing steps to set; must be non-negative.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • getAnnealStartT

      public double getAnnealStartT()
      Retrieves the starting temperature for annealing.
      Returns:
      the starting temperature for annealing.
    • setAnnealStartT

      public UnmixSpec setAnnealStartT(double t)
      Sets the starting temperature for annealing.
      Parameters:
      t - the starting temperature to set; must be non-negative.
      Returns:
      the current instance of UnmixSpec for method chaining.
    • isSaveDiagnostics

      public boolean isSaveDiagnostics()
      Retrieves whether to save diagnostics.
      Returns:
      true if diagnostics are saved, false otherwise.
    • setSaveDiagnostics

      public UnmixSpec setSaveDiagnostics(boolean v)
      Sets whether to save diagnostics.
      Parameters:
      v - true to save diagnostics, false otherwise.
      Returns:
      the current instance of UnmixSpec for method chaining.