public abstract class AbstractFeatureSelector extends Object implements FeatureSelector, Serializable
Abstract function class for feature selection
Copyright: Copyright (c) 2005
Company: IST, Drexel University
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
featureMap |
protected int |
selectedFeatureNum |
| Constructor and Description |
|---|
AbstractFeatureSelector() |
| Modifier and Type | Method and Description |
|---|---|
protected DoubleVector |
getClassPrior(DocClassSet docSet) |
int |
getSelectedFeatureNum() |
protected abstract int[] |
getSelectedFeatures(IndexReader indexReader,
DocClassSet trainingSet) |
protected abstract int[] |
getSelectedFeatures(SparseMatrix doctermMatrix,
DocClassSet trainingSet) |
protected IntDenseMatrix |
getTermDistribution(IndexReader indexReader,
DocClassSet trainingSet) |
protected IntDenseMatrix |
getTermDistribution(SparseMatrix doctermMatrix,
DocClassSet trainingSet) |
protected int[] |
getTermDocFrequency(SparseMatrix matrix,
DocClassSet trainingSet) |
boolean |
isSelected(int originalFeatureIndex) |
int |
map(int originalFeatureIndex)
Map the old feature index to the index in the new feature space.
|
void |
setSelectedFeatures(int[] selectedFeatures)
Manually set selected features.
|
void |
train(IndexReader indexReader,
DocClassSet trainingSet)
This method chooses a subset of features for text classification
|
void |
train(SparseMatrix doctermMatrix,
DocClassSet trainingSet)
This method chooses a subset of features for text classification.
|
protected int[] featureMap
protected int selectedFeatureNum
protected abstract int[] getSelectedFeatures(IndexReader indexReader, DocClassSet trainingSet)
protected abstract int[] getSelectedFeatures(SparseMatrix doctermMatrix, DocClassSet trainingSet)
public void train(IndexReader indexReader, DocClassSet trainingSet)
FeatureSelectortrain in interface FeatureSelectorindexReader - the index reader a classifer is working ontrainingSet - the labeled training document setpublic void train(SparseMatrix doctermMatrix, DocClassSet trainingSet)
FeatureSelectortrain in interface FeatureSelectordoctermMatrix - the document-term matrix a classifer is working ontrainingSet - the labeled training document setpublic void setSelectedFeatures(int[] selectedFeatures)
FeatureSelectorsetSelectedFeatures in interface FeatureSelectorselectedFeatures - each elements contains the index of the selected feature in the old feature space.
The selected feature must be in the ascending order in the input array.public boolean isSelected(int originalFeatureIndex)
isSelected in interface FeatureSelectororiginalFeatureIndex - the index of the feature in the old feature spacepublic int map(int originalFeatureIndex)
FeatureSelectormap in interface FeatureSelectororiginalFeatureIndex - the index of the feature before feature selectionpublic int getSelectedFeatureNum()
getSelectedFeatureNum in interface FeatureSelectorprotected DoubleVector getClassPrior(DocClassSet docSet)
protected int[] getTermDocFrequency(SparseMatrix matrix, DocClassSet trainingSet)
protected IntDenseMatrix getTermDistribution(IndexReader indexReader, DocClassSet trainingSet)
protected IntDenseMatrix getTermDistribution(SparseMatrix doctermMatrix, DocClassSet trainingSet)
Copyright © 2018 JULIE Lab, Germany. All rights reserved.