public class Slipper
extends java.lang.Object
Implementation of the classification algorithm Slipper, according to the paper [AAAI99].
Modifier and Type | Field and Description |
---|---|
static int |
A
'Accuracy'metric
|
static int |
W
'Worth' metric
|
Constructor and Description |
---|
Slipper(parseParameters parameters)
It reads the data from the input files (training, validation and test) and parse all the parameters
from the parameters array.
|
Modifier and Type | Method and Description |
---|---|
void |
execute()
It launches the algorithm.
|
static Rule |
grow(MyDataset data,
Mask grow_positives,
Mask grow_negatives,
double[] distribution)
It expands a rule, greedily adding simple rules, maximizing the following heuristic:
Z=sqrt(W+)-sqrt(W_)
W+: sum of the weights of the positive instances that are covered by the current rule
W_: sum of the weights of the negative instances that are covered by the current rule
|
static Rule |
prune(Rule rule,
MyDataset data,
Mask prune_positives,
Mask prune_negatives,
Mask grow_positives,
Mask grow_negatives,
double[] distribution)
It prunes a rule, minimizing with the heuristic:
1 - V+ + V_ + V+·exp(-Cr) + V_·exp(Cr)
V+: sum of the weights of the positive instances of the prune set that are covered by the current rule
V_: sum of the weights of the negative instances of the prune set that are covered by the current rule
Cr: rule confidence (computed in the grow set)
|
Ruleset |
slipper(MyDataset data,
Mask positives,
Mask negatives,
int T)
It implements the algorithm Slipper (2 class version).
|
Ruleset[] |
slipperMulticlass(MyDataset data)
It implements a multiclass variation of the algorithm Slipper:
1.
|
void |
update(MyDataset data,
Rule new_rule,
Mask positives,
Mask negatives,
double[] distribution,
double Cr)
It reweights the instances, making use of the confidence of the last rule.
|
public Slipper(parseParameters parameters)
parameters
- parseParameters It contains the input files, output files and parameterspublic void execute()
public static Rule grow(MyDataset data, Mask grow_positives, Mask grow_negatives, double[] distribution)
data
- MyDataset the datasetgrow_positives
- Mask active positive entriesgrow_negatives
- Mask active negative entriesdistribution
- double[] the distribution D of weightspublic static Rule prune(Rule rule, MyDataset data, Mask prune_positives, Mask prune_negatives, Mask grow_positives, Mask grow_negatives, double[] distribution)
rule
- Rule the rule to prunedata
- MyDataset the datasetprune_positives
- Mask active positive entries for pruningprune_negatives
- Mask active negative entries for pruninggrow_positives
- Mask active positive entries for growinggrow_negatives
- Mask active negative entries for growingdistribution
- double[] the distribution D of weightspublic Ruleset[] slipperMulticlass(MyDataset data)
data
- MyDataset the datasetpublic void update(MyDataset data, Rule new_rule, Mask positives, Mask negatives, double[] distribution, double Cr)
data
- the Datasetnew_rule
- the new rulepositives
- the positives intances of the dataset (with yi=1)negatives
- the negatives intances of the dataset (with yi=-1)distribution
- the distribution D of weightsCr
- the rule confidence (computed in the entire dataset)public Ruleset slipper(MyDataset data, Mask positives, Mask negatives, int T)
data
- MyDataset the datasetpositives
- Mask active positive entriesnegatives
- Mask active negative entriesT
- int number of growing rules per class