Class InstanceAugmentedSemBicScore

java.lang.Object
edu.cmu.tetrad.search.score.InstanceAugmentedSemBicScore
All Implemented Interfaces:
InstanceSpecificScore, Score

public final class InstanceAugmentedSemBicScore extends Object implements InstanceSpecificScore
Instance-augmented SEM-BIC score for continuous data.

Local score: IS-local(i | Pa) = Pop-local(i | Pa) + alpha * logN(x_i | b^T x_Pa, s2)

where b = Sigma_{Pa,Pa}^{-1} Sigma_{Pa,i} and s2 = Sigma_{ii} - Sigma_{i,Pa} Sigma_{Pa,Pa}^{-1} Sigma_{Pa,i}.

Supports either: - centered instance row x (use 2-arg ctor), or - raw instance row + population means (use 3-arg ctor), in which case the instance is centered internally using those means.

  • Constructor Details

    • InstanceAugmentedSemBicScore

      public InstanceAugmentedSemBicScore(SemBicScore base, double[] instanceRowCentered)
      Constructs an `InstanceAugmentedSemBicScore` object using a base `SemBicScore` and a centered row of instance data. This constructor initializes the object with the covariance matrix derived from the base score and the provided centered instance row.
      Parameters:
      base - The base `SemBicScore` object providing the covariance matrix and variables. Must not be null.
      instanceRowCentered - A fully centered data row representing the instance to be augmented. Its length must match the number of variables in the base `SemBicScore`.
    • InstanceAugmentedSemBicScore

      public InstanceAugmentedSemBicScore(ICovarianceMatrix cov, double[] instanceRowCentered)
      Constructs an `InstanceAugmentedSemBicScore` object using a covariance matrix and a fully centered row of instance data. This constructor initializes the object with the provided covariance matrix and instance row.
      Parameters:
      cov - The covariance matrix used for computation. Must not be null.
      instanceRowCentered - A fully centered data row representing the instance to be augmented. Its length must match the number of variables in the covariance matrix.
    • InstanceAugmentedSemBicScore

      public InstanceAugmentedSemBicScore(SemBicScore base, double[] instanceRowRaw, double[] populationMeans)
      Constructs an `InstanceAugmentedSemBicScore` object using a base `SemBicScore`, a raw row of instance data, and the population mean values. This constructor initializes the object with the covariance matrix from the base score and a centered representation of the provided instance data.
      Parameters:
      base - The base `SemBicScore` object providing the covariance matrix and variables. Must not be null.
      instanceRowRaw - An array representing the raw data row of the instance to be augmented. Its length must match the number of variables in the base `SemBicScore`.
      populationMeans - An array representing the population means for each variable. Its length must match the number of variables in the base `SemBicScore`.
    • InstanceAugmentedSemBicScore

      public InstanceAugmentedSemBicScore(ICovarianceMatrix cov, double[] instanceRowRaw, double[] populationMeans)
      Constructs an `InstanceAugmentedSemBicScore` object using a covariance matrix, a raw row of instance data, and the population mean values. This constructor initializes the object with the provided covariance matrix, computes a centered representation of the instance data, and prepares the score for further use.
      Parameters:
      cov - The covariance matrix used for computation. Must not be null.
      instanceRowRaw - An array representing the raw data row of the instance to be augmented. Its length must match the number of variables in the covariance matrix.
      populationMeans - An array representing the population means for each variable. Its length must match the number of variables in the covariance matrix.
  • Method Details

    • getAlpha

      public double getAlpha()
      Retrieves the alpha value associated with this score.
      Specified by:
      getAlpha in interface InstanceSpecificScore
      Returns:
      the alpha parameter as a double value.
    • setAlpha

      public void setAlpha(double alpha)
      Sets the alpha value for this instance. The alpha value typically represents a parameter that may influence the scoring or computations within this object.
      Specified by:
      setAlpha in interface InstanceSpecificScore
      Parameters:
      alpha - The alpha parameter to set, provided as a double.
    • setVarianceFloor

      public void setVarianceFloor(double varFloor)
      Sets the variance floor for this instance. The variance floor is used as a lower limit to variance values to prevent computational issues during calculations.
      Parameters:
      varFloor - The minimum allowable variance value. Must be greater than 0. If a value less than or equal to 0 is provided, an IllegalArgumentException is thrown.
    • getVariables

      public List<Node> getVariables()
      Retrieves the list of variables associated with the current instance score.
      Specified by:
      getVariables in interface Score
      Returns:
      a list of Node objects representing the variables.
    • getSampleSize

      public int getSampleSize()
      Retrieves the sample size associated with the base `SemBicScore`.
      Specified by:
      getSampleSize in interface Score
      Returns:
      the sample size as an integer.
    • getPenaltyDiscount

      public double getPenaltyDiscount()
      Retrieves the multiplier applied to the penalty term for this score.
      Returns:
      The penalty discount as a double value.
    • setPenaltyDiscount

      public void setPenaltyDiscount(double d)
      Sets the multiplier for the penalty term in this score. Adjusts the impact of the penalty term on the computed score.
      Parameters:
      d - The penalty discount factor to apply. This value influences the weight of the penalty term in the score calculation.
    • localScore

      public double localScore(int i)
      Calculates the local score for a given variable index. This method incorporates both the base local score and an instance-specific term scaled by a parameter alpha to compute the final score.
      Specified by:
      localScore in interface Score
      Parameters:
      i - The index of the variable for which the local score is to be computed.
      Returns:
      The computed local score as a double value.
    • localScore

      public double localScore(int i, int[] parents)
      Calculates the local score for a given variable index and its parent set. This method integrates the base local score with an instance-specific term scaled by a parameter alpha to compute the final score.
      Specified by:
      localScore in interface Score
      Parameters:
      i - The index of the variable for which the local score is to be computed.
      parents - An array of indices representing the parent variables of the specified variable.
      Returns:
      The computed local score as a double value.
    • getBase

      public SemBicScore getBase()
      Retrieves the base SemBicScore associated with this instance.
      Returns:
      the base SemBicScore object used for computations.
    • getInstanceRowCentered

      public double[] getInstanceRowCentered()
      Returns a copy of the centered instance row data associated with this instance. The centered data represents the difference between the raw data and the respective population means for each variable.
      Returns:
      a copy of the centered instance row as a double array.