public class Classification
extends java.lang.Object
Constructor and Description |
---|
Classification(Classification toMerge)
Function to create a new classification with only one value by merging all ç
values of given classification.
|
Classification(Dataset source)
Function to create a new classification with only one value.
|
Classification(Dataset source,
Cut model)
Function to create a new classification with the given dataset.
|
Classification(int numValues,
int numClasses)
Function to create and initialize a new classification.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int valueIndex,
Itemset itemset)
Function to add the given itemset to given the value.
|
void |
addRange(int valueIndex,
Dataset source,
int start,
int end)
Function to add all itemsets in given range to given value.
|
void |
addWeights(Itemset itemset,
double[] weights)
Funtion to add the given itemset to all values weighting it according to given weights.
|
void |
addWithUnknownValue(Dataset source,
int attIndex)
Function to add all itemsets with unknown values for given attribute.
|
boolean |
check(double minItemsets)
Function to check if at least two values contain a minimum number of itemsets.
|
double |
getTotal()
Returns total weight of itemsets.
|
int |
maxClass()
Returns class with highest frequency over all values.
|
int |
maxClass(int index)
Returns class with highest frequency for given value.
|
int |
maxValue()
Returns index of value containing maximum number of itemsets.
|
int |
numClasses()
Returns number of classes.
|
double |
numCorrect()
Returns the weight of all itemsets of the class with highest frequency.
|
double |
numCorrect(int index)
Returns the number of correctly classified itemsets for the given value.
|
double |
numIncorrect()
Returns number of incorrectly classified examples
|
double |
numIncorrect(int index)
Returns the number of incorrectly classified itemsets for the given value.
|
int |
numValues()
Returns number of values.
|
double |
perClass(int classIndex)
Returns number of itemsets of given class.
|
double |
perClassPerValue(int valueIndex,
int classIndex)
Returns number of itemsets of given class in given value.
|
double |
perValue(int valueIndex)
Returns number of (possibly fractional) itemsets in given value.
|
double |
probability(int classIndex)
Returns relative frequency of class over all values.
|
double |
probability(int classIndex,
int attIndex)
Returns relative frequency of class for given value.
|
void |
shiftRange(int from,
int to,
Dataset source,
int start,
int end)
Function to shift all itemsets in given range from one value to another.
|
public Classification(int numValues, int numClasses)
numValues
- Number of values used to make the classification.numClasses
- Number of classes used to make the classification.public Classification(Dataset source) throws java.lang.Exception
source
- The dataset.java.lang.Exception
- If cannot read the dataset.public Classification(Dataset source, Cut model) throws java.lang.Exception
source
- The dataset.model
- The model selected to make the classification.java.lang.Exception
- If cannot build the classification.public Classification(Classification toMerge)
toMerge
- The original classification to merge.public final void add(int valueIndex, Itemset itemset)
valueIndex
- The index of the value.itemset
- The itemset to add.public final void addWithUnknownValue(Dataset source, int attIndex)
source
- The dataset that contains all the itemsets.attIndex
- The index of the attribute with possible unknown values.public final void addRange(int valueIndex, Dataset source, int start, int end)
valueIndex
- The index of the value.source
- The itemset to add.start
- The index of the first itemset to add.end
- The index of the first itemset that will not be added.public final void addWeights(Itemset itemset, double[] weights)
itemset
- The itemset to add.weights
- The weights of the itemset for every value.public final boolean check(double minItemsets)
minItemsets
- The minimum number of itemsets.public final int maxValue()
public final int maxClass()
public final int maxClass(int index)
index
- The index of the value.public final int numValues()
public final int numClasses()
public final double numCorrect()
public final double numIncorrect()
public final double numIncorrect(int index)
index
- The index of the value.public final double numCorrect(int index)
index
- The index of the value.public final double getTotal()
public final double perClassPerValue(int valueIndex, int classIndex)
valueIndex
- The index of the value.classIndex
- The index of the class.public final double perValue(int valueIndex)
valueIndex
- The index of the value.public final double perClass(int classIndex)
classIndex
- The index of the class.public final double probability(int classIndex)
classIndex
- The index of the class.public final double probability(int classIndex, int attIndex)
classIndex
- The index of the class.attIndex
- The index of the attribute.public final void shiftRange(int from, int to, Dataset source, int start, int end)
from
- The minimum value.to
- The maximum value.source
- The dataset.start
- The index of the first itemset to add.end
- The index of the first itemset that will not be added.