Package weka.classifiers.bayes.net
Class ParentSet
- java.lang.Object
-
- weka.classifiers.bayes.net.ParentSet
-
- All Implemented Interfaces:
java.io.Serializable
,RevisionHandler
public class ParentSet extends java.lang.Object implements java.io.Serializable, RevisionHandler
Helper class for Bayes Network classifiers. Provides datastructures to represent a set of parents in a graph.- Version:
- $Revision: 6943 $
- Author:
- Remco Bouckaert (rrb@xm.co.nz)
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParent(int nParent, int iParent, Instances _Instances)
Add parent to parent set at specific location and update internals (specifically the cardinality of the parent set)void
addParent(int nParent, Instances _Instances)
Add parent to parent set and update internals (specifically the cardinality of the parent set)boolean
contains(int iNode)
test if node is contained in parent setvoid
copy(ParentSet other)
Copy makes current parents set equal to other parent setvoid
deleteLastParent(Instances _Instances)
Delete last added parent from parent set and update internals (specifically the cardinality of the parent set)int
deleteParent(int nParent, Instances _Instances)
delete node from parent setint
getCardinalityOfParents()
returns cardinality of parentsint
getFreshCardinalityOfParents(Instances _Instances)
returns cardinality of parents after recalculationint
getNrOfParents()
returns number of parentsint
getParent(int iParent)
returns index parent of parent specified by indexint[]
getParents()
java.lang.String
getRevision()
Returns the revision string.void
maxParentSetSize(int nSize)
reserve memory for parent setvoid
SetParent(int iParent, int nNode)
sets index parent of parent specified by index
-
-
-
Constructor Detail
-
ParentSet
public ParentSet()
default constructor
-
ParentSet
public ParentSet(int nMaxNrOfParents)
constructor- Parameters:
nMaxNrOfParents
- upper bound on nr of parents
-
ParentSet
public ParentSet(ParentSet other)
copy constructor- Parameters:
other
- other parent set
-
-
Method Detail
-
getParent
public int getParent(int iParent)
returns index parent of parent specified by index- Parameters:
iParent
- Index of parent- Returns:
- index of parent
-
getParents
public int[] getParents()
-
SetParent
public void SetParent(int iParent, int nNode)
sets index parent of parent specified by index- Parameters:
iParent
- Index of parentnNode
- index of the node that becomes parent
-
getNrOfParents
public int getNrOfParents()
returns number of parents- Returns:
- number of parents
-
contains
public boolean contains(int iNode)
test if node is contained in parent set- Parameters:
iNode
- node to test for- Returns:
- number of parents
-
getCardinalityOfParents
public int getCardinalityOfParents()
returns cardinality of parents- Returns:
- the cardinality
-
getFreshCardinalityOfParents
public int getFreshCardinalityOfParents(Instances _Instances)
returns cardinality of parents after recalculation- Returns:
- the cardinality
-
maxParentSetSize
public void maxParentSetSize(int nSize)
reserve memory for parent set- Parameters:
nSize
- maximum size of parent set to reserver memory for
-
addParent
public void addParent(int nParent, Instances _Instances)
Add parent to parent set and update internals (specifically the cardinality of the parent set)- Parameters:
nParent
- parent to add_Instances
- used for updating the internals
-
addParent
public void addParent(int nParent, int iParent, Instances _Instances)
Add parent to parent set at specific location and update internals (specifically the cardinality of the parent set)- Parameters:
nParent
- parent to addiParent
- location to add parent in parent set_Instances
- used for updating the internals
-
deleteParent
public int deleteParent(int nParent, Instances _Instances)
delete node from parent set- Parameters:
nParent
- node number of the parent to delete_Instances
- data set- Returns:
- location of the parent in the parent set. This information can be used to restore the parent set using the addParent method.
-
deleteLastParent
public void deleteLastParent(Instances _Instances)
Delete last added parent from parent set and update internals (specifically the cardinality of the parent set)- Parameters:
_Instances
- used for updating the internals
-
copy
public void copy(ParentSet other)
Copy makes current parents set equal to other parent set- Parameters:
other
- : parent set to make a copy from
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-
-