Class ISBDeuScore
java.lang.Object
edu.cmu.tetrad.search.work_in_progress.ISBDeuScore
- All Implemented Interfaces:
- ISScore
Added by Fattaneh Calculates the Instance-Specific BDeu score.
- 
Constructor SummaryConstructorsConstructorDescriptionISBDeuScore(DataSet dataSet, DataSet testCase) Initializes the ISBDeuScore with the given dataset and test case.
- 
Method SummaryModifier and TypeMethodDescriptionbooleandetermines(List<Node> z, Node y) Determines whether a given node y is determined by a list of nodes z.Retrieves a DataSet object.doubleRetrieves the value of the variable representing the k_addition.doubleRetrieves the value of the k_deletion field.doubleRetrieves the value of the k_reorient variable.intCalculates the maximum degree based on the sample size.int[]getParentValues(int nodeIndex, int rowIndex, int[] dims) Computes the parent values for a given node index and row index according to the specified dimensions.int[]getParentValuesForCombination(int rowIndex, int[] dims) Calculates the parent values for a given combination of dimensions.doubleRetrieves the prior value of the sample.intRetrieves the current sample size.doubleRetrieves the value of the structure prior.getVariable(String targetName) Retrieves a Node from the variables list that matches the specified target name.Retrieves the list of variables associated with this instance.booleanisEffectEdge(double bump) Must be called directly after the corresponding scoring call.doublelocalScore(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Calculates the local score for a given node in the context of its parent nodes and children population.doublelocalScore1(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Computes the local score for a given node considering both population and context-specific parents.doublelocalScoreDiff(int x, int y, int[] z, int[] z_pop, int[] child_pop) Computes the difference in local scores when element x is appended to the array z.voidsetKAddition(double k_addition) Sets the value of k_addition.voidsetKDeletion(double k_deletion) Sets the value of k_deletion.voidsetKReorientation(double k_reorient) Sets the value of the K-reorientation parameter.voidsetSamplePrior(double samplePrior) Sets the value for the samplePrior field.voidsetStructurePrior(double structurePrior) Sets the structure prior for the model.voidsetVariables(List<Node> variables) Sets the list of variables after validating that each variable in the provided list has the same name as the corresponding variable in the existing list.
- 
Constructor Details- 
ISBDeuScoreInitializes the ISBDeuScore with the given dataset and test case.- Parameters:
- dataSet- the dataset to be used for scoring. Must not be null.
- testCase- the test case to evaluate. Must not be null.
- Throws:
- NullPointerException- if either dataSet or testCase is null.
 
 
- 
- 
Method Details- 
localScorepublic double localScore(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Description copied from interface:ISScoreCalculates the local score for a given node in the context of its parent nodes and children population.- Specified by:
- localScorein interface- ISScore
- Parameters:
- node- The index of the node for which the score is being calculated.
- parents_is- An array representing the indices of the parent nodes.
- parents_pop- An array representing the population of the parent nodes.
- children_pop- An array representing the population of the children nodes.
- Returns:
- The local score for the specified node.
 
- 
getParentValuespublic int[] getParentValues(int nodeIndex, int rowIndex, int[] dims) Computes the parent values for a given node index and row index according to the specified dimensions.- Parameters:
- nodeIndex- The index of the node for which parent values are computed.
- rowIndex- The row index used for computations.
- dims- An array representing the dimensions of the parent values.
- Returns:
- An array of integers representing the computed parent values.
 
- 
getParentValuesForCombinationpublic int[] getParentValuesForCombination(int rowIndex, int[] dims) Calculates the parent values for a given combination of dimensions.- Parameters:
- rowIndex- the index representing the combination in a linearized form
- dims- an array indicating the size of each dimension
- Returns:
- an array of integers where each element corresponds to the value of the dimension at that index
 
- 
localScoreDiffpublic double localScoreDiff(int x, int y, int[] z, int[] z_pop, int[] child_pop) Computes the difference in local scores when element x is appended to the array z.- Specified by:
- localScoreDiffin interface- ISScore
- Parameters:
- x- the element to be appended to the array z
- y- the dependent variable whose score is being calculated
- z- the initial array of elements
- z_pop- the population related to z
- child_pop- the population related to the dependent variable y
- Returns:
- the difference in local scores after appending x to z
 
- 
getVariablesRetrieves the list of variables associated with this instance.- Specified by:
- getVariablesin interface- ISScore
- Returns:
- a list of Node objects representing the variables
 
- 
setVariablesSets the list of variables after validating that each variable in the provided list has the same name as the corresponding variable in the existing list.- Parameters:
- variables- a list of Node objects to be set as the new variables
- Throws:
- IllegalArgumentException- if any variable in the provided list does not have the same name as the variable it is replacing
 
- 
getSampleSizepublic int getSampleSize()Retrieves the current sample size.- Specified by:
- getSampleSizein interface- ISScore
- Returns:
- the sample size as an integer.
 
- 
isEffectEdgepublic boolean isEffectEdge(double bump) Must be called directly after the corresponding scoring call.- Specified by:
- isEffectEdgein interface- ISScore
- Parameters:
- bump- The threshold value to evaluate the significance of the effect on the edge.
- Returns:
- true if the edge has a significant effect; false otherwise.
 
- 
getDataSetRetrieves a DataSet object.- Specified by:
- getDataSetin interface- ISScore
- Returns:
- a DataSet object
- Throws:
- UnsupportedOperationException- if the method is not supported
 
- 
getStructurePriorpublic double getStructurePrior()Retrieves the value of the structure prior.- Specified by:
- getStructurePriorin interface- ISScore
- Returns:
- the structure prior as a double.
 
- 
setStructurePriorpublic void setStructurePrior(double structurePrior) Sets the structure prior for the model.- Specified by:
- setStructurePriorin interface- ISScore
- Parameters:
- structurePrior- the prior value to be set, typically controlling the influence of structure in the model
 
- 
getSamplePriorpublic double getSamplePrior()Retrieves the prior value of the sample.- Specified by:
- getSamplePriorin interface- ISScore
- Returns:
- the prior value of the sample as a double.
 
- 
setSamplePriorpublic void setSamplePrior(double samplePrior) Sets the value for the samplePrior field.- Specified by:
- setSamplePriorin interface- ISScore
- Parameters:
- samplePrior- The prior sample value to be set.
 
- 
getKAdditionpublic double getKAddition()Retrieves the value of the variable representing the k_addition.- Returns:
- the current value of the k_addition variable as a double.
 
- 
setKAdditionpublic void setKAddition(double k_addition) Sets the value of k_addition.- Parameters:
- k_addition- The value to set for k_addition.
 
- 
getKDeletionpublic double getKDeletion()Retrieves the value of the k_deletion field.- Returns:
- the current value of k_deletion.
 
- 
setKDeletionpublic void setKDeletion(double k_deletion) Sets the value of k_deletion.- Parameters:
- k_deletion- the new value to set for k_deletion
 
- 
getKReorientationpublic double getKReorientation()Retrieves the value of the k_reorient variable.- Returns:
- The value of k_reorient as a double.
 
- 
setKReorientationpublic void setKReorientation(double k_reorient) Sets the value of the K-reorientation parameter.- Parameters:
- k_reorient- the new value for the K-reorientation parameter
 
- 
getVariableRetrieves a Node from the variables list that matches the specified target name.- Specified by:
- getVariablein interface- ISScore
- Parameters:
- targetName- the name of the target Node to be retrieved
- Returns:
- the Node that matches the target name, or null if no match is found
 
- 
getMaxDegreepublic int getMaxDegree()Calculates the maximum degree based on the sample size.- Specified by:
- getMaxDegreein interface- ISScore
- Returns:
- the maximum degree as an integer.
 
- 
determinesDetermines whether a given node y is determined by a list of nodes z.- Specified by:
- determinesin interface- ISScore
- Parameters:
- z- the list of nodes to be evaluated
- y- the node to be checked
- Returns:
- true if y is determined by the list of nodes z, false otherwise
 
- 
localScore1public double localScore1(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Computes the local score for a given node considering both population and context-specific parents.This function is used to score a node in a dag without using structure prior - Specified by:
- localScore1in interface- ISScore
- Parameters:
- node- The index of the node for which the score is being calculated.
- parents_is- Array representing the indices of the context-specific parents.
- parents_pop- Array representing the indices of the population-based parents.
- children_pop- Array representing the indices of the population-based children.
- Returns:
- The computed local score for the specified node.
 
 
-