コード例 #1
0
 def createNaiveBayesConf(self):
     exp = self.experiment
     name = '-'.join([
         'AL' + str(exp.experiment_id),
         'Iter' + str(self.iteration.iteration_number), 'all', 'NaiveBayes'
     ])
     naive_bayes_exp = ClassificationExperiment(exp.secuml_conf,
                                                session=exp.session)
     naive_bayes_exp.initExperiment(exp.project,
                                    exp.dataset,
                                    experiment_name=name,
                                    parent=exp.experiment_id)
     test_conf = UnlabeledLabeledConf(logger=exp.logger)
     naive_bayes_conf = GaussianNaiveBayesConfiguration(
         exp.conf.models_conf['multiclass'].n_jobs,
         exp.conf.models_conf['multiclass'].num_folds,
         False,
         True,
         test_conf,
         logger=exp.logger)
     naive_bayes_exp.setConf(naive_bayes_conf,
                             exp.features_filename,
                             annotations_id=exp.annotations_id)
     naive_bayes_exp.export()
     return naive_bayes_conf
コード例 #2
0
 def createNaiveBayesConf(self):
     test_conf = UnlabeledLabeledConf(logger=self.conf.logger)
     naive_bayes_conf = GaussianNaiveBayesConfiguration(
                                         4,
                                         False,
                                         True,
                                         test_conf,
                                         logger=self.conf.logger)
     return naive_bayes_conf
コード例 #3
0
def gornitzBinaryModelConf(logger):
    classifier_args = {}
    classifier_args['num_folds'] = 4
    classifier_args['sample_weight'] = False
    classifier_args['families_supervision'] = False
    test_conf = UnlabeledLabeledConf()
    classifier_args['test_conf'] = test_conf
    binary_model_conf = ClassifierConfFactory.getFactory().fromParam(
        'Sssvdd', classifier_args, logger=logger)
    return binary_model_conf
コード例 #4
0
 def generateParamsFromArgs(args):
     supervised_args = {}
     supervised_args['num_folds'] = 4
     supervised_args['sample_weight'] = False
     supervised_args['families_supervision'] = False
     test_conf = UnlabeledLabeledConf()
     supervised_args['test_conf'] = test_conf
     binary_model_conf = ClassifierConfFactory.getFactory().fromParam(
         'Sssvdd', supervised_args)
     params = ActiveLearningConfiguration.generateParamsFromArgs(
         args, binary_model_conf=binary_model_conf)
     params['batch'] = args.batch
     return params
コード例 #5
0
ファイル: AlertsMonitoring.py プロジェクト: wtbsw/SecuML
 def getMulticlassModel(self):
     params = {}
     params['num_folds'] = 4
     params['sample_weight'] = False
     params['families_supervision'] = True
     params['optim_algo'] = 'liblinear'
     params['alerts_conf'] = None
     test_conf = UnlabeledLabeledConf(logger=self.alerts_conf.logger)
     params['test_conf'] = test_conf
     conf = ClassifierConfFactory.getFactory().fromParam(
         'LogisticRegression', params, logger=self.alerts_conf.logger)
     model = conf.model_class(conf)
     return model
コード例 #6
0
ファイル: AladinConfiguration.py プロジェクト: wtbsw/SecuML
 def generateParamsFromArgs(args, logger=None):
     supervised_args = {}
     supervised_args['num_folds'] = 4
     supervised_args['sample_weight'] = False
     supervised_args['families_supervision'] = False
     test_conf = UnlabeledLabeledConf(logger=logger)
     supervised_args['test_conf'] = test_conf
     binary_model_conf = ClassifierConfFactory.getFactory().fromParam(
         'LogisticRegression', supervised_args, logger=logger)
     params = ActiveLearningConfiguration.generateParamsFromArgs(
         args, binary_model_conf=binary_model_conf, logger=logger)
     params['num_annotations'] = args.num_annotations
     return params
コード例 #7
0
ファイル: AladinConfiguration.py プロジェクト: wtbsw/SecuML
def aladinMulticlassModelConf(logger):
    classifier_args = {}
    classifier_args['num_folds'] = 4
    classifier_args['sample_weight'] = False
    classifier_args['families_supervision'] = True
    classifier_args['alerts_conf'] = None
    classifier_args['optim_algo'] = 'liblinear'
    test_conf = UnlabeledLabeledConf(logger=logger)
    classifier_args['test_conf'] = test_conf
    factory = ClassifierConfFactory.getFactory()
    multiclass_model_conf = factory.fromParam('LogisticRegression',
                                              classifier_args,
                                              logger=logger)
    return multiclass_model_conf
