|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjncc20.NaiveClassifier
jncc20.NaiveCredalClassifier
class NaiveCredalClassifier
Implementation of the Naive Credal Classifier (NCC).
Nested Class Summary | |
---|---|
private static class |
NaiveCredalClassifier.PartitionPoint
Helper class for NaiveCredal Classifier, used to store crossing points and minimizing tuples; it is used when missing data in the NonMar part of the testing instances. |
Nested classes/interfaces inherited from class jncc20.NaiveClassifier |
---|
NaiveClassifier.Feature, NaiveClassifier.OutputClass |
Field Summary | |
---|---|
private int[][] |
credalPredictedInstances
Stores NCC predictions; as every prediction can be imprecise and hence contain several value, it is implemented as a matrix. |
private int |
k
Number of NonMar features in training |
private java.util.ArrayList<java.lang.Integer> |
nonMarTestingIdx
Indexes of nonMarFeature in testing |
private java.util.ArrayList<java.lang.Integer> |
nonMarTrainingIdx
Indexes of nonMarFeature in training |
private java.util.ArrayList<java.lang.Integer> |
numClassesNonMarTesting
Number of classes of each NonMar variable in Testing |
private java.util.ArrayList<NaiveCredalClassifier.PartitionPoint> |
partitionPoints
Partition Points, used when classyfing instances with missing units in the NonMar part. |
Fields inherited from class jncc20.NaiveClassifier |
---|
featureSet, outputClasses, s |
Constructor Summary | |
---|---|
NaiveCredalClassifier(java.util.ArrayList<int[]> TrainingSet,
java.util.ArrayList<java.lang.String> FeatureNames,
java.util.ArrayList<java.lang.String> ClassNames,
java.util.ArrayList<java.lang.Integer> NumClassForEachFeature,
java.util.ArrayList<java.lang.Integer> SuppliedNonMarInTraining,
java.util.ArrayList<java.lang.Integer> SuppliedNonMarInTesting,
java.util.ArrayList<java.lang.Integer> SuppliedNumClassesNonMarTesting)
Builds feature and output class, and computes the relevant counts for MAR and NON-MAR features |
Method Summary | |
---|---|
private double |
checkCredalDominanceCIR(int c1,
int c2,
int[] currentInstance,
double xmin,
double xmax)
Computes the CIR test of dominance between class c1 and c2 (if the returned value is >1, c1 dominates c2) |
private int[] |
classifyInstance(int[] CurrentInstance)
Classifies a single instance, returning the list of predicted classes |
(package private) void |
classifyInstances(java.util.ArrayList<int[]> TestingSet)
Classify all the instances of the supplied TestingSet; stores the predictions into CredalPredictedInstances |
private double |
computeDeriv2LnHxCIR(int alpha,
int beta,
java.util.ArrayList<java.lang.Integer> betaArr,
java.util.ArrayList<java.lang.Integer> gammaArr,
java.util.ArrayList<java.lang.Integer> deltaArr,
java.util.ArrayList<java.lang.Integer> gammaTildeArr,
java.util.ArrayList<java.lang.Integer> deltaTildeArr,
double x)
Computes the second derivative of Ln(Hx) (see Corani and Zaffalon, 2007) |
private double |
computeDerivLnHxCIR(int alpha,
int beta,
java.util.ArrayList<java.lang.Integer> alphaArr,
java.util.ArrayList<java.lang.Integer> betaArr,
java.util.ArrayList<java.lang.Integer> gammaArr,
java.util.ArrayList<java.lang.Integer> deltaArr,
java.util.ArrayList<java.lang.Integer> gammaTildeArr,
java.util.ArrayList<java.lang.Integer> deltaTildeArr,
double x)
Computes the derivative of Ln(Hx) (see Corani and Zaffalon, 2007) |
private double |
computeHxCIR(int alpha,
int beta,
java.util.ArrayList<java.lang.Integer> alphaArr,
java.util.ArrayList<java.lang.Integer> betaArr,
java.util.ArrayList<java.lang.Integer> gammaArr,
java.util.ArrayList<java.lang.Integer> deltaArr,
java.util.ArrayList<java.lang.Integer> gammaTildeArr,
java.util.ArrayList<java.lang.Integer> deltaTildeArr,
double x)
Computes Hx for a given value of x, alpha, beta ecc. |
private int |
findMinimizingValue(int FeatureIdx,
int NumValues,
int c1,
int c2,
double xmin,
double xmax)
Given a sub-partion (xmin,xmax) of[0,s], returns the value of feature FeatureIdx, which minimizes the ratio (lowercount(feature,c1)/(uppercount(feature,c2)+x)) in the interval. |
private boolean |
findPartitionPoints(int c1,
int c2,
java.util.ArrayList<java.lang.Integer> MissingNonMarIdx)
If there are missing data in the NonMar part of the units to be classified, this function identifies the intervals in which the range [0,s] has to be sub-partitioned. |
private double |
findZeroCIR(double x1,
double x2,
int alpha,
int beta,
java.util.ArrayList<java.lang.Integer> alphaArr,
java.util.ArrayList<java.lang.Integer> betaArr,
java.util.ArrayList<java.lang.Integer> gammaArr,
java.util.ArrayList<java.lang.Integer> deltaArr,
java.util.ArrayList<java.lang.Integer> gammaTildeArr,
java.util.ArrayList<java.lang.Integer> deltaTildeArr)
Numerical approximation of the min of Ln(Hx) via Newton-Raphson method. |
(package private) int[][] |
getCredalPredictedInstances()
Returns the matrix of the predictions |
(package private) int[] |
getCredalPredictedInstances(int idx)
Returns the vector, which contains the prediction for instance in position idx |
(package private) void |
instancesAndPredictionsToFileUnknownClasses(java.lang.String suppliedWorkingPath,
java.lang.String suppliedArffTestingFile,
java.util.ArrayList<java.lang.String[]> RawTestingSet)
Write to file the instances and the classifications returned by the NCC; when the actual classes are unknown, this constitutes the only output of the classifier. |
Methods inherited from class jncc20.NaiveClassifier |
---|
buildFeatureSet, buildOutputClasses, getOutputClasses |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int[][] credalPredictedInstances
private int k
private java.util.ArrayList<java.lang.Integer> nonMarTestingIdx
private java.util.ArrayList<java.lang.Integer> nonMarTrainingIdx
private java.util.ArrayList<java.lang.Integer> numClassesNonMarTesting
private java.util.ArrayList<NaiveCredalClassifier.PartitionPoint> partitionPoints
Constructor Detail |
---|
NaiveCredalClassifier(java.util.ArrayList<int[]> TrainingSet, java.util.ArrayList<java.lang.String> FeatureNames, java.util.ArrayList<java.lang.String> ClassNames, java.util.ArrayList<java.lang.Integer> NumClassForEachFeature, java.util.ArrayList<java.lang.Integer> SuppliedNonMarInTraining, java.util.ArrayList<java.lang.Integer> SuppliedNonMarInTesting, java.util.ArrayList<java.lang.Integer> SuppliedNumClassesNonMarTesting)
Method Detail |
---|
private double checkCredalDominanceCIR(int c1, int c2, int[] currentInstance, double xmin, double xmax)
private int[] classifyInstance(int[] CurrentInstance)
void classifyInstances(java.util.ArrayList<int[]> TestingSet)
private double computeDeriv2LnHxCIR(int alpha, int beta, java.util.ArrayList<java.lang.Integer> betaArr, java.util.ArrayList<java.lang.Integer> gammaArr, java.util.ArrayList<java.lang.Integer> deltaArr, java.util.ArrayList<java.lang.Integer> gammaTildeArr, java.util.ArrayList<java.lang.Integer> deltaTildeArr, double x)
private double computeDerivLnHxCIR(int alpha, int beta, java.util.ArrayList<java.lang.Integer> alphaArr, java.util.ArrayList<java.lang.Integer> betaArr, java.util.ArrayList<java.lang.Integer> gammaArr, java.util.ArrayList<java.lang.Integer> deltaArr, java.util.ArrayList<java.lang.Integer> gammaTildeArr, java.util.ArrayList<java.lang.Integer> deltaTildeArr, double x)
private double computeHxCIR(int alpha, int beta, java.util.ArrayList<java.lang.Integer> alphaArr, java.util.ArrayList<java.lang.Integer> betaArr, java.util.ArrayList<java.lang.Integer> gammaArr, java.util.ArrayList<java.lang.Integer> deltaArr, java.util.ArrayList<java.lang.Integer> gammaTildeArr, java.util.ArrayList<java.lang.Integer> deltaTildeArr, double x)
private int findMinimizingValue(int FeatureIdx, int NumValues, int c1, int c2, double xmin, double xmax)
private boolean findPartitionPoints(int c1, int c2, java.util.ArrayList<java.lang.Integer> MissingNonMarIdx)
private double findZeroCIR(double x1, double x2, int alpha, int beta, java.util.ArrayList<java.lang.Integer> alphaArr, java.util.ArrayList<java.lang.Integer> betaArr, java.util.ArrayList<java.lang.Integer> gammaArr, java.util.ArrayList<java.lang.Integer> deltaArr, java.util.ArrayList<java.lang.Integer> gammaTildeArr, java.util.ArrayList<java.lang.Integer> deltaTildeArr)
int[][] getCredalPredictedInstances()
int[] getCredalPredictedInstances(int idx)
void instancesAndPredictionsToFileUnknownClasses(java.lang.String suppliedWorkingPath, java.lang.String suppliedArffTestingFile, java.util.ArrayList<java.lang.String[]> RawTestingSet)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |