public abstract class AbstractClassifier extends Object implements Classifier
Basic function class for classifying
Copyright: Copyright (c) 2005
Company: IST, Drexel University
| Modifier and Type | Field and Description |
|---|---|
protected String[] |
arrLabel |
protected int |
classNum |
protected SparseMatrix |
doctermMatrix |
protected FeatureSelector |
featureSelector |
protected IndexReader |
indexReader |
protected DocClassSet |
validatingDocSet |
| Constructor and Description |
|---|
AbstractClassifier() |
AbstractClassifier(IndexReader indexReader) |
AbstractClassifier(SparseMatrix doctermMatrix) |
| Modifier and Type | Method and Description |
|---|---|
DocClassSet |
classify(DocClass testingDocs)
This method uses the trained model to classify the testing documents.
|
DocClassSet |
classify(DocClassSet trainingDocSet,
DocClass testingDocs)
This method trains the classifier with the training document set and then using the trained model to classify the testing documents.
|
DocClassSet |
classify(DocClassSet trainingDocSet,
DocClassSet validatingDocSet,
DocClass testingDocs) |
int |
classify(IRDoc doc)
Classify one particular document
|
String |
getClassLabel(int index)
Gets the label of a given document category
|
SparseMatrix |
getDocTermMatrix() |
FeatureSelector |
getFeatureSelector() |
IndexReader |
getIndexReader() |
protected Row |
getRow(int docIndex) |
void |
setFeatureSelector(FeatureSelector selector) |
void |
train(DocClassSet trainingDocSet,
DocClassSet validatingDocSet)
This method trains the classifier with the training document set and validating document set.
|
protected void |
trainFeatureSelector(DocClassSet trainingSet) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclassify, rank, saveModel, trainprotected IndexReader indexReader
protected SparseMatrix doctermMatrix
protected DocClassSet validatingDocSet
protected FeatureSelector featureSelector
protected String[] arrLabel
protected int classNum
public AbstractClassifier(IndexReader indexReader)
public AbstractClassifier(SparseMatrix doctermMatrix)
public AbstractClassifier()
public String getClassLabel(int index)
ClassifiergetClassLabel in interface Classifierindex - the index of the categorypublic IndexReader getIndexReader()
getIndexReader in interface Classifierpublic SparseMatrix getDocTermMatrix()
public FeatureSelector getFeatureSelector()
getFeatureSelector in interface Classifierpublic void setFeatureSelector(FeatureSelector selector)
setFeatureSelector in interface Classifierselector - the feature selector for the classifier.public DocClassSet classify(DocClassSet trainingDocSet, DocClass testingDocs)
Classifierclassify in interface ClassifiertrainingDocSet - training document settestingDocs - testing document setpublic DocClassSet classify(DocClassSet trainingDocSet, DocClassSet validatingDocSet, DocClass testingDocs)
classify in interface ClassifiertrainingDocSet - the training document setvalidatingDocSet - the validation document set, usually for avoiding the overfitting problemtestingDocs - the testing document setpublic void train(DocClassSet trainingDocSet, DocClassSet validatingDocSet)
Classifiertrain in interface ClassifiertrainingDocSet - training document setvalidatingDocSet - validating document setpublic DocClassSet classify(DocClass testingDocs)
Classifierclassify in interface ClassifiertestingDocs - testing document setpublic int classify(IRDoc doc)
Classifierclassify in interface Classifierdoc - the index of the document is stored in the IRDoc objectprotected Row getRow(int docIndex)
protected void trainFeatureSelector(DocClassSet trainingSet)
Copyright © 2018 JULIE Lab, Germany. All rights reserved.