程序包 weka.classifiers

类 Classifier

java.lang.Object
weka.classifiers.Classifier
所有已实现的接口:
Serializable, Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler
直接已知子类:
ADTree, AODE, AODEsr, BayesianLogisticRegression, BayesNet, CitationKNN, ClassificationViaClustering, ComplementNaiveBayes, ConjunctiveRule, DecisionStump, DecisionTable, DMNBtext, FT, GaussianProcesses, HNB, HyperPipes, IB1, IBk, Id3, IsotonicRegression, J48, J48graft, JRip, KStar, LADTree, LBR, LeastMedSq, LibLINEAR, LinearRegression, LMT, Logistic, LogisticBase, M5Base, MDD, MIDD, MILR, MINND, MIOptimalBall, MISMO, MISVM, MultilayerPerceptron, MultipleClassifiersCombiner, NaiveBayes, NaiveBayesMultinomial, NaiveBayesSimple, NBTree, NNge, OneR, PaceRegression, PART, PLSClassifier, PMMLClassifier, PreConstructedLinearModel, Prism, RandomForest, RandomizableClassifier, RandomTree, RBFNetwork, REPTree, Ridor, RuleNode, SerializedClassifier, SimpleLinearRegression, SimpleLogistic, SingleClassifierEnhancer, SMO, SMOreg, SPegasos, UserClassifier, VFI, VotedPerceptron, WAODE, Winnow, ZeroR

public abstract class Classifier extends Object implements Cloneable, Serializable, OptionHandler, CapabilitiesHandler, RevisionHandler
Abstract classifier. All schemes for numeric or nominal prediction in Weka extend this class. Note that a classifier MUST either implement distributionForInstance() or classifyInstance().
版本:
$Revision: 10485 $
作者:
Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (trigg@cs.waikato.ac.nz)
另请参阅:
  • 构造器详细资料

    • Classifier

      public Classifier()
  • 方法详细资料

    • buildClassifier

      public abstract void buildClassifier(Instances data) throws Exception
      Generates a classifier. Must initialize all fields of the classifier that are not being set via options (ie. multiple calls of buildClassifier must always lead to the same result). Must not change the dataset in any way.
      参数:
      data - set of instances serving as training data
      抛出:
      Exception - if the classifier has not been generated successfully
    • classifyInstance

      public double classifyInstance(Instance instance) throws Exception
      Classifies the given test instance. The instance has to belong to a dataset when it's being classified. Note that a classifier MUST implement either this or distributionForInstance().
      参数:
      instance - the instance to be classified
      返回:
      the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
      抛出:
      Exception - if an error occurred during the prediction
    • distributionForInstance

      public double[] distributionForInstance(Instance instance) throws Exception
      Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero. If the class is numeric, the array must consist of only one element, which contains the predicted value. Note that a classifier MUST implement either this or classifyInstance().
      参数:
      instance - the instance to be classified
      返回:
      an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
      抛出:
      Exception - if distribution could not be computed successfully
    • forName

      public static Classifier forName(String classifierName, String[] options) throws Exception
      Creates a new instance of a classifier given it's class name and (optional) arguments to pass to it's setOptions method. If the classifier implements OptionHandler and the options parameter is non-null, the classifier will have it's options set.
      参数:
      classifierName - the fully qualified class name of the classifier
      options - an array of options suitable for passing to setOptions. May be null.
      返回:
      the newly created classifier, ready for use.
      抛出:
      Exception - if the classifier name is invalid, or the options supplied are not acceptable to the classifier
    • makeCopy

      public static Classifier makeCopy(Classifier model) throws Exception
      Creates a deep copy of the given classifier using serialization.
      参数:
      model - the classifier to copy
      返回:
      a deep copy of the classifier
      抛出:
      Exception - if an error occurs
    • makeCopies

      public static Classifier[] makeCopies(Classifier model, int num) throws Exception
      Creates a given number of deep copies of the given classifier using serialization.
      参数:
      model - the classifier to copy
      num - the number of classifier copies to create.
      返回:
      an array of classifiers.
      抛出:
      Exception - if an error occurs
    • listOptions

      public Enumeration listOptions()
      Returns an enumeration describing the available options.
      指定者:
      listOptions 在接口中 OptionHandler
      返回:
      an enumeration of all the available options.
    • setOptions

      public void setOptions(String[] options) throws Exception
      Parses a given list of options. Valid options are:

      -D
      If set, classifier is run in debug mode and may output additional info to the console.

      指定者:
      setOptions 在接口中 OptionHandler
      参数:
      options - the list of options as an array of strings
      抛出:
      Exception - if an option is not supported
    • getOptions

      public String[] getOptions()
      Gets the current settings of the Classifier.
      指定者:
      getOptions 在接口中 OptionHandler
      返回:
      an array of strings suitable for passing to setOptions
    • setDebug

      public void setDebug(boolean debug)
      Set debugging mode.
      参数:
      debug - true if debug output should be printed
    • getDebug

      public boolean getDebug()
      Get whether debugging is turned on.
      返回:
      true if debugging output is on
    • debugTipText

      public String debugTipText()
      Returns the tip text for this property
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getCapabilities

      public Capabilities getCapabilities()
      Returns the Capabilities of this classifier. Maximally permissive capabilities are allowed by default. Derived classifiers should override this method and first disable all capabilities and then enable just those capabilities that make sense for the scheme.
      指定者:
      getCapabilities 在接口中 CapabilitiesHandler
      返回:
      the capabilities of this object
      另请参阅:
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision