Changeset 7343:ee2106898232 in orange


Ignore:
Timestamp:
02/03/11 22:33:19 (3 years ago)
Author:
anze <anze.staric@…>
Branch:
default
Convert:
04a5b9cbfd00e764f57a7e8f7a1ea0fd942f2dcc
Message:

corrected some references to old orange.* modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/classification/bayes.py

    r7269 r7343  
    99.. autoclass:: Orange.classification.bayes.NaiveBayesLearner 
    1010   :members: 
    11     
     11  
    1212.. autoclass:: Orange.classification.bayes.NaiveBayesClassifier 
    1313   :members: 
     
    142142    is called and the resulting classifier is returned instead of the learner. 
    143143     
    144     :param adjustTreshold: If set and the class is binary, the classifier's 
     144    :param adjustTreshold: sets the corresponding attribute 
     145    :type adjustTreshold: boolean 
     146    :param m: sets the estimatorConstructor to \ 
     147    :class:`orange.ProbabilityEstimatorConstructor_m` with specified m  
     148    :type m: integer 
     149    :param estimatorConstructor: sets the corresponding attribute 
     150    :type estimatorConstructor: orange.ProbabilityEstimatorConstructor 
     151    :param conditionalEstimatorConstructor: sets the corresponding attribute 
     152    :type conditionalEstimatorConstructor: 
     153            :class:`orange.ConditionalProbabilityEstimatorConstructor` 
     154    :param conditionalEstimatorConstructorContinuous: sets the corresponding 
     155            attribute 
     156    :type conditionalEstimatorConstructorContinuous:  
     157            :class:`orange.ConditionalProbabilityEstimatorConstructor` 
     158    :rtype: :class:`Orange.classification.bayes.NaiveBayesLearner` or 
     159            :class:`Orange.classification.bayes.NaiveBayesClassifier`  
     160     
     161    All attributes can also be set as constructor parameters. 
     162     
     163    :var adjustTreshold: If set and the class is binary, the classifier's 
    145164            threshold will be set as to optimize the classification accuracy. 
    146165            The threshold is tuned by observing the probabilities predicted on 
    147166            learning data. Setting it to True can increase the 
    148             accuracy considerably. 
    149     :type adjustTreshold: boolean 
    150     :param m: m for m-estimate. If set, m-estimation of probabilities 
     167            accuracy considerably 
     168    :var m: m for m-estimate. If set, m-estimation of probabilities 
    151169            will be used using :class:`orange.ProbabilityEstimatorConstructor_m` 
    152170            This attribute is ignored if you also set estimatorConstructor. 
    153     :type m: integer 
    154     :param estimatorConstructor: Probability estimator constructor for 
     171    :var estimatorConstructor: Probability estimator constructor for 
    155172            prior class probabilities. Defaults to 
    156             :`class:orange.ProbabilityEstimatorConstructor_relative` 
     173            :class:`orange.ProbabilityEstimatorConstructor_relative` 
    157174            Setting this attribute disables the above described attribute m. 
    158     :type estimatorConstructor: orange.ProbabilityEstimatorConstructor 
    159     :param conditionalEstimatorConstructor: Probability estimator constructor 
     175    :var conditionalEstimatorConstructor: Probability estimator constructor 
    160176            for conditional probabilities for discrete features. If omitted, 
    161177            the estimator for prior probabilities will be used. 
    162     :type conditionalEstimatorConstructor: orange.ConditionalProbabilityEstimatorConstructor 
    163     :param conditionalEstimatorConstructorContinuous: Probability estimator constructor 
    164             for conditional probabilities for continuous features. Defaults to 
    165             :class:`orange.ConditionalProbabilityEstimatorConstructor_loess` 
    166     :type conditionalEstimatorConstructorContinuous: orange.ConditionalProbabilityEstimatorConstructor 
    167     :rtype: :class:`Orange.classification.bayes.NaiveBayesLearner` or 
    168             :class:`Orange.classification.bayes.NaiveBayesClassifier`  
     178    :var conditionalEstimatorConstructorContinuous: Probability estimator 
     179            constructor for conditional probabilities for continuous features. 
     180            Defaults to  
     181            :class:`orange.ConditionalProbabilityEstimatorConstructor_loess`  
    169182    """ 
    170183     
     
    209222            bayes.conditionalEstimatorConstructor = self.conditionalEstimatorConstructor 
    210223        else: 
    211             bayes.conditionalEstimatorConstructor = orange.ConditionalProbabilityEstimatorConstructor_ByRows() 
     224            bayes.conditionalEstimatorConstructor = Orange.core.ConditionalProbabilityEstimatorConstructor_ByRows() 
    212225            bayes.conditionalEstimatorConstructor.estimatorConstructor=bayes.estimatorConstructor 
    213226             
     
    219232class NaiveBayesClassifier(Orange.core.Classifier): 
    220233    """ 
    221     Wrapps a native BayesClassifier to add print method 
    222     :param: 
     234    Predictor based on calculated probabilities 
     235     
     236    :param baseClassifier: 
     237    :type: 
     238     
     239    :var distribution: Stores probabilities of classes, i.e. p(C) for each 
     240            class C. 
     241    :var estimator: An object that returns a probability of class p(C) for a 
     242            given class C. 
     243    :var conditionalDistributions: A list of conditional probabilities. 
     244    :var conditionalEstimators: A list of estimators for conditional 
     245            probabilities 
     246    :var normalize: Tells whether the returned probabilities should be 
     247            normalized (default: True) 
     248    :var adjustThreshold: For binary classes, this tells the learner to 
     249            determine the optimal threshold probability according to 0-1 
     250            loss on the training set. For multiple class problems, it has 
     251            no effect. 
    223252    """ 
    224253     
    225     def __init__(self, nativeBayesClassifier): 
    226         self.nativeBayesClassifier = nativeBayesClassifier 
     254    def __init__(self, baseClassifier=None): 
     255        if not baseClassifier: baseClassifier = _BayesClassifier() 
     256        self.nativeBayesClassifier = baseClassifier 
    227257        for k, v in self.nativeBayesClassifier.__dict__.items(): 
    228258            self.__dict__[k] = v 
Note: See TracChangeset for help on using the changeset viewer.