jncc20
Class NaiveClassifier.Feature

java.lang.Object
  extended by jncc20.NaiveClassifier.Feature
Enclosing class:
NaiveClassifier

protected class NaiveClassifier.Feature
extends java.lang.Object

Helper class for Naive Classifiers, that implements Mar and NonMar features. Features are characterized by the bivariate counts of their effective occurrences (Frequencies), by the number of missing data for each output class (Missing) and by the logarithm of conditioned probabilities (LogProbability)


Field Summary
private  double[][] conditionalFreq
          Counts that correspond to counts-after-dropping-missing for MarFeatures, bivariate count: frequency are computed for each output class and for each class of the feature.
private  double[][] logProbability
          Logarithm of conditioned probabilities: Log(P(ai|c))
private  int[] missing
          How many times the feature is missing, for every output class.
private  java.lang.String name
          Name
private  double[] uncondFrequencies
          Simple uncondFrequencies, not conditioned.
 
Constructor Summary
NaiveClassifier.Feature(java.lang.String SuppliedName, double[][] SuppliedFrequencies, int[] SuppliedMissing)
          Constructor that copies the name and the conditionalFreq table, and computes the log-probabilities table
 
Method Summary
(package private)  double getClassCountAsMar(int ClassIdx)
           
 double[] getCondFrequencies(int ClassIdx)
           
 double[][] getConditionalFreq()
           
(package private)  double getConditionalFrequencies(int ClassIdx, int FeatureClassIdx)
           
(package private)  double[][] getLogProbability()
           
(package private)  double[] getLogProbability(int ClassIdx)
           
(package private)  double getLogProbability(int ClassIdx, int FeatureValue)
           
(package private)  int[] getMissing()
           
(package private)  int getMissing(int OutputClass)
           
(package private)  java.lang.String getName()
           
 double[] getUncondFrequencies()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conditionalFreq

private final double[][] conditionalFreq
Counts that correspond to counts-after-dropping-missing for MarFeatures, bivariate count: frequency are computed for each output class and for each class of the feature. They are double to manage possible partial units due to the prior. The rows refer to the different output classes, and the columns to the different feature classes.


logProbability

private final double[][] logProbability
Logarithm of conditioned probabilities: Log(P(ai|c))


missing

private final int[] missing
How many times the feature is missing, for every output class.


name

private final java.lang.String name
Name


uncondFrequencies

private final double[] uncondFrequencies
Simple uncondFrequencies, not conditioned. Useful to computed Bma

Constructor Detail

NaiveClassifier.Feature

NaiveClassifier.Feature(java.lang.String SuppliedName,
                        double[][] SuppliedFrequencies,
                        int[] SuppliedMissing)
Constructor that copies the name and the conditionalFreq table, and computes the log-probabilities table

Method Detail

getClassCountAsMar

double getClassCountAsMar(int ClassIdx)
Returns:
Returns the conditionalFreq for a specified class, computed as counts of those records where the class is the one required and the value of the given MAR feature is not missing

getCondFrequencies

public double[] getCondFrequencies(int ClassIdx)
Returns:
Returns the conditionalFreq for a specified class

getConditionalFreq

public double[][] getConditionalFreq()
Returns:
Returns the conditionalFreq.

getConditionalFrequencies

double getConditionalFrequencies(int ClassIdx,
                                 int FeatureClassIdx)
Returns:
Returns the conditionalFreq for a specified class, and for a specified class (range of values) defined within the feature domain

getLogProbability

double[][] getLogProbability()
Returns:
Returns the whole log of cond probability table

getLogProbability

double[] getLogProbability(int ClassIdx)
Returns:
Returns the log of cond probabilities for a specified class

getLogProbability

double getLogProbability(int ClassIdx,
                         int FeatureValue)
Returns:
Returns the log of cond probabilities for a specified class and for a specific value of the feature

getMissing

int[] getMissing()
Returns:
Returns the missing.

getMissing

int getMissing(int OutputClass)
Returns:
Returns the number of missing data for a given output class

getName

java.lang.String getName()
Returns:
Returns the name.

getUncondFrequencies

public double[] getUncondFrequencies()
Returns:
Returns the conditionalFreq for a specified class