Example #1
0
    def __init__(self, imbalance_upsampling=None, class_weight=None, method=None, random_state=1, log=None):
        """
        Construtor

        :param imbalance_upsampling:    Use upsampling to compensate imbalanced dataset
        :param class_weight:            Use class_weight to compensate imbalanced dataset
        :param method:                  [Optional] Ensemble method
        :param random_state:            Random state
        :param log:                     Log
        """
        MlModelCommon.__init__(self,
                               imbalance_upsampling=imbalance_upsampling,
                               class_weight=class_weight,
                               method=method,
                               log=log)
        #
        #   GaussianNB does not support class_weight
        #
        if method == "Bagging":
            model = GaussianNB()
            self.ensemble_method = BaggingClassifier(base_estimator=model,
                                                     n_estimators=100,
                                                     random_state=random_state)
        elif method == "Adaptive Boosting":
            model = GaussianNB()
            self.ensemble_method = AdaBoostClassifier(base_estimator=model,
                                                      n_estimators=100,
                                                      random_state=random_state)
        else:
            self.ensemble_method = None
            GaussianNB.__init__(self)
Example #2
0
 def __init__(self, priors=None):
     GaussianNB.__init__(self, priors)
Example #3
0
 def __init__(self):
     GaussianNB.__init__(self)
     self.equivalent={'means':'theta_',
                      'stddevs':'sigma_',
                      'fraction':'class_prior_'}
Example #4
0
 def __init__(self, priors=None):
     _skGaussianNB.__init__(self, priors)
     BaseWrapperClf.__init__(self)