类 LinearRegression

java.lang.Object
weka.classifiers.Classifier
weka.classifiers.functions.LinearRegression
所有已实现的接口:
Serializable, Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler, WeightedInstancesHandler

public class LinearRegression extends Classifier implements OptionHandler, WeightedInstancesHandler
Class for using linear regression for prediction. Uses the Akaike criterion for model selection, and is able to deal with weighted instances.

Valid options are:

 -D
  Produce debugging output.
  (default no debugging output)
 -S <number of selection method>
  Set the attribute selection method to use. 1 = None, 2 = Greedy.
  (default 0 = M5' method)
 -C
  Do not try to eliminate colinear attributes.
 
 -R <double>
  Set ridge parameter (default 1.0e-8).
 
版本:
$Revision: 9770 $
作者:
Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (trigg@cs.waikato.ac.nz)
另请参阅:
  • 字段详细资料

    • SELECTION_M5

      public static final int SELECTION_M5
      Attribute selection method: M5 method
      另请参阅:
    • SELECTION_NONE

      public static final int SELECTION_NONE
      Attribute selection method: No attribute selection
      另请参阅:
    • SELECTION_GREEDY

      public static final int SELECTION_GREEDY
      Attribute selection method: Greedy method
      另请参阅:
    • TAGS_SELECTION

      public static final Tag[] TAGS_SELECTION
      Attribute selection methods
  • 构造器详细资料

    • LinearRegression

      public LinearRegression()
  • 方法详细资料

    • turnChecksOff

      public void turnChecksOff()
      Turns off checks for missing values, etc. Use with caution. Also turns off scaling.
    • turnChecksOn

      public void turnChecksOn()
      Turns on checks for missing values, etc. Also turns on scaling.
    • globalInfo

      public String globalInfo()
      Returns a string describing this classifier
      返回:
      a description of the classifier suitable for displaying in the explorer/experimenter gui
    • getCapabilities

      public Capabilities getCapabilities()
      Returns default capabilities of the classifier.
      指定者:
      getCapabilities 在接口中 CapabilitiesHandler
      覆盖:
      getCapabilities 在类中 Classifier
      返回:
      the capabilities of this classifier
      另请参阅:
    • buildClassifier

      public void buildClassifier(Instances data) throws Exception
      Builds a regression model for the given data.
      指定者:
      buildClassifier 在类中 Classifier
      参数:
      data - the training data to be used for generating the linear regression function
      抛出:
      Exception - if the classifier could not be built successfully
    • classifyInstance

      public double classifyInstance(Instance instance) throws Exception
      Classifies the given instance using the linear regression function.
      覆盖:
      classifyInstance 在类中 Classifier
      参数:
      instance - the test instance
      返回:
      the classification
      抛出:
      Exception - if classification can't be done successfully
    • toString

      public String toString()
      Outputs the linear regression model as a string.
      覆盖:
      toString 在类中 Object
      返回:
      the model as string
    • listOptions

      public Enumeration listOptions()
      Returns an enumeration describing the available options.
      指定者:
      listOptions 在接口中 OptionHandler
      覆盖:
      listOptions 在类中 Classifier
      返回:
      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
        Produce debugging output.
        (default no debugging output)
       -S <number of selection method>
        Set the attribute selection method to use. 1 = None, 2 = Greedy.
        (default 0 = M5' method)
       -C
        Do not try to eliminate colinear attributes.
       
       -R <double>
        Set ridge parameter (default 1.0e-8).
       
      指定者:
      setOptions 在接口中 OptionHandler
      覆盖:
      setOptions 在类中 Classifier
      参数:
      options - the list of options as an array of strings
      抛出:
      Exception - if an option is not supported
    • coefficients

      public double[] coefficients()
      Returns the coefficients for this linear model.
      返回:
      the coefficients for this linear model
    • getOptions

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

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

      public double getRidge()
      Get the value of Ridge.
      返回:
      Value of Ridge.
    • setRidge

      public void setRidge(double newRidge)
      Set the value of Ridge.
      参数:
      newRidge - Value to assign to Ridge.
    • eliminateColinearAttributesTipText

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

      public boolean getEliminateColinearAttributes()
      Get the value of EliminateColinearAttributes.
      返回:
      Value of EliminateColinearAttributes.
    • setEliminateColinearAttributes

      public void setEliminateColinearAttributes(boolean newEliminateColinearAttributes)
      Set the value of EliminateColinearAttributes.
      参数:
      newEliminateColinearAttributes - Value to assign to EliminateColinearAttributes.
    • numParameters

      public int numParameters()
      Get the number of coefficients used in the model
      返回:
      the number of coefficients
    • attributeSelectionMethodTipText

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

      public void setAttributeSelectionMethod(SelectedTag method)
      Sets the method used to select attributes for use in the linear regression.
      参数:
      method - the attribute selection method to use.
    • getAttributeSelectionMethod

      public SelectedTag getAttributeSelectionMethod()
      Gets the method used to select attributes for use in the linear regression.
      返回:
      the method to use.
    • debugTipText

      public String debugTipText()
      Returns the tip text for this property
      覆盖:
      debugTipText 在类中 Classifier
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • setDebug

      public void setDebug(boolean debug)
      Controls whether debugging output will be printed
      覆盖:
      setDebug 在类中 Classifier
      参数:
      debug - true if debugging output should be printed
    • getDebug

      public boolean getDebug()
      Controls whether debugging output will be printed
      覆盖:
      getDebug 在类中 Classifier
      返回:
      true if debugging output is printed
    • getRevision

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

      public static void main(String[] argv)
      Generates a linear regression function predictor.
      参数:
      argv - the options