Class IsBDeuScoreWrapper

java.lang.Object
edu.cmu.tetrad.algcomparison.score.IsBDeuScoreWrapper
All Implemented Interfaces:
ScoreWrapper, HasKnowledge, HasParameters, TetradSerializable, Serializable

@Score(name="Instance-specific BDeu Score", command="is-bdeu-score", dataType=Discrete) public final class IsBDeuScoreWrapper extends Object implements ScoreWrapper, HasKnowledge
Wrapper for ISBDeuScore (discrete). Pulls testing data from Params.TESTING_DATA and row from Params.INSTANCE_ROW. Aligns by name and remaps category indices if the label orders differ.
See Also:
  • Constructor Details

    • IsBDeuScoreWrapper

      public IsBDeuScoreWrapper()
      Constructor for the `IsBDeuScoreWrapper` class. This class serves as a wrapper for the Instance-Specific BDeu (ISBDeu) scoring algorithm, which is designed for use with discrete data sets. The wrapper facilitates score calculations, description retrieval, and parameter management specific to ISBDeu scoring.
  • Method Details

    • getScore

      public Score getScore(DataModel dataModel, Parameters parameters)
      Calculates and returns a score for the given data model and associated parameters.
      Specified by:
      getScore in interface ScoreWrapper
      Parameters:
      dataModel - The data model to be scored. Must be an instance of a discrete DataSet.
      parameters - The parameters used for the score computation. Includes row index and optional hyperparameters.
      Returns:
      The calculated score instance as an IsBDeuScore.
      Throws:
      IllegalArgumentException - if the data model is not a discrete DataSet, if the testing data is not discrete, or if the row index is out of range.
    • getDescription

      public String getDescription()
      Provides a description of the Instance-Specific BDeu score, a discrete Dirichlet–multinomial posterior predictive score for the specific instance.
      Specified by:
      getDescription in interface ScoreWrapper
      Returns:
      A string describing the Instance-Specific BDeu score.
    • getDataType

      public DataType getDataType()
      Returns the data type associated with this score wrapper. The data type indicates that the score is intended for use with discrete data sets.
      Specified by:
      getDataType in interface ScoreWrapper
      Returns:
      The data type DataType.Discrete, representing compatibility with discrete data.
    • getParameters

      public List<String> getParameters()
      Retrieves a list of parameter names required by the Instance-Specific BDeu (ISBDeu) scoring algorithm. These parameters are used in the computation of the ISBDeu score for a given data model.
      Specified by:
      getParameters in interface HasParameters
      Specified by:
      getParameters in interface ScoreWrapper
      Returns:
      A list of parameter names as strings, including alpha parameter, row index, and prior equivalent sample size. Additional parameters may be provided by algorithm wrappers.
    • getVariable

      public Node getVariable(String name)
      Retrieves a variable from the model by its name.
      Specified by:
      getVariable in interface ScoreWrapper
      Parameters:
      name - The name of the variable to retrieve. This is a case-sensitive string representing the unique identifier of the variable within the model.
      Returns:
      The Node object that represents the specified variable in the model. If no variable is found with the given name, null is returned.
    • getKnowledge

      public Knowledge getKnowledge()
      Retrieves a copy of the current knowledge associated with this score wrapper. The copy ensures that the original knowledge remains unaltered by any external modifications.
      Specified by:
      getKnowledge in interface HasKnowledge
      Returns:
      A copy of the current Knowledge object.
    • setKnowledge

      public void setKnowledge(Knowledge knowledge)
      Sets the knowledge used by this score wrapper. The provided knowledge is copied to ensure that the original object remains unaltered.
      Specified by:
      setKnowledge in interface HasKnowledge
      Parameters:
      knowledge - The Knowledge object to be set. Represents constraints, rules, or prior knowledge used in the scoring process.