Class ISBicScore
java.lang.Object
edu.cmu.tetrad.search.work_in_progress.ISBicScore
- All Implemented Interfaces:
- ISScore
A class representing the ISBicScore, which calculates BIC scores for a Bayesian network considering different
 structural changes and their impacts using an information-sharing mechanism.
- 
Constructor SummaryConstructorsConstructorDescriptionISBicScore(DataSet dataSet, DataSet testCase) Constructs an ISBicScore instance with the provided data sets.
- 
Method SummaryModifier and TypeMethodDescriptionbooleandetermines(List<Node> z, Node y) Determines if the given list of nodes can determine the specified node.Retrieves the data set from the current context.doubleRetrieves the current value of the k_addition parameter.doubleRetrieves the current value of the k_deletion parameter.doubleRetrieves the current value of the k_reorientation parameter.intRetrieves the maximum degree value.int[]getParentValues(int nodeIndex, int rowIndex, int[] dims) Calculates the parent values at given node and row indices based on the provided dimensions.int[]getParentValuesForCombination(int rowIndex, int[] dims) Calculates the parent values for a given row index based on the provided dimensions.doubleRetrieves the penalty discount associated with this entity.doubleCalculates and returns the sample prior value.intRetrieves the current sample size.doubleRetrieves the prior probability of the given structure.getVariable(String targetName) Retrieves a Node from the variables list that matches the specified target name.Retrieves the list of variables associated with this ISBicScore 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 considering its parents.doublelocalScore1(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Computes a local score based on the given node, its parents, and its children's populations.doublelocalScoreDiff(int x, int y, int[] z, int[] z_pop, int[] child_pop) Calculates the difference in local scores for a given variable when it is added to or removed from a set of parent variables.voidsetPenaltyDiscount(double penaltyDiscount) Sets the penalty discount.voidsetSamplePrior(double samplePrior) Sets the value of the sample prior.voidsetStructurePrior(double structurePrior) Sets the structure prior value for the current configuration.voidsetVariables(List<Node> variables) Sets the list of variables for the instance.
- 
Constructor Details- 
ISBicScoreConstructs an ISBicScore instance with the provided data sets.- Parameters:
- dataSet- The primary DataSet instance for training, must not be null.
- testCase- The test DataSet instance used for validation or testing.
- Throws:
- NullPointerException- if dataSet is null.
- IllegalArgumentException- if dataBox within dataSet is not an instance of VerticalIntDataBox.
 
 
- 
- 
Method Details- 
localScorepublic double localScore(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Calculates the local score for a given node considering its parents.- Specified by:
- localScorein interface- ISScore
- Parameters:
- node- The index of the node to calculate the score for.
- parents_is- Array of indices representing the parents of the node in the IS model.
- parents_pop- Array of indices representing the parents of the node in the POP model.
- children_pop- Array of indices representing the children of the node in the POP model.
- Returns:
- The local score for the given node.
 
- 
localScoreDiffpublic double localScoreDiff(int x, int y, int[] z, int[] z_pop, int[] child_pop) Calculates the difference in local scores for a given variable when it is added to or removed from a set of parent variables.- Specified by:
- localScoreDiffin interface- ISScore
- Parameters:
- x- The variable to be added or removed.
- y- The target variable whose score is being calculated.
- z- The set of parent variables excluding the variable x.
- z_pop- The set of population parent variables excluding the variable x.
- child_pop- The set of population children variables.
- Returns:
- The difference in local scores after adding/removing the variable x.
 
- 
getParentValuespublic int[] getParentValues(int nodeIndex, int rowIndex, int[] dims) Calculates the parent values at given node and row indices based on the provided dimensions.- Parameters:
- nodeIndex- The index of the node for which parent values are being calculated.
- rowIndex- The row index that needs to be converted to parent values.
- dims- An array representing the dimensions of the parents.
- Returns:
- An array of integers where each value corresponds to a parent value at the given row index.
 
- 
getParentValuesForCombinationpublic int[] getParentValuesForCombination(int rowIndex, int[] dims) Calculates the parent values for a given row index based on the provided dimensions.- Parameters:
- rowIndex- The row index that needs to be converted to parent values.
- dims- An array representing the dimensions of the parents.
- Returns:
- An array of integers where each value corresponds to a parent value at the given row index.
 
- 
getKAdditionpublic double getKAddition()Retrieves the current value of the k_addition parameter.- Returns:
- The value of the k_addition parameter.
 
- 
getKDeletionpublic double getKDeletion()Retrieves the current value of the k_deletion parameter.- Returns:
- The value of the k_deletion parameter.
 
- 
getKReorientationpublic double getKReorientation()Retrieves the current value of the k_reorientation parameter.- Returns:
- The value of the k_reorientation parameter.
 
- 
getVariablesRetrieves the list of variables associated with this ISBicScore instance.- Specified by:
- getVariablesin interface- ISScore
- Returns:
- a List of Node objects representing the variables.
 
- 
setVariablesSets the list of variables for the instance. All nodes in the new list must have the same names as the corresponding nodes in the existing list.- Parameters:
- variables- the new list of variables to set
- Throws:
- IllegalArgumentException- if any variable in the new list has a different name from the corresponding variable in the existing list
 
- 
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 the data set from the current context.- Specified by:
- getDataSetin interface- ISScore
- Returns:
- DataSet object containing the data.
- Throws:
- UnsupportedOperationException- if the operation is not supported.
 
- 
getStructurePriorpublic double getStructurePrior()Retrieves the prior probability of the given structure.- Specified by:
- getStructurePriorin interface- ISScore
- Returns:
- the prior probability of the structure as a double.
- Throws:
- UnsupportedOperationException- if the operation is not supported.
 
- 
setStructurePriorpublic void setStructurePrior(double structurePrior) Sets the structure prior value for the current configuration.- Specified by:
- setStructurePriorin interface- ISScore
- Parameters:
- structurePrior- the value to be set as the structure prior.
 
- 
getSamplePriorpublic double getSamplePrior()Calculates and returns the sample prior value.- Specified by:
- getSamplePriorin interface- ISScore
- Returns:
- The sample prior value as a double.
- Throws:
- UnsupportedOperationException- if the operation is not supported.
 
- 
setSamplePriorpublic void setSamplePrior(double samplePrior) Sets the value of the sample prior.- Specified by:
- setSamplePriorin interface- ISScore
- Parameters:
- samplePrior- The value to be set as the sample prior.
- Throws:
- UnsupportedOperationException- if the operation is not supported.
 
- 
getPenaltyDiscountpublic double getPenaltyDiscount()Retrieves the penalty discount associated with this entity.- Returns:
- the penalty discount as a double
 
- 
setPenaltyDiscountpublic void setPenaltyDiscount(double penaltyDiscount) Sets the penalty discount.- Parameters:
- penaltyDiscount- The discount to be applied as a penalty, represented as a decimal.
 
- 
getVariableRetrieves a Node from the variables list that matches the specified target name.- Specified by:
- getVariablein interface- ISScore
- Parameters:
- targetName- the name of the variable to search for
- Returns:
- the Node that matches the target name, or null if no match is found
 
- 
getMaxDegreepublic int getMaxDegree()Retrieves the maximum degree value.- Specified by:
- getMaxDegreein interface- ISScore
- Returns:
- the maximum degree, which is a constant value of 1000.
 
- 
determinesDetermines if the given list of nodes can determine the specified node.- Specified by:
- determinesin interface- ISScore
- Parameters:
- z- the list of nodes that are tested to determine the node y
- y- the node whose determination is being tested
- Returns:
- true if the list of nodes z can determine the node y, otherwise false
 
- 
localScore1public double localScore1(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Computes a local score based on the given node, its parents, and its children's populations.- Specified by:
- localScore1in interface- ISScore
- Parameters:
- node- an integer representing the current node for which the score is being computed
- parents_is- an array of integers representing the indices of a node's parents
- parents_pop- an array of integers representing the population of each parent
- children_pop- an array of integers representing the population of each child
- Returns:
- a double representing the computed local score
 
 
-