Ignore:
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • Orange/__init__.py

    r9929 r9944  
    1919_import("data.io") 
    2020_import("data.sample") 
     21_import("data.discretization") 
    2122 
    2223_import("network") 
  • Orange/feature/discretization.py

    r9927 r9944  
    9393 
    9494        from Orange.feature import discretization 
    95         bayes = Orange.classification.bayes.NaiveBayesLearner() 
     95        bayes = Orange.classification.bayes.Learner() 
    9696        disc = orange.Preprocessor_discretize(method=discretization.EquiNDiscretization(numberOfIntervals=10)) 
    9797        dBayes = discretization.DiscretizedLearner(bayes, name='disc bayes') 
     
    127127  def __call__(self, example, resultType = orange.GetValue): 
    128128    return self.classifier(example, resultType) 
    129  
    130 class DiscretizeTable(object): 
    131     """Discretizes all continuous features of the data table. 
    132  
    133     :param data: data to discretize. 
    134     :type data: :class:`Orange.data.Table` 
    135  
    136     :param features: data features to discretize. None (default) to discretize all features. 
    137     :type features: list of :class:`Orange.feature.Descriptor` 
    138  
    139     :param method: feature discretization method. 
    140     :type method: :class:`Discretization` 
    141     """ 
    142     def __new__(cls, data=None, features=None, discretize_class=False, method=EqualFreq(n=3)): 
    143         if data is None: 
    144             self = object.__new__(cls) 
    145             return self 
    146         else: 
    147             self = cls(features=features, discretize_class=discretize_class, method=method) 
    148             return self(data) 
    149  
    150     def __init__(self, features=None, discretize_class=False, method=EqualFreq(n=3)): 
    151         self.features = features 
    152         self.discretize_class = discretize_class 
    153         self.method = method 
    154  
    155     def __call__(self, data): 
    156         pp = Preprocessor_discretize(attributes=self.features, discretizeClass=self.discretize_class) 
    157         pp.method = self.method 
    158         return pp(data) 
    159  
  • docs/reference/rst/Orange.data.discretization.rst

    r9900 r9943  
    1 .. py:currentmodule:: Orange.data 
     1.. py:currentmodule:: Orange.data.discretization 
    22 
    33################################### 
    4 Discretization (``discretization``) 
     4Data discretization (``discretization``) 
    55################################### 
    66 
     
    2828    ['<=5.45', '>3.15', '<=2.45', '<=0.80', 'Iris-setosa'] 
    2929 
    30 The procedure uses feature discretization classes as define in XXX and applies them on entire data sets. 
    31 The suported discretization methods are: 
     30The procedure uses feature discretization classes as defined in :doc:`Orange.feature.discretization` and applies them 
     31on entire data set. The suported discretization methods are: 
    3232 
    3333* equal width discretization, where the domain of continuous feature is split to intervals of the same 
    34   width equal-sized intervals (:class:`EqualWidth`), 
    35 * equal frequency discretization, where each intervals contains equal number of data instances (:class:`EqualFreq`), 
     34  width equal-sized intervals (uses :class:`Orange.feature.discretization.EqualWidth`), 
     35* equal frequency discretization, where each intervals contains equal number of data instances (uses 
     36  :class:`Orange.feature.discretization.EqualFreq`), 
    3637* entropy-based, as originally proposed by [FayyadIrani1993]_ that infers the intervals to minimize 
    37   within-interval entropy of class distributions (:class:`Entropy`), 
     38  within-interval entropy of class distributions (uses :class:`Orange.feature.discretization.Entropy`), 
    3839* bi-modal, using three intervals to optimize the difference of the class distribution in 
    39   the middle with the distribution outside it (:class:`BiModal`), 
     40  the middle with the distribution outside it (uses :class:`Orange.feature.discretization.BiModal`), 
    4041* fixed, with the user-defined cut-off points. 
     42 
     43.. FIXME give a corresponding class for fixed discretization 
    4144 
    4245The above script used the default discretization method (equal frequency with three intervals). This can be 
     
    4649    :lines: 3-5 
    4750 
    48 Classes 
    49 ======= 
     51Data discretization classes 
     52=========================== 
    5053 
    51 Some functions and classes that can be used for 
    52 categorization of continuous features. Besides several general classes that 
    53 can help in this task, we also provide a function that may help in 
    54 entropy-based discretization (Fayyad & Irani), and a wrapper around classes for 
    55 categorization that can be used for learning. 
    56  
    57 .. autoclass:: Orange.feature.discretization.DiscretizedLearner_Class 
     54.. .. autoclass:: Orange.feature.discretization.DiscretizedLearner_Class 
    5855 
    5956.. autoclass:: DiscretizeTable 
    6057 
    61 .. rubric:: Example 
     58.. A chapter on `feature subset selection <../ofb/o_fss.htm>`_ in Orange 
     59   for Beginners tutorial shows the use of DiscretizedLearner. Other 
     60   discretization classes from core Orange are listed in chapter on 
     61   `categorization <../ofb/o_categorization.htm>`_ of the same tutorial. -> should put in classification/wrappers 
    6262 
    63 FIXME. A chapter on `feature subset selection <../ofb/o_fss.htm>`_ in Orange 
    64 for Beginners tutorial shows the use of DiscretizedLearner. Other 
    65 discretization classes from core Orange are listed in chapter on 
    66 `categorization <../ofb/o_categorization.htm>`_ of the same tutorial. 
     63.. [FayyadIrani1993] UM Fayyad and KB Irani. Multi-interval discretization of continuous valued 
     64  attributes for classification learning. In Proc. 13th International Joint Conference on Artificial Intelligence, pages 
     65  1022--1029, Chambery, France, 1993. 
  • docs/reference/rst/Orange.feature.discretization.rst

    r9927 r9944  
    11.. py:currentmodule:: Orange.feature.discretization 
    22 
    3 ################################### 
    4 Discretization (``discretization``) 
    5 ################################### 
     3########################################### 
     4Feature discretization (``discretization``) 
     5########################################### 
    66 
    77.. index:: discretization 
  • source/orange/discretize.hpp

    r9899 r9943  
    200200 
    201201  int maxNumberOfIntervals; //P(+n) maximal number of intervals; default = 0 (no limits) 
    202   bool forceAttribute; //P minimal number of intervals; default = 0 (no limits) 
     202  bool forceAttribute; //P(+forced) minimal number of intervals; default = 0 (no limits) 
    203203 
    204204  TEntropyDiscretization(); 
Note: See TracChangeset for help on using the changeset viewer.