Class ISBDeuScore
java.lang.Object
edu.cmu.tetrad.search.work_in_progress.ISBDeuScore
-
Constructor Summary
ConstructorsConstructorDescriptionISBDeuScore
(DataSet dataSet, DataSet testCase) Initializes the ISBDeuScore with the given dataset and test case. -
Method Summary
Modifier and TypeMethodDescriptionboolean
determines
(List<Node> z, Node y) Determines whether a given node y is determined by a list of nodes z.Retrieves a DataSet object.double
Retrieves the value of the variable representing the k_addition.double
Retrieves the value of the k_deletion field.double
Retrieves the value of the k_reorient variable.int
Calculates 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.double
Retrieves the prior value of the sample.int
Retrieves the current sample size.double
Retrieves 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.boolean
isEffectEdge
(double bump) Must be called directly after the corresponding scoring call.double
localScore
(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.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.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.void
setKAddition
(double k_addition) Sets the value of k_addition.void
setKDeletion
(double k_deletion) Sets the value of k_deletion.void
setKReorientation
(double k_reorient) Sets the value of the K-reorientation parameter.void
setSamplePrior
(double samplePrior) Sets the value for the samplePrior field.void
setStructurePrior
(double structurePrior) Sets the structure prior for the model.void
setVariables
(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
-
ISBDeuScore
Initializes 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
-
localScore
public double localScore(int node, int[] parents_is, int[] parents_pop, int[] children_pop) Description copied from interface:ISScore
Calculates the local score for a given node in the context of its parent nodes and children population.- Specified by:
localScore
in interfaceISScore
- 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.
-
getParentValues
public 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.
-
getParentValuesForCombination
public 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 formdims
- 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
-
localScoreDiff
public 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:
localScoreDiff
in interfaceISScore
- Parameters:
x
- the element to be appended to the array zy
- the dependent variable whose score is being calculatedz
- the initial array of elementsz_pop
- the population related to zchild_pop
- the population related to the dependent variable y- Returns:
- the difference in local scores after appending x to z
-
getVariables
Retrieves the list of variables associated with this instance.- Specified by:
getVariables
in interfaceISScore
- Returns:
- a list of Node objects representing the variables
-
setVariables
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.- 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
-
getSampleSize
public int getSampleSize()Retrieves the current sample size.- Specified by:
getSampleSize
in interfaceISScore
- Returns:
- the sample size as an integer.
-
isEffectEdge
public boolean isEffectEdge(double bump) Must be called directly after the corresponding scoring call.- Specified by:
isEffectEdge
in interfaceISScore
- 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.
-
getDataSet
Retrieves a DataSet object.- Specified by:
getDataSet
in interfaceISScore
- Returns:
- a DataSet object
- Throws:
UnsupportedOperationException
- if the method is not supported
-
getStructurePrior
public double getStructurePrior()Retrieves the value of the structure prior.- Specified by:
getStructurePrior
in interfaceISScore
- Returns:
- the structure prior as a double.
-
setStructurePrior
public void setStructurePrior(double structurePrior) Sets the structure prior for the model.- Specified by:
setStructurePrior
in interfaceISScore
- Parameters:
structurePrior
- the prior value to be set, typically controlling the influence of structure in the model
-
getSamplePrior
public double getSamplePrior()Retrieves the prior value of the sample.- Specified by:
getSamplePrior
in interfaceISScore
- Returns:
- the prior value of the sample as a double.
-
setSamplePrior
public void setSamplePrior(double samplePrior) Sets the value for the samplePrior field.- Specified by:
setSamplePrior
in interfaceISScore
- Parameters:
samplePrior
- The prior sample value to be set.
-
getKAddition
public double getKAddition()Retrieves the value of the variable representing the k_addition.- Returns:
- the current value of the k_addition variable as a double.
-
setKAddition
public void setKAddition(double k_addition) Sets the value of k_addition.- Parameters:
k_addition
- The value to set for k_addition.
-
getKDeletion
public double getKDeletion()Retrieves the value of the k_deletion field.- Returns:
- the current value of k_deletion.
-
setKDeletion
public void setKDeletion(double k_deletion) Sets the value of k_deletion.- Parameters:
k_deletion
- the new value to set for k_deletion
-
getKReorientation
public double getKReorientation()Retrieves the value of the k_reorient variable.- Returns:
- The value of k_reorient as a double.
-
setKReorientation
public void setKReorientation(double k_reorient) Sets the value of the K-reorientation parameter.- Parameters:
k_reorient
- the new value for the K-reorientation parameter
-
getVariable
Retrieves a Node from the variables list that matches the specified target name.- Specified by:
getVariable
in interfaceISScore
- 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
-
getMaxDegree
public int getMaxDegree()Calculates the maximum degree based on the sample size.- Specified by:
getMaxDegree
in interfaceISScore
- Returns:
- the maximum degree as an integer.
-
determines
Determines whether a given node y is determined by a list of nodes z.- Specified by:
determines
in interfaceISScore
- Parameters:
z
- the list of nodes to be evaluatedy
- the node to be checked- Returns:
- true if y is determined by the list of nodes z, false otherwise
-
localScore1
public 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:
localScore1
in interfaceISScore
- 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.
-