类 ComplementNaiveBayes
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.bayes.ComplementNaiveBayes
- 所有已实现的接口:
Serializable
,Cloneable
,CapabilitiesHandler
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
,WeightedInstancesHandler
public class ComplementNaiveBayes
extends Classifier
implements OptionHandler, WeightedInstancesHandler, TechnicalInformationHandler
Class for building and using a Complement class Naive Bayes classifier.
For more information see,
Jason D. Rennie, Lawrence Shih, Jaime Teevan, David R. Karger: Tackling the Poor Assumptions of Naive Bayes Text Classifiers. In: ICML, 616-623, 2003.
P.S.: TF, IDF and length normalization transforms, as described in the paper, can be performed through weka.filters.unsupervised.StringToWordVector. BibTeX:
For more information see,
Jason D. Rennie, Lawrence Shih, Jaime Teevan, David R. Karger: Tackling the Poor Assumptions of Naive Bayes Text Classifiers. In: ICML, 616-623, 2003.
P.S.: TF, IDF and length normalization transforms, as described in the paper, can be performed through weka.filters.unsupervised.StringToWordVector. BibTeX:
@inproceedings{Rennie2003, author = {Jason D. Rennie and Lawrence Shih and Jaime Teevan and David R. Karger}, booktitle = {ICML}, pages = {616-623}, publisher = {AAAI Press}, title = {Tackling the Poor Assumptions of Naive Bayes Text Classifiers}, year = {2003} }Valid options are:
-N Normalize the word weights for each class
-S Smoothing value to avoid zero WordGivenClass probabilities (default=1.0).
- 版本:
- $Revision: 5516 $
- 作者:
- Ashraf M. Kibriya (amk14@cs.waikato.ac.nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
buildClassifier
(Instances instances) Generates the classifier.double
classifyInstance
(Instance instance) Classifies a given instance.Returns default capabilities of the classifier.boolean
Returns true if the word weights for each class are to be normalizedString[]
Gets the current settings of the classifier.Returns the revision string.double
Gets the smoothing value to be used to avoid zero WordGivenClass probabilities.Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.Returns a string describing this classifierReturns an enumeration describing the available options.static void
Main method for testing this class.Returns the tip text for this propertyvoid
setNormalizeWordWeights
(boolean doNormalize) Sets whether if the word weights for each class should be normalizedvoid
setOptions
(String[] options) Parses a given list of options.void
setSmoothingParameter
(double val) Sets the smoothing value used to avoid zero WordGivenClass probabilitiesReturns the tip text for this propertytoString()
Prints out the internal model built by the classifier.从类继承的方法 weka.classifiers.Classifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
-
构造器详细资料
-
ComplementNaiveBayes
public ComplementNaiveBayes()
-
-
方法详细资料
-
listOptions
Returns an enumeration describing the available options.- 指定者:
listOptions
在接口中OptionHandler
- 覆盖:
listOptions
在类中Classifier
- 返回:
- an enumeration of all the available options.
-
getOptions
Gets the current settings of the classifier.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中Classifier
- 返回:
- an array of strings suitable for passing to setOptions
-
setOptions
Parses a given list of options. Valid options are:-N Normalize the word weights for each class
-S Smoothing value to avoid zero WordGivenClass probabilities (default=1.0).
- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中Classifier
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getNormalizeWordWeights
public boolean getNormalizeWordWeights()Returns true if the word weights for each class are to be normalized- 返回:
- true if the word weights are normalized
-
setNormalizeWordWeights
public void setNormalizeWordWeights(boolean doNormalize) Sets whether if the word weights for each class should be normalized- 参数:
doNormalize
- whether the word weights are to be normalized
-
normalizeWordWeightsTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSmoothingParameter
public double getSmoothingParameter()Gets the smoothing value to be used to avoid zero WordGivenClass probabilities.- 返回:
- the smoothing value
-
setSmoothingParameter
public void setSmoothingParameter(double val) Sets the smoothing value used to avoid zero WordGivenClass probabilities- 参数:
val
- the new smooting value
-
smoothingParameterTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
globalInfo
Returns a string describing this classifier- 返回:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.- 指定者:
getTechnicalInformation
在接口中TechnicalInformationHandler
- 返回:
- the technical information about this class
-
getCapabilities
Returns default capabilities of the classifier.- 指定者:
getCapabilities
在接口中CapabilitiesHandler
- 覆盖:
getCapabilities
在类中Classifier
- 返回:
- the capabilities of this classifier
- 另请参阅:
-
buildClassifier
Generates the classifier.- 指定者:
buildClassifier
在类中Classifier
- 参数:
instances
- set of instances serving as training data- 抛出:
Exception
- if the classifier has not been built successfully
-
classifyInstance
Classifies a given instance.The classification rule is:
MinC(forAllWords(ti*Wci))
where
ti is the frequency of word i in the given instance
Wci is the weight of word i in Class c.For more information see section 4.4 of the paper mentioned above in the classifiers description.
- 覆盖:
classifyInstance
在类中Classifier
- 参数:
instance
- the instance to classify- 返回:
- the index of the class the instance is most likely to belong.
- 抛出:
Exception
- if the classifier has not been built yet.
-
toString
Prints out the internal model built by the classifier. In this case it prints out the word weights calculated when building the classifier. -
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 覆盖:
getRevision
在类中Classifier
- 返回:
- the revision
-
main
Main method for testing this class.- 参数:
argv
- the options
-