Changeset 11337:02feeae55f5f in orange


Ignore:
Timestamp:
02/20/13 13:08:50 (14 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added some clarification and and a code example to the estimator documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/Orange.statistics.estimate.rst

    r11335 r11337  
    33.. index:: Probability Estimation 
    44 
    5 ======================================= 
     5===================================== 
    66Probability Estimation (``estimate``) 
    7 ======================================= 
     7===================================== 
    88 
    99Probability estimators compute probabilities of values of class variable. 
     
    164164 
    165165Base classes 
    166 ============= 
     166============ 
    167167 
    168168All probability estimators are derived from two base classes: one for 
     
    196196        decide what to use. 
    197197 
     198        .. note:: The `instances` and `weight_id` argument are at the moment 
     199            only used by :class:`ConditionalByRows`. The rest of the builtin 
     200            constructors require that `distribution` is given. 
     201 
    198202.. class:: Estimator 
    199203 
     
    245249        distribution and instances are given, it is up to constructor to 
    246250        decide what to use. 
     251 
     252        .. note:: The `instances` and `weight_id` argument are at the moment 
     253            only used by :class:`ConditionalByRows`. The rest of the builtin 
     254            constructors require that `table` is given. 
    247255 
    248256.. class:: ConditionalEstimator 
     
    392400        parameters, see the inherited :obj:`ConditionalEstimator.__call__`. 
    393401 
     402 
     403Example 
     404======= 
     405 
     406    >>> import Orange 
     407    >>> iris = Orange.data.Table("iris") 
     408    >>> 
     409    >>> # discrete class distribution 
     410    >>> iris_dist = Orange.statistics.distribution.Distribution("iris", iris) 
     411    >>> # m estimate constructor 
     412    >>> mest_constructor = Orange.statistics.estimate.M(m=10) 
     413    >>> 
     414    >>> # create the estimator 
     415    >>> mest = mest_constructor(iris_dist) 
     416    >>> print "%.2f" % mest(iris[0]['iris']) 
     417    0.33 
     418    >>> # petal length (continuous) distribution 
     419    >>> plength_dist = Orange.statistics.distribution.Distribution("petal length", iris) 
     420    >>> plength_dist.normalize() 
     421    >>> 
     422    >>> # loess contructor 
     423    >>> loess_est_constructor = Orange.statistics.estimate.Loess() 
     424    >>> 
     425    >>> # create the loess estimator 
     426    >>> loess_est = loess_est_constructor(plength_dist) 
     427    >>> 
     428    >>> print "%.2f" % loess_est(iris[0]['petal length']) 
     429    0.04 
     430    >>> # contingency matrix for the conditional estimator 
     431    >>> contingency = Orange.statistics.contingency.VarClass('petal length', iris) 
     432    >>> conditional_loess_constructor = Orange.statistics.estimate.ConditionalLoess() 
     433    >>> 
     434    >>> cloess_est = conditional_loess_constructor(contingency) 
     435    >>> print cloess_est(iris[0]['petal length']) 
     436    <0.980, 0.008, 0.012> 
Note: See TracChangeset for help on using the changeset viewer.