类 PreConstructedLinearModel

java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.m5.PreConstructedLinearModel
所有已实现的接口:
Serializable, Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler

public class PreConstructedLinearModel extends Classifier implements Serializable
This class encapsulates a linear regression function. It is a classifier but does not learn the function itself, instead it is constructed with coefficients and intercept obtained elsewhere. The buildClassifier method must still be called however as this stores a copy of the training data's header for use in printing the model to the console.
版本:
$Revision: 1.6 $
作者:
Mark Hall (mhall@cs.waikato.ac.nz)
另请参阅:
  • 构造器详细资料

    • PreConstructedLinearModel

      public PreConstructedLinearModel(double[] coeffs, double intercept)
      Constructor
      参数:
      coeffs - an array of coefficients
      intercept - the intercept
  • 方法详细资料

    • buildClassifier

      public void buildClassifier(Instances instances) throws Exception
      Builds the classifier. In this case all that is done is that a copy of the training instances header is saved.
      指定者:
      buildClassifier 在类中 Classifier
      参数:
      instances - an Instances value
      抛出:
      Exception - if an error occurs
    • classifyInstance

      public double classifyInstance(Instance inst) throws Exception
      Predicts the class of the supplied instance using the linear model.
      覆盖:
      classifyInstance 在类中 Classifier
      参数:
      inst - the instance to make a prediction for
      返回:
      the prediction
      抛出:
      Exception - if an error occurs
    • numParameters

      public int numParameters()
      Return the number of parameters (coefficients) in the linear model
      返回:
      the number of parameters
    • coefficients

      public double[] coefficients()
      Return the array of coefficients
      返回:
      the coefficients
    • intercept

      public double intercept()
      Return the intercept
      返回:
      the intercept
    • toString

      public String toString()
      Returns a textual description of this linear model
      覆盖:
      toString 在类中 Object
      返回:
      String containing a description of this linear model
    • getRevision

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