Package libai.classifiers.trees
Class C45
- java.lang.Object
-
- libai.classifiers.trees.C45
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
C45.ContinuousEntropyInformation
static class
C45.DiscreteEntropyInformation
static class
C45.EntropyInformation
static class
C45.GainInformation
-
Field Summary
Fields Modifier and Type Field Description protected double
backedUpError
protected int
bad
protected Pair<Attribute,C45>[]
childs
protected double
confidence
protected double
error
protected int
good
static int
LAPLACE_PRUNE
protected Attribute
mostCommonLeaf
protected int
mostCommonLeafFreq
static int
NO_PRUNE
protected Attribute
output
static int
QUINLANS_PRUNE
protected int
samplesCount
protected java.util.HashMap<Attribute,java.lang.Integer>
samplesFreq
protected double
z
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(C45 o)
Dummy function, just needed to be able to use the Pair structure.double
error(DataSet ds)
Attribute
eval(java.util.List<Attribute> record, DataSet ds)
static C45
getInstance(java.io.File path)
static C45
getInstance(DataSet ds)
Return an unpruned tree from the given dataset.static C45
getInstancePrune(DataSet ds, double confidence)
Return a pruned tree from the given dataset using the specified confidence.static C45
getInstancePrune(DataSet ds, int type)
Return a pruned tree from the given dataset using the standard confidence of 25%boolean
isLeaf()
protected C45
load(org.w3c.dom.Node root)
Load a new C45 tree from the XML node root.void
print()
Print the tree over the standard output.C45
prune(DataSet ds, int type)
boolean
save(java.io.File path)
void
setConfidence(double c)
C45
train(DataSet ds)
-
-
-
Field Detail
-
NO_PRUNE
public static final int NO_PRUNE
- See Also:
- Constant Field Values
-
QUINLANS_PRUNE
public static final int QUINLANS_PRUNE
- See Also:
- Constant Field Values
-
LAPLACE_PRUNE
public static final int LAPLACE_PRUNE
- See Also:
- Constant Field Values
-
output
protected Attribute output
-
error
protected double error
-
backedUpError
protected double backedUpError
-
mostCommonLeaf
protected Attribute mostCommonLeaf
-
mostCommonLeafFreq
protected int mostCommonLeafFreq
-
samplesCount
protected int samplesCount
-
samplesFreq
protected java.util.HashMap<Attribute,java.lang.Integer> samplesFreq
-
confidence
protected double confidence
-
z
protected double z
-
good
protected int good
-
bad
protected int bad
-
-
Method Detail
-
getInstance
public static C45 getInstance(java.io.File path)
-
getInstance
public static C45 getInstance(DataSet ds)
Return an unpruned tree from the given dataset.- Parameters:
ds
-ds
- Returns:
- unpruned tree from the given dataset
-
getInstancePrune
public static C45 getInstancePrune(DataSet ds, int type)
Return a pruned tree from the given dataset using the standard confidence of 25%- Parameters:
ds
-ds
type
-type
- Returns:
- pruned tree from the given dataset using the standard confidence
-
getInstancePrune
public static C45 getInstancePrune(DataSet ds, double confidence)
Return a pruned tree from the given dataset using the specified confidence.- Parameters:
ds
-ds
confidence
-confidence
- Returns:
- pruned tree from the given dataset using the specified
-
isLeaf
public boolean isLeaf()
-
error
public double error(DataSet ds)
-
setConfidence
public void setConfidence(double c)
-
load
protected C45 load(org.w3c.dom.Node root)
Load a new C45 tree from the XML node root.- Parameters:
root
-root
- Returns:
- new C45 tree from the XML node root
-
save
public boolean save(java.io.File path)
-
print
public void print()
Print the tree over the standard output. Alias forprint("")
-
-