Class GeneralAdditiveModel

java.lang.Object
edu.cmu.tetrad.algcomparison.simulation.GeneralAdditiveModel
All Implemented Interfaces:
Simulation, HasParameters, TetradSerializable, Serializable

public class GeneralAdditiveModel extends Object implements Simulation
Wrapper for the neural-net Generalized Additive Model (GAM) simulator.

The underlying SEM has the form

    X_j = sum_{k in Pa(j)} f_{jk}(X_k) + e_j

where each f_{jk} is a separate random univariate MLP and e_j is additive noise drawn from the configured noise sampler.

This wrapper intentionally aligns its user-facing controls with the deep-net additive-noise simulator where possible:

In this wrapper, Params.STANDARDIZE is used only for post-processing of the final dataset, matching the behavior of other algcomparison wrappers. Parent-input standardization inside the simulator is enabled by default for numerical stability.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a GeneralAdditiveModel instance with the specified random graph.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    createData(Parameters parameters, boolean newModel)
    Creates data models and their corresponding graphs based on the provided parameters.
    getDataModel(int index)
    Retrieves the data model located at the specified index within the collection of data models.
    Returns the data type associated with this model.
    Provides a description of the Generalized Additive Model (GAM) with its associated random graph.
    int
    Retrieves the number of data models currently stored in the class.
    Retrieves a list of configuration parameters used by the model, including both parameters from the associated random graph (if applicable) and those specific to this implementation.
    Class<? extends RandomGraph>
    Retrieves the class type of the random graph associated with the model.
    Retrieves the short name associated with the General Additive Model (GAM).
    Class<? extends Simulation>
    Retrieves the class type of the simulation associated with the General Additive Model.
    getTrueGraph(int index)
    Retrieves the true graph specified by the given index from the list of graphs.

    Methods inherited from class Object

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

    • GeneralAdditiveModel

      public GeneralAdditiveModel(RandomGraph graph)
      Constructs a GeneralAdditiveModel instance with the specified random graph.
      Parameters:
      graph - The random graph to be used in the model. Must not be null.
      Throws:
      NullPointerException - if the provided graph is null.
  • Method Details

    • createData

      public void createData(Parameters parameters, boolean newModel)
      Creates data models and their corresponding graphs based on the provided parameters. This method initializes a series of data sets and graphs by repeatedly generating random graphs, modifying them, and simulating data. The number of simulations executed is determined by the number of runs specified in the parameters.

      If a seed is provided in the parameters, it will be used to initialize the random number generator, ensuring reproducibility.

      Specified by:
      createData in interface Simulation
      Parameters:
      parameters - An object that encapsulates various configuration settings for data generation, including: - Params.NUM_RUNS: The number of data models to generate. - Params.SEED: A long value specifying the random seed for reproducibility (optional).
      newModel - A boolean flag indicating whether to generate a new model. If set to true, additional operations might be performed based on the application's logic.
    • getTrueGraph

      public Graph getTrueGraph(int index)
      Retrieves the true graph specified by the given index from the list of graphs.
      Specified by:
      getTrueGraph in interface Simulation
      Parameters:
      index - The index of the graph to retrieve. Must be within the bounds of the graph list.
      Returns:
      The graph at the specified index.
      Throws:
      IndexOutOfBoundsException - if the index is out of range.
    • getNumDataModels

      public int getNumDataModels()
      Retrieves the number of data models currently stored in the class.
      Specified by:
      getNumDataModels in interface Simulation
      Returns:
      The total number of data models present, determined by the size of the internal dataSets list.
    • getDataModel

      public DataModel getDataModel(int index)
      Retrieves the data model located at the specified index within the collection of data models.
      Specified by:
      getDataModel in interface Simulation
      Parameters:
      index - The index of the data model to retrieve. Must be within the bounds of the dataSets list.
      Returns:
      The data model at the specified index.
      Throws:
      IndexOutOfBoundsException - if the index is out of range.
    • getDataType

      public DataType getDataType()
      Returns the data type associated with this model. The data type specifies whether the data set consists of continuous, discrete, mixed variables, or other possible types defined in the DataType enumeration.
      Specified by:
      getDataType in interface Simulation
      Returns:
      The DataType value, indicating that the model's data type is continuous.
    • getDescription

      public String getDescription()
      Provides a description of the Generalized Additive Model (GAM) with its associated random graph. The description includes details about the underlying random graph utilized in the model.
      Specified by:
      getDescription in interface Simulation
      Returns:
      A string containing a description of the Generalized Additive Model, including the description of the associated random graph.
    • getShortName

      public String getShortName()
      Retrieves the short name associated with the General Additive Model (GAM).
      Specified by:
      getShortName in interface Simulation
      Returns:
      A string representing the short name of the model, specifically "GAM".
    • getParameters

      public List<String> getParameters()
      Retrieves a list of configuration parameters used by the model, including both parameters from the associated random graph (if applicable) and those specific to this implementation.

      The parameters include various configuration options such as noise expression, dimensional settings, and simulation controls. If the random graph associated with the model is not an instance of SingleGraph, its parameters are also included.

      Specified by:
      getParameters in interface HasParameters
      Specified by:
      getParameters in interface Simulation
      Returns:
      A list of parameter names as String, containing both graph-specific parameters and additional parameters specific to the General Additive Model.
    • getRandomGraphClass

      public Class<? extends RandomGraph> getRandomGraphClass()
      Retrieves the class type of the random graph associated with the model.
      Specified by:
      getRandomGraphClass in interface Simulation
      Returns:
      A Class object representing the type of the random graph associated with the model, which extends RandomGraph.
    • getSimulationClass

      public Class<? extends Simulation> getSimulationClass()
      Retrieves the class type of the simulation associated with the General Additive Model.
      Specified by:
      getSimulationClass in interface Simulation
      Returns:
      A Class object representing the type of the simulation, which extends Simulation.