コード例 #8
0
 def generateParamsFromArgs(args):
     params = ActiveLearningConfiguration.generateParamsFromArgs(args)
     multiclass_classifier_args = {}
     multiclass_classifier_args['num_folds'] = args.num_folds
     multiclass_classifier_args['sample_weight'] = False
     multiclass_classifier_args['families_supervision'] = True
     multiclass_classifier_args['alerts_conf'] = None
     test_conf = UnlabeledLabeledConf()
     multiclass_classifier_args['test_conf'] = test_conf
     multiclass_conf = ClassifierConfFactory.getFactory().fromParam(
         args.model_class, multiclass_classifier_args)
     rare_category_detection_conf = RareCategoryDetectionStrategy(multiclass_conf,
                                                                  args.cluster_strategy, args.num_annotations, 'uniform')
     params['rare_category_detection_conf'] = rare_category_detection_conf
     params['num_annotations'] = args.num_annotations
     params['multiclass_model_conf'] = multiclass_conf
     return params
コード例 #9
0
 def generateParamsFromArgs(args):
     params = ActiveLearningConfiguration.generateParamsFromArgs(args)
     multiclass_classifier_args = {}
     multiclass_classifier_args['num_folds'] = args.num_folds
     multiclass_classifier_args['sample_weight'] = False
     multiclass_classifier_args['families_supervision'] = True
     multiclass_classifier_args['optim_algo'] = 'liblinear'
     test_conf = UnlabeledLabeledConf()
     multiclass_classifier_args['test_conf'] = test_conf
     multiclass_conf = ClassifierConfFactory.getFactory().fromParam(
         'LogisticRegression', multiclass_classifier_args)
     rare_category_detection_conf = RareCategoryDetectionStrategy(multiclass_conf,
                                                                  args.cluster_strategy, args.num_annotations, 'uniform')
     params['rare_category_detection_conf'] = rare_category_detection_conf
     params['num_uncertain'] = args.num_uncertain
     params['eps'] = 0.49
     return params
コード例 #10
0
ファイル: CategoriesExp.py プロジェクト: nguyenhoaihuy/SecuML
 def getNaiveBayesConf(self):
     exp = self.experiment
     name = '-'.join([
         'AL' + str(exp.experiment_id),
         'Iter' + str(self.iteration.iteration_number), 'all', 'NaiveBayes'
     ])
     naive_bayes_exp = ClassificationExperiment(exp.project,
                                                exp.dataset,
                                                exp.session,
                                                experiment_name=name,
                                                parent=exp.experiment_id)
     test_conf = UnlabeledLabeledConf()
     naive_bayes_conf = GaussianNaiveBayesConfiguration(
         exp.conf.num_folds, False, True, test_conf)
     naive_bayes_exp.setConf(naive_bayes_conf,
                             exp.features_filename,
                             annotations_id=exp.annotations_id)
     naive_bayes_exp.export()
     return naive_bayes_conf
コード例 #11
0
    def generateParamsFromArgs(args, binary_model_conf=None):
        if binary_model_conf is None:
            supervised_args = {}
            supervised_args['num_folds'] = args.num_folds
            supervised_args['sample_weight'] = args.sample_weight
            supervised_args['families_supervision'] = False
            supervised_args['test_conf'] = UnlabeledLabeledConf()
            binary_model_conf = ClassifierConfFactory.getFactory().fromParam(
                args.model_class, supervised_args)

        active_learning_params = {}
        active_learning_params['auto'] = args.auto
        active_learning_params['budget'] = args.budget
        active_learning_params['binary_model_conf'] = binary_model_conf

        validation_conf = None
        if args.validation_dataset is not None:
            validation_conf = ValidationDatasetConf(args.validation_dataset)
        active_learning_params['validation_conf'] = validation_conf

        return active_learning_params
コード例 #12
0
 def getNaiveBayesConf(self):
     test_conf = UnlabeledLabeledConf()
     naive_bayes_conf = GaussianNaiveBayesConfiguration(
         4, False, True, test_conf)
     return naive_bayes_conf