Changeset 7907:b2ef36b62da1 in orange


Ignore:
Timestamp:
05/17/11 14:11:34 (3 years ago)
Author:
matija <matija.polajnar@…>
Branch:
default
Convert:
fe9250880cd62d581c880630c052e0180727e712
Message:

orngLinProj refactoring, (really) closes ticket #750.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/projection/linear.py

    r7905 r7907  
    5151 
    5252.. autoclass:: Orange.projection.linear.FreeVizClassifier 
     53   :members: 
     54   :show-inheritance: 
     55 
     56.. autoclass:: Orange.projection.linear.S2NHeuristicLearner 
    5357   :members: 
    5458   :show-inheritance: 
     
    866870# class that represents freeviz classifier 
    867871class FreeVizClassifier(Orange.core.Classifier): 
     872    """ 
     873    A kNN classifier on the 2D projection of the data, optimized by FreeViz. 
     874     
     875    Usually the learner 
     876    (:class:`Orange.projection.linear.FreeVizLearner`) is used to construct the 
     877    classifier. 
     878     
     879    When constructing the classifier manually, the following parameters can 
     880    be passed: 
     881     
     882    :param data: table of data instances to project to a 2D plane and use for 
     883        classification. 
     884    :type data: :class:`Orange.data.Table` 
     885     
     886    :param freeviz: the FreeViz algorithm instance to use to optimize the 2D 
     887        projection. 
     888    :type freeviz: :class:`Orange.projection.linear.FreeViz` 
     889     
     890    """ 
     891     
    868892    def __init__(self, data, freeviz): 
    869893        self.freeviz = freeviz 
     
    919943FreeVizClassifier = deprecated_members({"FreeViz":"freeviz"})(FreeVizClassifier) 
    920944 
    921 class FreeVizLearner(Orange.core.Learner): 
     945class FreeVizLearner(Orange.classification.Learner): 
     946    """ 
     947    A learner that builds a :class:`FreeVizClassifier` on given data. An 
     948    instance of :class:`FreeViz` can be passed to the constructor as a 
     949    keyword argument :obj:`freeviz`.     
     950 
     951    If data instances are provided to the constructor, the learning algorithm 
     952    is called and the resulting classifier is returned instead of the learner. 
     953     
     954    """ 
     955    def __new__(cls, instances = None, weight_id = 0, **argkw): 
     956        self = Orange.classification.Learner.__new__(cls, **argkw) 
     957        if instances: 
     958            self.__init__(**argkw) 
     959            return self.__call__(instances, weight_id) 
     960        else: 
     961            return self 
     962 
    922963    def __init__(self, freeviz = None): 
    923964        if not freeviz: 
     
    933974 
    934975 
    935 class S2NHeuristicLearner(Orange.core.Learner): 
     976class S2NHeuristicLearner(Orange.classification.Learner): 
     977    """ 
     978    This class is not documented yet. 
     979     
     980    """ 
     981    def __new__(cls, instances = None, weight_id = 0, **argkw): 
     982        self = Orange.classification.Learner.__new__(cls, **argkw) 
     983        if instances: 
     984            self.__init__(**argkw) 
     985            return self.__call__(instances, weight_id) 
     986        else: 
     987            return self 
     988 
    936989    def __init__(self, freeviz = None): 
    937990        if not freeviz: 
Note: See TracChangeset for help on using the changeset viewer.