Package edu.cmu.tetrad.search.score
Class IsBDeuScore
java.lang.Object
edu.cmu.tetrad.search.score.IsBDeuScore
- All Implemented Interfaces:
- Score
Instance-Specific BDeu score (discrete), following the Dirichlet–multinomial posterior predictive for the chosen
 instance (Fattaneh's construction).
 
Local score: IS-local(i | Pa) = BDeu-local(i | Pa) + alpha * log P_instance
where the instance term is: log P_instance = log( (N_ijk + ESS/(r_i q)) / (N_ij + ESS/q) ) - i: child index - Pa: parents' indices - j: parent configuration index of the instance row - k: categorical value of X_i in the instance row - r_i: number of categories for X_i - q: number of distinct parent configurations (product of parent arities) - N_ijk, N_ij: counts from the training data (ignoring rows with missing in i or Pa)
Missing values: if the instance row has missing for i or any parent, the instance term is 0.
Assumes the instance DataSet is a single row, already aligned to the training schema (same variable names and category label sets).
- 
Constructor SummaryConstructorsConstructorDescriptionIsBDeuScore(DataSet train, DataSet instanceOneRow) Constructs an IsBDeuScore object that validates and initializes a training dataset and a single-instance dataset for Bayesian scoring.
- 
Method SummaryModifier and TypeMethodDescriptiondoubleRetrieves the value of the isAlpha field.doubleRetrieves the prior equivalent sample size used for Bayesian scoring.intRetrieves the sample size of the data by delegating to the underlying base implementation.Retrieves the list of variables (nodes) associated with the model or scoring process.doublelocalScore(int i) Computes the local score for a given node in the graph, incorporating both the base score and an instance-specific term weighted by the isAlpha parameter.doublelocalScore(int i, int[] parents) Computes the local score for a given node and its parents by combining the base local score and an instance-specific term influenced by the isAlpha parameter.voidsetIsAlpha(double isAlpha) Sets the value of the isAlpha field.voidsetPriorEquivalentSampleSize(double ess) Sets the prior equivalent sample size to be used for Bayesian scoring.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.score.Scoreappend, determines, getMaxDegree, getVariable, isEffectEdge, localScore, localScoreDiff, localScoreDiff, toString
- 
Constructor Details- 
IsBDeuScoreConstructs an IsBDeuScore object that validates and initializes a training dataset and a single-instance dataset for Bayesian scoring. The training and instance datasets must be discrete and share the same schema, including variable names and categories.- Parameters:
- train- the training dataset, which must be discrete and contain the variables for scoring. It must have the same schema as the instance dataset.
- instanceOneRow- the single-instance dataset with exactly one row, which must be discrete. Its schema (variable names and categories) must align with the training dataset.
- Throws:
- NullPointerException- if the training dataset or instance dataset is null.
- IllegalArgumentException- if the training dataset is not discrete, if the instance dataset is not discrete or does not have exactly one row, if the number of columns in the training dataset and the instance dataset differ, or if variable names and categories in the datasets do not align.
 
 
- 
- 
Method Details- 
getIsAlphapublic double getIsAlpha()Retrieves the value of the isAlpha field.- Returns:
- the current value of the isAlpha field as a double.
 
- 
setIsAlphapublic void setIsAlpha(double isAlpha) Sets the value of the isAlpha field.- Parameters:
- isAlpha- the new value to be assigned to the isAlpha field.
 
- 
getPriorEquivalentSampleSizepublic double getPriorEquivalentSampleSize()Retrieves the prior equivalent sample size used for Bayesian scoring. This value represents an effective sample size proxy that influences the score computation.- Returns:
- the prior equivalent sample size as a double.
 
- 
setPriorEquivalentSampleSizepublic void setPriorEquivalentSampleSize(double ess) Sets the prior equivalent sample size to be used for Bayesian scoring. This value serves as an effective sample size proxy that influences the computations within the scoring process.- Parameters:
- ess- the prior equivalent sample size to be set, typically a positive double value. It controls the relative strength of the prior in Bayesian score calculations.
 
- 
getVariablesRetrieves the list of variables (nodes) associated with the model or scoring process.- Specified by:
- getVariablesin interface- Score
- Returns:
- a list of Nodeobjects representing the variables, as obtained from the underlying base implementation.
 
- 
getSampleSizepublic int getSampleSize()Retrieves the sample size of the data by delegating to the underlying base implementation.- Specified by:
- getSampleSizein interface- Score
- Returns:
- the sample size of the data as an integer.
 
- 
localScorepublic double localScore(int i) Computes the local score for a given node in the graph, incorporating both the base score and an instance-specific term weighted by the isAlpha parameter.- Specified by:
- localScorein interface- Score
- Parameters:
- i- the index of the node for which the local score is computed.
- Returns:
- the computed local score, which combines the base score and the instance-specific contribution.
 
- 
localScorepublic double localScore(int i, int[] parents) Computes the local score for a given node and its parents by combining the base local score and an instance-specific term influenced by the isAlpha parameter.- Specified by:
- localScorein interface- Score
- Parameters:
- i- the index of the node for which the local score is being computed.
- parents- an array of node indices representing the parents of the node.
- Returns:
- the local score calculated as the sum of the base score and the instance-specific term weighted by the isAlpha parameter.
 
 
-