Class TrainedDagSimulatorGNM.SimResult

java.lang.Object
edu.cmu.tetrad.sem.TrainedDagSimulatorGNM.SimResult
All Implemented Interfaces:
TetradSerializable, Serializable
Enclosing class:
TrainedDagSimulatorGNM

public static final class TrainedDagSimulatorGNM.SimResult extends Object implements TetradSerializable
Represents the result of a simulation, containing continuous and discrete data for variables, metadata about the simulation, and support for generating reports. This class is designed to encapsulate all relevant outputs of a simulation process including variable data, causal graphs, and warning metrics.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double[][]
    A two-dimensional array representing continuous values for all variables in a simulation result.
    final int[][]
    Discrete codes for all variables in a simulation result.
    final long
    Number of samples simulated in this result.
    final long
    Number of simulated rows in which at least one node's continuous parents exceeded zWarn1 in training z-units, i.e.
    final Graph
    Graph representing the true causal structure of the simulation.
    final List<Node>
    List of variables in the simulation result.
    final long[]
    Tracks the count of occurrences where a specific variable index exceeds a certain z-score warning threshold during simulation.
    final long[]
    Tracks the count of occurrences where a specific variable index exceeds a certain z-score warning threshold during simulation.
    final double
    Tracks the count of occurrences where a specific variable index exceeds a certain z-score warning threshold during simulation.
    final double
    Tracks the count
  • Method Summary

    Modifier and Type
    Method
    Description
    getSimReportText(double lambdaParents, boolean bootstrapRoots)
    Generates a simulation report as a string, summarizing details of the simulation and support warnings based on input parameters and internal state.
    Converts the current simulation result into a DataSet object, combining both continuous and discrete data variables.
    void
    writeSimReportTxt(File outFile, double lambdaParents, boolean bootstrapRoots)
    Writes the simulation report generated by the getSimReportText method to a specified output file in plain text format.

    Methods inherited from class Object

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

    • cont

      public final double[][] cont
      A two-dimensional array representing continuous values for all variables in a simulation result. This array includes numerical data corresponding to continuous variables, while discrete columns are also present but are considered irrelevant in this context. Each row typically corresponds to a sample, and each column corresponds to a variable.
    • disc

      public final int[][] disc
      Discrete codes for all variables in a simulation result. This array includes numerical data corresponding to discrete variables, while continuous columns are also present but are considered irrelevant in this context. Each row typically corresponds to a sample, and each column corresponds to a variable.
    • variables

      public final List<Node> variables
      List of variables in the simulation result. This field contains a list of Node objects representing the variables in the simulation. Each Node corresponds to a variable in the simulation, and the list order reflects the order of variables in the simulation result.
    • trueDag

      public final Graph trueDag
      Graph representing the true causal structure of the simulation. This field contains a Graph object representing the true causal structure of the simulation. It is used to compare against the simulated structure and assess the accuracy of the simulation.
    • nSamples

      public final long nSamples
      Number of samples simulated in this result.
    • zExceedWarn1

      public final long[] zExceedWarn1
      Tracks the count of occurrences where a specific variable index exceeds a certain z-score warning threshold during simulation. These counts are indexed by variable.

      This field is primarily used to support warnings and validations in simulation reports where z-score thresholds are monitored. The array size matches the number of variables being simulated, allowing each index to correspond to a specific variable.

      Modifications to this field are expected to occur internally within simulation processes that monitor and track z-score exceedance events.

    • zExceedWarn2

      public final long[] zExceedWarn2
      Tracks the count of occurrences where a specific variable index exceeds a certain z-score warning threshold during simulation. These counts are indexed by variable.

      This field is primarily used to support warnings and validations in simulation reports where z-score thresholds are monitored. The array size matches the number of variables being simulated, allowing each index to correspond to a specific variable.

      Modifications to this field are expected to occur internally within simulation processes that monitor and track z-score exceedance events.

    • zWarn1

      public final double zWarn1
      Tracks the count of occurrences where a specific variable index exceeds a certain z-score warning threshold during simulation. These counts are indexed by variable.

      This field is primarily used to support warnings and validations in simulation reports where z-score thresholds are monitored. The array size matches the number of variables being simulated, allowing each index to correspond to a specific variable.

      Modifications to this field are expected to occur internally within simulation processes that monitor and track z-score exceedance events.

    • zWarn2

      public final double zWarn2
      Tracks the count
    • rowsExceedWarn1

      public final long rowsExceedWarn1
      Number of simulated rows in which at least one node's continuous parents exceeded zWarn1 in training z-units, i.e. rows where some mechanism was asked to extrapolate.
  • Method Details

    • getSimReportText

      public String getSimReportText(double lambdaParents, boolean bootstrapRoots)
      Generates a simulation report as a string, summarizing details of the simulation and support warnings based on input parameters and internal state.
      Parameters:
      lambdaParents - The regularization parameter applied to parent weights.
      bootstrapRoots - A flag indicating whether roots were bootstrapped during simulation.
      Returns:
      A string containing the simulation report, including the number of samples, parameter values, and support warnings if thresholds were tracked.
    • writeSimReportTxt

      public void writeSimReportTxt(File outFile, double lambdaParents, boolean bootstrapRoots) throws IOException
      Writes the simulation report generated by the getSimReportText method to a specified output file in plain text format.
      Parameters:
      outFile - The file to which the simulation report will be written. Must not be null.
      lambdaParents - The regularization parameter applied to parent weights.
      bootstrapRoots - A flag indicating whether roots were bootstrapped during simulation.
      Throws:
      IOException - If an I/O error occurs while writing to the file.
    • toDataSet

      public DataSet toDataSet()
      Converts the current simulation result into a DataSet object, combining both continuous and discrete data variables. This method processes the stored continuous and discrete data arrays, validates their consistency with the variable list, and organizes the data in a format compatible with the MixedDataBox structure. An IllegalStateException is thrown if there are mismatches in the variables or data arrays.
      Returns:
      A DataSet object containing the combined continuous and discrete data variables, organized in row-major format.
      Throws:
      IllegalStateException - If both continuous and discrete arrays are empty, or if there are inconsistencies between the variable list and the data arrays.