Aleš Erjavec avatar Aleš Erjavec committed 02feeae Draft

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

Comments (0)

Files changed (1)

docs/reference/rst/Orange.statistics.estimate.rst

 
 .. index:: Probability Estimation
 
-=======================================
+=====================================
 Probability Estimation (``estimate``)
-=======================================
+=====================================
 
 Probability estimators compute probabilities of values of class variable.
 They come in two flavours:
 
 
 Base classes
-=============
+============
 
 All probability estimators are derived from two base classes: one for
 unconditional and the other for conditional probability estimation. The same
         distribution and instances are given, it is up to constructor to
         decide what to use.
 
+        .. note:: The `instances` and `weight_id` argument are at the moment
+            only used by :class:`ConditionalByRows`. The rest of the builtin
+            constructors require that `distribution` is given.
+
 .. class:: Estimator
 
     .. attribute:: supports_discrete
         distribution and instances are given, it is up to constructor to
         decide what to use.
 
+        .. note:: The `instances` and `weight_id` argument are at the moment
+            only used by :class:`ConditionalByRows`. The rest of the builtin
+            constructors require that `table` is given.
+
 .. class:: ConditionalEstimator
 
     As a counterpart of :class:`Estimator`, this estimator can return
         For detailed description of handling of different combinations of
         parameters, see the inherited :obj:`ConditionalEstimator.__call__`.
 
+
+Example
+=======
+
+    >>> import Orange
+    >>> iris = Orange.data.Table("iris")
+    >>>
+    >>> # discrete class distribution
+    >>> iris_dist = Orange.statistics.distribution.Distribution("iris", iris)
+    >>> # m estimate constructor
+    >>> mest_constructor = Orange.statistics.estimate.M(m=10)
+    >>>
+    >>> # create the estimator
+    >>> mest = mest_constructor(iris_dist)
+    >>> print "%.2f" % mest(iris[0]['iris'])
+    0.33
+    >>> # petal length (continuous) distribution
+    >>> plength_dist = Orange.statistics.distribution.Distribution("petal length", iris)
+    >>> plength_dist.normalize()
+    >>>
+    >>> # loess contructor
+    >>> loess_est_constructor = Orange.statistics.estimate.Loess()
+    >>>
+    >>> # create the loess estimator
+    >>> loess_est = loess_est_constructor(plength_dist)
+    >>>
+    >>> print "%.2f" % loess_est(iris[0]['petal length'])
+    0.04
+    >>> # contingency matrix for the conditional estimator
+    >>> contingency = Orange.statistics.contingency.VarClass('petal length', iris)
+    >>> conditional_loess_constructor = Orange.statistics.estimate.ConditionalLoess()
+    >>>
+    >>> cloess_est = conditional_loess_constructor(contingency)
+    >>> print cloess_est(iris[0]['petal length'])
+    <0.980, 0.008, 0.012>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.