程序包 weka.estimators

类 Estimator

java.lang.Object
weka.estimators.Estimator
所有已实现的接口:
Serializable, Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler
直接已知子类:
DiscreteEstimator, DiscreteEstimatorBayes, KernelEstimator, MahalanobisEstimator, NormalEstimator, PoissonEstimator

public abstract class Estimator extends Object implements Cloneable, Serializable, OptionHandler, CapabilitiesHandler, RevisionHandler
Abstract class for all estimators. Example code for a nonincremental estimator
   // create a histogram for estimation
   EqualWidthEstimator est = new EqualWidthEstimator();
   est.addValues(instances, attrIndex);
 
Example code for an incremental estimator (incremental estimators must implement interface IncrementalEstimator)
   // Create a discrete estimator that takes values 0 to 9
   DiscreteEstimator newEst = new DiscreteEstimator(10, true);

   // Create 50 random integers first predicting the probability of the
   // value, then adding the value to the estimator
   Random r = new Random(seed);
   for(int i = 0; i < 50; i++) {
     current = Math.abs(r.nextInt() % 10);
     System.out.println(newEst);
     System.out.println("Prediction for " + current 
                        + " = " + newEst.getProbability(current));
     newEst.addValue(current, 1);
   }
 
Example code for a main method for an estimator.

 public static void main(String [] argv) {

   try {
     LoglikeliEstimator est = new LoglikeliEstimator();      
     Estimator.buildEstimator((Estimator) est, argv, false);      
     System.out.println(est.toString());
   } catch (Exception ex) {
     ex.printStackTrace();
     System.out.println(ex.getMessage());
   }
 }
 
版本:
$Revision: 5539 $
作者:
Gabi Schmidberger (gabi@cs.waikato.ac.nz), Len Trigg (trigg@cs.waikato.ac.nz)
另请参阅:
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    addValue(double data, double weight)
    Add a new data value to the current estimator.
    void
    addValues(Instances data, int attrIndex)
    Initialize the estimator with a new dataset.
    void
    addValues(Instances data, int attrIndex, double min, double max, double factor)
    Initialize the estimator with all values of one attribute of a dataset.
    void
    addValues(Instances data, int attrIndex, int classIndex, int classValue)
    Initialize the estimator using only the instance of one class.
    void
    addValues(Instances data, int attrIndex, int classIndex, int classValue, double min, double max)
    Initialize the estimator using only the instance of one class.
    static void
    buildEstimator(Estimator est, String[] options, boolean isIncremental)
    Build an estimator using the options.
    static void
    buildEstimator(Estimator est, Instances instances, int attrIndex, int classIndex, int classValueIndex, boolean isIncremental)
     
    static Estimator
    Creates a deep copy of the given estimator using serialization.
    Returns the tip text for this property
    boolean
    Tests whether the current estimation object is equal to another estimation object
    static Estimator
    forName(String name, String[] options)
    Creates a new instance of a estimatorr given it's class name and (optional) arguments to pass to it's setOptions method.
    Returns the Capabilities of this Estimator.
    boolean
    Get whether debugging is turned on.
    Gets the current settings of the Estimator.
    abstract double
    getProbability(double data)
    Get a probability estimate for a value.
    Returns an enumeration describing the available options.
    static Estimator[]
    makeCopies(Estimator model, int num)
    Creates a given number of deep copies of the given estimator using serialization.
    static Estimator
    Creates a deep copy of the given estimator using serialization.
    void
    setDebug(boolean debug)
    Set debugging mode.
    void
    setOptions(String[] options)
    Parses a given list of options.
    void
    testCapabilities(Instances data, int attrIndex)
    Test if the estimator can handle the data.

    从类继承的方法 java.lang.Object

    getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    从接口继承的方法 weka.core.RevisionHandler

    getRevision
  • 构造器详细资料

    • Estimator

      public Estimator()
  • 方法详细资料

    • addValue

      public void addValue(double data, double weight)
      Add a new data value to the current estimator.
      参数:
      data - the new data value
      weight - the weight assigned to the data value
    • addValues

      public void addValues(Instances data, int attrIndex) throws Exception
      Initialize the estimator with a new dataset. Finds min and max first.
      参数:
      data - the dataset used to build this estimator
      attrIndex - attribute the estimator is for
      抛出:
      Exception - if building of estimator goes wrong
    • addValues

      public void addValues(Instances data, int attrIndex, double min, double max, double factor) throws Exception
      Initialize the estimator with all values of one attribute of a dataset. Some estimator might ignore the min and max values.
      参数:
      data - the dataset used to build this estimator
      attrIndex - attribute the estimator is for
      min - minimal border of range
      max - maximal border of range
      factor - number of instances has been reduced to that factor
      抛出:
      Exception - if building of estimator goes wrong
    • addValues

      public void addValues(Instances data, int attrIndex, int classIndex, int classValue) throws Exception
      Initialize the estimator using only the instance of one class. It is using the values of one attribute only.
      参数:
      data - the dataset used to build this estimator
      attrIndex - attribute the estimator is for
      classIndex - index of the class attribute
      classValue - the class value
      抛出:
      Exception - if building of estimator goes wrong
    • addValues

      public void addValues(Instances data, int attrIndex, int classIndex, int classValue, double min, double max) throws Exception
      Initialize the estimator using only the instance of one class. It is using the values of one attribute only.
      参数:
      data - the dataset used to build this estimator
      attrIndex - attribute the estimator is for
      classIndex - index of the class attribute
      classValue - the class value
      min - minimal value of this attribute
      max - maximal value of this attribute
      抛出:
      Exception - if building of estimator goes wrong
    • getProbability

      public abstract double getProbability(double data)
      Get a probability estimate for a value.
      参数:
      data - the value to estimate the probability of
      返回:
      the estimated probability of the supplied value
    • buildEstimator

      public static void buildEstimator(Estimator est, String[] options, boolean isIncremental) throws Exception
      Build an estimator using the options. The data is given in the options.
      参数:
      est - the estimator used
      options - the list of options
      isIncremental - true if estimator is incremental
      抛出:
      Exception - if something goes wrong or the user requests help on command options
    • buildEstimator

      public static void buildEstimator(Estimator est, Instances instances, int attrIndex, int classIndex, int classValueIndex, boolean isIncremental) throws Exception
      抛出:
      Exception
    • clone

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

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

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

      public boolean equals(Object obj)
      Tests whether the current estimation object is equal to another estimation object
      覆盖:
      equals 在类中 Object
      参数:
      obj - the object to compare against
      返回:
      true if the two objects are equal
    • 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, estimator 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 Estimator.
      指定者:
      getOptions 在接口中 OptionHandler
      返回:
      an array of strings suitable for passing to setOptions
    • forName

      public static Estimator forName(String name, String[] options) throws Exception
      Creates a new instance of a estimatorr 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.
      参数:
      name - the fully qualified class name of the estimatorr
      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
    • 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 Estimator. Derived estimators have to override this method to enable capabilities.
      指定者:
      getCapabilities 在接口中 CapabilitiesHandler
      返回:
      the capabilities of this object
      另请参阅:
    • testCapabilities

      public void testCapabilities(Instances data, int attrIndex) throws Exception
      Test if the estimator can handle the data.
      参数:
      data - the dataset the estimator takes an attribute from
      attrIndex - the index of the attribute
      抛出:
      Exception
      另请参阅: