feature_filtering
Class DiscretizationFilterCreation

java.lang.Object
  extended by feature_filtering.DiscretizationFilterCreation

public class DiscretizationFilterCreation
extends java.lang.Object

This class is used for learning a discretization filter using Weka's Discretize class that supports both equal width and equal frequency binning. In our paper we use only equal width binning.

Author:
Eleftherios Spyromitros-Xioufis

Nested Class Summary
static class DiscretizationFilterCreation.discretizationTypes
          The supported discretization types.
 
Field Summary
private  DiscretizationFilterCreation.discretizationTypes descretizationType
          The desired discretization type.
private  weka.filters.unsupervised.attribute.Discretize discretizationFilter
          The learned discretization filter.
private  int numBins
          The desired number of bins.
 
Constructor Summary
DiscretizationFilterCreation(DiscretizationFilterCreation.discretizationTypes discretizationType, int numBins)
          Constructor with 2 arguments, the discretization type and the number of bins.
 
Method Summary
 void createAndWriteFilter(java.lang.String learningArffFileName, java.lang.String normalizationType, boolean writeDiscretizedInstances, boolean writeSerializedInstancesObject)
          This methods creates and serializes a discretization filter from the given arff file.
static void main(java.lang.String[] args)
          This method uses the DiscretizationFilterCreation class to learn a discretization filter from an arff formatted dataset file containing real-valued features (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

discretizationFilter

private weka.filters.unsupervised.attribute.Discretize discretizationFilter
The learned discretization filter.


descretizationType

private DiscretizationFilterCreation.discretizationTypes descretizationType
The desired discretization type.


numBins

private int numBins
The desired number of bins.

Constructor Detail

DiscretizationFilterCreation

public DiscretizationFilterCreation(DiscretizationFilterCreation.discretizationTypes discretizationType,
                                    int numBins)
Constructor with 2 arguments, the discretization type and the number of bins.

Parameters:
discretizationType -
numBins -
Method Detail

createAndWriteFilter

public void createAndWriteFilter(java.lang.String learningArffFileName,
                                 java.lang.String normalizationType,
                                 boolean writeDiscretizedInstances,
                                 boolean writeSerializedInstancesObject)
                          throws java.lang.Exception
This methods creates and serializes a discretization filter from the given arff file. The selected type of normalization is applied in the given vectors before creating the filter. The resulting filter can then by used by a feature filtering methods that requires discrete feature values like entropy-based filtering.

Parameters:
learningArffFileName - Full path to the arff file that will be used for learning the discretization filter.
normalizationType - The type of normalization to apply on the local features prior to discretization (no/l2/power+l2).
writeDiscretizedInstances - If true writes a new arff file with the discetized features.
writeSerializedInstancesObject - If true writes a serialized Instance object which has 0 Instances but contains the header information of the learning dataset. This serialized object will be needed by the method that uses the learned discretization filter in order to create a correct Instances object from an image's feature vectors.
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
This method uses the DiscretizationFilterCreation class to learn a discretization filter from an arff formatted dataset file containing real-valued features (e.g. SURF).

Parameters:
args - [0] Full path to the arff formatted dataset file (use backslashes).
args - [1] Number of bins (e.g. 128), use 128.
args - [2] normalization type (no/l2/power+l2), use l2.
Throws:
java.lang.Exception