Changeset 10163:cb2581e5103b in orange


Ignore:
Timestamp:
02/11/12 18:47:04 (2 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
rebase_source:
373eb3d6716e1ab72e49d063942fc293d96e55e6
Message:

Changes to filter documentation; not finished yet

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/data/filter.py

    r10031 r10163  
    1414    ValueFilter_continuous as ValueFilterContinuous,\ 
    1515    ValueFilter_string as ValueFilterString,\ 
     16    ValueFilter_stringList as ValueFilterStringList,\ 
    1617    Filter_conjunction as Conjunction,\ 
    1718    Filter_disjunction as Disjunction 
  • docs/reference/rst/Orange.data.filter.rst

    r10105 r10163  
    150150 
    151151 
    152 Filtering by values 
    153 ------------------- 
    154  
    155 Single values 
    156 ............. 
     152Filtering by value of a single feature 
     153-------------------------------------- 
    157154 
    158155.. class:: SameValue 
     
    171168 
    172169 
    173 Continuous features 
    174 ................... 
    175  
    176 :obj:`Orange.data.filter.Values` provides different methods for 
    177 filtering values of countinuous features: :obj:`ValueFilter.Equal`, 
    178 :obj:`ValueFilter.Less`, :obj:`ValueFilter.LessEqual`, 
    179 :obj:`ValueFilter.Greater`, :obj:`ValueFilter.GreaterEqual`, 
    180 :obj:`ValueFilter.Between`, :obj:`ValueFilter.Outside`. 
    181  
    182 In the following example two different filters are used: 
    183 :obj:`ValueFilter.GreaterEqual`, which needs only one parameter and 
    184 :obj:`ValueFilter.Between`, which needs two. 
    185  
    186 .. literalinclude:: code/filterv.py 
    187     :lines: 52, 75-83 
    188  
    189  
    190 Multiple values and features 
    191 ............................ 
    192  
    193 :obj:`~Orange.data.filter.Values` filters by values of multuple 
     170Filtering by multiple values 
     171---------------------------- 
     172 
     173:obj:`~Orange.data.filter.Values` filters by values of multiple 
    194174features and can compute conjunctions and disjunctions of more complex 
    195175conditions. 
     
    199179    .. attribute:: conditions 
    200180 
    201         A list of conditions described by instances of 
    202         :obj:`~Orange.data.filter.ValueFilterDiscrete` for discrete 
    203         features and :obj:`~Orange.data.filter.ValueFilterContinuous` 
    204         for continuous ones; both are derived from 
     181        A list of conditions described by instances of classes derived from  
    205182        :obj:`Orange.data.filter.ValueFilter`. 
    206183 
    207184    .. attribute:: conjunction 
    208185 
    209         Decides whether the filter computes conjunction or disjunction 
     186        Indicates whether the filter computes conjunction or disjunction 
    210187        of conditions. If ``True``, instance is accepted if no 
    211188        values are rejected. If ``False``, instance is accepted if 
     
    218195    .. attribute:: position 
    219196 
    220         The position of the checked feature (as returned by, for 
     197        The position of the feature in the domain (as returned by, for 
    221198        instance, :obj:`Orange.data.Domain.index`). 
    222199 
     
    228205.. class:: ValueFilterDiscrete 
    229206 
     207    Accepts the listed discrete values. 
     208 
    230209    .. attribute:: values 
    231210 
    232         An immutable ``list`` that contains objects of type 
    233         :obj:`~Orange.data.Value`, with values to accept. 
     211        An list of accepted values with elements of type 
     212        :obj:`~Orange.data.Value`. 
    234213 
    235214.. class:: ValueFilterContinous 
    236215 
    237     .. attribute:: min 
    238  
    239         Lower bound of values to consider. 
     216    Accepts the continuous values within (or without) the given interval. 
     217 
     218    .. attribute:: min, ref 
     219 
     220        Lower bound of the interval (``min`` and ``ref`` are aliases 
     221        for the same attribute. 
    240222 
    241223    .. attribute:: max 
    242224 
    243         Upper bound of values to consider. 
    244  
    245     .. attribute:: outside 
    246  
    247         Indicates whether instances outside the interval should be 
    248         accepted.  Defaults to :obj:`False`. 
    249  
    250 .. literalinclude:: code/filter.py 
    251     :lines: 68-82 
    252  
    253 This script selects instances whose age is "young" or "presbyopic" and 
     225        Upper bound of the interval. 
     226 
     227    .. attribute:: oper 
     228 
     229        Comparison operator; should be one of the following: 
     230        :obj:`ValueFilter.Equal`, :obj:`ValueFilter.Less`, 
     231        :obj:`ValueFilter.LessEqual`, :obj:`ValueFilter.Greater`, 
     232        :obj:`ValueFilter.GreaterEqual`, :obj:`ValueFilter.Between`, 
     233        :obj:`ValueFilter.Outside`. Fields ``min`` and ``max`` to 
     234        define the interval for interval operators 
     235        (:obj:`ValueFilter.Between` and :obj:`ValueFilter.Outside`), 
     236        and ``ref`` (which is the same as ``min``) for the others. 
     237 
     238 
     239.. class:: ValueFilterString 
     240 
     241    Accepts the string values within (or without) the given interval. 
     242 
     243    .. attribute:: min, ref 
     244 
     245        Lower bound of the interval (``min`` and ``ref`` are aliases 
     246        for the same attribute. 
     247 
     248    .. attribute:: max 
     249 
     250        Upper bound of the interval. 
     251 
     252    .. attribute:: oper 
     253 
     254        Comparison operator; should be one of the following: 
     255        :obj:`ValueFilter.Equal`, :obj:`ValueFilter.Less`, 
     256        :obj:`ValueFilter.LessEqual`, :obj:`ValueFilter.Greater`, 
     257        :obj:`ValueFilter.GreaterEqual`, :obj:`ValueFilter.Between`, 
     258        :obj:`ValueFilter.Outside`, :obj:`Contains`, 
     259        :obj:`NotContains`, :obj:`BeginsWith`, :obj:`EndsWith`. 
     260 
     261        Fields ``min`` and ``max`` to define the interval for interval 
     262        operators (:obj:`ValueFilter.Between` and 
     263        :obj:`ValueFilter.Outside`), and ``ref`` (which is the same as 
     264        ``min``) for the others. 
     265     
     266    .. attribute:: case_sensitive 
     267 
     268        Tells whether the comparisons are case sensitive. Default is ``True``. 
     269 
     270.. class:: ValueFilterStringList 
     271 
     272    Accepts string values from the list. 
     273 
     274    .. attribute:: values 
     275 
     276        An list of accepted values. 
     277 
     278    .. attribute:: case_sensitive 
     279 
     280        Tells whether the comparisons are case sensitive. Default is ``True``. 
     281 
     282The following script selects instances whose age is "young" or "presbyopic" and 
    254283which are "astigmatic". Unknown values are ignored. If value for one of the 
    255284two features is missing, only the other is checked. If both are missing, 
    256285instance is accepted. 
     286 
     287.. literalinclude:: code/filter.py 
     288    :lines: 68-82 
    257289 
    258290The filter is first constructed and assigned a domain. Then both 
     
    272304.. literalinclude:: code/filter.py 
    273305    :lines: 129-141 
    274  
Note: See TracChangeset for help on using the changeset viewer.