Class SemOptimizerRicf

java.lang.Object
edu.cmu.tetrad.sem.SemOptimizerRicf
All Implemented Interfaces:
SemOptimizer, TetradSerializable, Serializable

public class SemOptimizerRicf extends Object implements SemOptimizer
Optimizes a SEM using RICF for ADMGs (no selection bias).
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for the SemOptimizerRicf class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of restarts used by the optimizer.
    void
    optimize(SemIm semIm)
    Optimizes the given structural equation model by utilizing the RICF (Regression Iterative Conditional Fitting) algorithm based on the EJML library, tailored for models with ADMG (Acyclic Directed Mixed Graphs) and no selection bias.
    Creates and returns a new instance of the SemOptimizerRicf class that is serializable.
    void
    setMaxIters(int maxIters)
    Sets the maximum number of iterations for the optimizer.
    void
    setNumRestarts(int numRestarts)
    Sets the number of restarts for the optimizer.
    void
    setTolerance(double tolerance)
    Sets the tolerance level for the optimizer.
    Returns a string representation of the SemOptimizerRicf instance, providing information about the algorithm and underlying libraries.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SemOptimizerRicf

      public SemOptimizerRicf()
      Default constructor for the SemOptimizerRicf class. This class implements a structural equation model (SEM) optimizer using the Regression Iterative Conditional Fitting (RICF) algorithm. The optimizer is specifically designed for models with Acyclic Directed Mixed Graphs (ADMGs) and is built on the EJML library. The constructor initializes a new instance with default configurations. The optimizer allows customization, including setting the number of restarts, tolerance, and maximum iterations.
  • Method Details

    • serializableInstance

      public static SemOptimizerRicf serializableInstance()
      Creates and returns a new instance of the SemOptimizerRicf class that is serializable. This method is typically used for serialization purposes to provide a consistent and accessible way to instantiate the class.
      Returns:
      a new serializable instance of the SemOptimizerRicf class.
    • optimize

      public void optimize(SemIm semIm)
      Optimizes the given structural equation model by utilizing the RICF (Regression Iterative Conditional Fitting) algorithm based on the EJML library, tailored for models with ADMG (Acyclic Directed Mixed Graphs) and no selection bias. The method updates the SEM parameters such as edge coefficients, error variances, and error covariances based on the input specification.
      Specified by:
      optimize in interface SemOptimizer
      Parameters:
      semIm - the structural equation model (SEM) instance to be optimized. It must contain the sample covariance matrix and a defined SEM parameterization. The method checks for missing values in the covariance matrix, and an exception is thrown if such values are found. The number of restarts for the optimizer must be explicitly set to 1 before this method is called. Results are logged after the RICF optimization is complete.
    • getNumRestarts

      public int getNumRestarts()
      Returns the number of restarts used by the optimizer.
      Specified by:
      getNumRestarts in interface SemOptimizer
      Returns:
      the number of restarts currently set for the optimizer.
    • setNumRestarts

      public void setNumRestarts(int numRestarts)
      Sets the number of restarts for the optimizer. The number of restarts determines how many times the optimization process is repeated to potentially improve results.
      Specified by:
      setNumRestarts in interface SemOptimizer
      Parameters:
      numRestarts - the number of restarts to set for the optimizer. Must be a non-negative integer.
    • setTolerance

      public void setTolerance(double tolerance)
      Sets the tolerance level for the optimizer. The tolerance is typically used as a convergence criterion to determine when the optimization process should stop. A smaller value allows for more precise optimization but may increase computation time.
      Parameters:
      tolerance - the tolerance value to set. Must be a non-negative double.
    • setMaxIters

      public void setMaxIters(int maxIters)
      Sets the maximum number of iterations for the optimizer. The maximum iteration limit is used to manage the computational effort and prevent the optimization process from running excessively long if convergence is not achieved within the specified limit.
      Parameters:
      maxIters - the maximum number of iterations to allow, specified as a positive integer.
    • toString

      public String toString()
      Returns a string representation of the SemOptimizerRicf instance, providing information about the algorithm and underlying libraries.
      Overrides:
      toString in class Object
      Returns:
      a string describing the SemOptimizerRicf as "Sem Optimizer RICF (EJML, ADMG)".