public class lplist
extends java.lang.Object
Constructor and Description |
---|
lplist(weka.core.Instances data,
int maxGroup,
int bins,
int[] monotone)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static int |
cardinality(int number,
int index)
Returns the cardinality for the given set (disorderly drawing without lay back)
|
static double |
classInfEntropy(double[] cutPoints,
weka.core.Instances inst)
Compute the class information entropy for the resulting partition based on the cutting points
|
static int[][] |
combinations(int number,
int index)
Returns the set of all possible combinations for the given number of attributes and max grouping size
|
static boolean |
compare(int[] attributes,
int[] arrayOne,
int[] arrayTwo,
weka.core.Instance instanceC)
Compares the two given array values to the instance w.r.t. the given attributes
|
int[] |
computeErrors(weka.core.Instances data,
int stage)
Returns the number of wrong predictions by applying the rules of the given stage on the data set provided
|
int[] |
computeErrorsExt(weka.core.Instances data)
Returns the number of wrong predictions by applying the entire lp-list on the given dataset
|
int[] |
computeNodeErrors(weka.core.Instances data,
int[] tempAttributes,
int[][] tempPreferences)
Returns the number of wrong predictions by applying the given attributes and preferences to the data
|
void |
createLPS_lookahead(weka.core.Instances data,
weka.core.Instances lhData,
int stage,
int bins,
int count,
double[] sumErrors)
Greedy algorithm for identifying and creating the lp-structure based on the given data
Lookahead feature to identify attributes to be grouped together
|
void |
createLPStructure(weka.core.Instances data,
int stage,
int bins)
Greedy algorithm for identifying and creating the lp-structure based on the given data
|
static double[] |
cutPoints(int attr,
weka.core.Instances data,
boolean boundary,
int stop)
Computes the cutting points for the given data set according to Fayyad & Irani extended to a set of pairwise preferences/instances
|
int |
decide(weka.core.Instance one,
weka.core.Instance two,
int stage)
Decides (internally) on the preference for the given instances
|
int |
decideExt(weka.core.Instance one,
weka.core.Instance two,
weka.core.Instances data)
Decides on the given instances based on the entire LP list
|
int |
decideNode(weka.core.Instance one,
weka.core.Instance two,
int[] tempAttributes,
int[][] tempPreferences)
Decides (internally) on the preference for the given instances and node
|
static weka.core.Instances |
discretize(int attr,
double[] cutPoints,
weka.core.Instances data)
Discretizes the values of attribute attr according to the given cutting points
|
static weka.core.Instance |
discretizeI(int attr,
double[] cutPoints,
weka.core.Instance inst)
Discretize the value of attribute attr according to the given cutting points within an instance
|
static double[] |
distAttrDoubleVals(weka.core.Instances data,
int attr)
Returns the distinct values (double) for the given attribute in the set of pairwise preferences
|
static int[][] |
distAttrVals(weka.core.Instances data,
int[] attr)
Returns the distinct values for the given attributes in the set of pairwise preferences
|
static double[] |
entropy(double[] cutPoints,
weka.core.Instances inst)
Compute the class entropy given the cutting points for every resulting set
|
boolean |
inBranch(int candidate,
int stage)
Checks whether the candidate attribute for labeling a node is already in branch
(one attribute may only appear once per branch)
LP-structure: Conditional local preferences/conditional AI-tree
|
static double[][] |
intervalComb(double[] points)
Compute every possible (in this context) combination of two intervals generated by a given set of points
|
static double |
lb(double x)
Returns the logarithm with base 2
|
static void |
main(java.lang.String[] args)
main with simple example for learning a LP list (r = 4, g = 3)
|
static int |
match(int[] attributes,
int[] arrayOne,
weka.core.Instance instanceC)
Compares the given array values to the given instance
|
static double |
optCuttingPoint(weka.core.Instances inst,
weka.core.Instances points,
double[] cutPoints)
Evaluate the set of possible cutting Points given and return the best one in terms of entropy (minimal) given the set of cut points
|
int[][] |
orderedAttrVals(weka.core.Instances training,
int[] attribute)
Returns the attributes' ordered labels based on the pairwise preferences (according to Copeland's method)
|
static weka.core.Instances |
potCutPoints(weka.core.Instances inst,
boolean boundary)
Returns the possible (boundary) cutting points for the given data set
|
void |
resize(int size)
Resizes the attributes, cutPoints and preferences arrays to the given value
|
static boolean |
sameVals(int[] attributes,
weka.core.Instance instanceC)
Compares the values within the pairwise preference w.r.t. to the attributes given
|
public lplist(weka.core.Instances data, int maxGroup, int bins, int[] monotone) throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- java.lang.Exception
public void createLPStructure(weka.core.Instances data, int stage, int bins) throws java.lang.Exception
data
- The data for evaluation (set of pairwise preferences)stage
- The stage where the node to be labeled is situatedbins
- The maximum amount of bins for disrectizationjava.lang.Exception
public void createLPS_lookahead(weka.core.Instances data, weka.core.Instances lhData, int stage, int bins, int count, double[] sumErrors) throws java.lang.Exception
data
- The data for evaluation (set of pairwise preferences)lhData
- The original data stored till lookahead (set of pairwise preferences)stage
- The stage where the node to be labeled is locatedbins
- The maximum amount of bins for disrectizationcount
- The number of nodes considered for groupingsumErrors
- The number of Errors in sumjava.lang.Exception
public int[] computeErrors(weka.core.Instances data, int stage)
data
- The data for evaluationstage
- The level of the attribute hierarchy based on which shall be decidedpublic int[] computeErrorsExt(weka.core.Instances data) throws java.lang.Exception
data
- The data for evaluationjava.lang.Exception
public int[] computeNodeErrors(weka.core.Instances data, int[] tempAttributes, int[][] tempPreferences)
data
- The data for evaluationnode
- The node containing the (grouped) attributespreferences
- The preferences connected with the given attributespublic int decide(weka.core.Instance one, weka.core.Instance two, int stage)
one
- The first instancetwo
- The second instance to be compared with the first onestage
- The level of the attribute importance list based on which shall be decidedpublic int decideNode(weka.core.Instance one, weka.core.Instance two, int[] tempAttributes, int[][] tempPreferences)
one
- The first instancetwo
- The second instance to be compared with the first onenode
- The node containing the (grouped) attributespreferences
- The preferences connected with the given attributespublic int decideExt(weka.core.Instance one, weka.core.Instance two, weka.core.Instances data) throws java.lang.Exception
one
- The first instancetwo
- The second instance to be compared with the first onedata
- The data for information on nominal or numeric attribute domainjava.lang.Exception
public boolean inBranch(int candidate, int stage)
candidate
- The candidate attributestage
- The stage in the treepublic static boolean compare(int[] attributes, int[] arrayOne, int[] arrayTwo, weka.core.Instance instanceC)
attributes
- The respective attributesarrayOne
- The first array to be comparedarrayTwo
- The second array to be comparedinstanceC
- The instance to be compared with the arrayspublic static boolean sameVals(int[] attributes, weka.core.Instance instanceC)
attributes
- The respective attributes to be comparedinstanceC
- The instance to be compared w.r.t. to attributespublic static int match(int[] attributes, int[] arrayOne, weka.core.Instance instanceC)
attributes
- The respective attributesarrayOne
- The first array to be comparedinstanceC
- The instance to be compared with the arrayspublic void resize(int size)
size
- The new size for the arrayspublic static int[][] combinations(int number, int index)
number
- The maximal "grouping size" (=maximal amount of attributes per set)index
- The index of the last attribute to be considered (assumption: A1, A2,... AIndex)public static int cardinality(int number, int index)
number
- The amount of "drawings"index
- The number of objects to be consideredpublic static double[] distAttrDoubleVals(weka.core.Instances data, int attr)
data
- The data for exploration (set of pairwise preferences)attr
- The attributes for explorationpublic int[][] orderedAttrVals(weka.core.Instances training, int[] attribute)
training
- The data for explorationattribute
- The given attributespublic static int[][] distAttrVals(weka.core.Instances data, int[] attr)
data
- The data for exploration (set of pairwise preferences)attr
- The attributes for explorationpublic static weka.core.Instances discretize(int attr, double[] cutPoints, weka.core.Instances data) throws java.lang.Exception
attr
- The attribute for which the values shall be discretizedcutPoints
- The cutting points for the discretizationdata
- The data to be discretized (for attribute attr) (set of pairwise instances!)java.lang.Exception
public static weka.core.Instance discretizeI(int attr, double[] cutPoints, weka.core.Instance inst) throws java.lang.Exception
attr
- The attribute for which the values shall be discretizedcutPoints
- The cutting points for the discretizationinst
- The instance to be discretized (for attribute attr)java.lang.Exception
public static double[] cutPoints(int attr, weka.core.Instances data, boolean boundary, int stop)
attr
- The attribute for considerationdata
- The set of pairwise instancesboundary
- Shall only boundary cutting be considered?stop
- The maximum number of binspublic static weka.core.Instances potCutPoints(weka.core.Instances inst, boolean boundary)
inst
- The pairwise set of attribute value to be evaluatedboundary
- Returns only boundary cutting points if truepublic static double optCuttingPoint(weka.core.Instances inst, weka.core.Instances points, double[] cutPoints)
inst
- The pairwise set of attribute values to be evaluatedpoints
- The set of possible cutting pointscutPoints
- The set of cutting points already identifiedpublic static double classInfEntropy(double[] cutPoints, weka.core.Instances inst)
cutPoints
- The cutting pointsinst
- The instancespublic static double[] entropy(double[] cutPoints, weka.core.Instances inst)
cutPoints
- The cutting pointsinst
- The instancespublic static double[][] intervalComb(double[] points)
points
- The points for the interval borderspublic static double lb(double x)
x
- The argument for the computation