예제 #1
0
 def from_args(args):
     secuml_conf = ExpConf.common_from_args(args)
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     annotations_conf = AnnotationsConf(args.annotations_file, None,
                                        secuml_conf.logger)
     core_conf = projection_conf.get_factory().from_args(args.algo, args,
                                                         secuml_conf.logger)
     return ProjectionConf(secuml_conf, dataset_conf, features_conf,
                           annotations_conf, core_conf, name=args.exp_name)
예제 #2
0
 def from_args(args):
     secuml_conf = ExpConf.secuml_conf_from_args(args)
     logger = secuml_conf.logger
     dataset_conf = DatasetConf.from_args(args, logger)
     features_conf = FeaturesConf.from_args(args, logger)
     annotations_conf = AnnotationsConf(args.annotations_file, None, logger)
     core_conf = strategies_conf.get_factory().from_args('Rcd', args,
                                                         logger)
     return RcdConf(secuml_conf, dataset_conf, features_conf,
                    annotations_conf, core_conf, name=args.exp_name)
예제 #3
0
 def from_args(args):
     secuml_conf = ExpConf.common_from_args(args)
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     annotations_conf = AnnotationsConf(args.annotations_file, None,
                                        secuml_conf.logger)
     return FeaturesAnalysisConf(secuml_conf,
                                 dataset_conf,
                                 features_conf,
                                 annotations_conf,
                                 None,
                                 name=args.exp_name)
예제 #4
0
 def from_args(args):
     secuml_conf = ExpConf.secuml_conf_from_args(args)
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     annotations_conf = AnnotationsConf(args.annotations_file, None,
                                        secuml_conf.logger)
     core_conf = strategies_conf.get_factory().from_args(args.strategy,
                                                         args,
                                                         secuml_conf.logger)
     return ActiveLearningConf(secuml_conf, dataset_conf, features_conf,
                               annotations_conf, core_conf,
                               name=args.exp_name)
예제 #5
0
 def from_args(args):
     secuml_conf = ExpConf.common_from_args(args)
     already_trained = None
     core_conf = ClassificationConf.from_args(args, secuml_conf.logger)
     if args.model_class != 'AlreadyTrained':
         annotations_conf = AnnotationsConf(args.annotations_file, None,
                                            secuml_conf.logger)
     else:
         already_trained = args.model_exp_id
         annotations_conf = AnnotationsConf(None, None, secuml_conf.logger)
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     return DiademConf(secuml_conf, dataset_conf, features_conf,
                       annotations_conf, core_conf, name=args.exp_name,
                       already_trained=already_trained)
예제 #6
0
 def from_args(args):
     secuml_conf = ExpConf.secuml_conf_from_args(args)
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     annotations_conf = AnnotationsConf(args.annotations_file, None,
                                        secuml_conf.logger)
     core_conf = clustering_conf.get_factory().from_args(
         args.algo, args, secuml_conf.logger)
     conf = ClusteringConf(secuml_conf,
                           dataset_conf,
                           features_conf,
                           annotations_conf,
                           core_conf,
                           name=args.exp_name,
                           label=args.label)
     return conf
예제 #7
0
 def from_args(args):
     secuml_conf = ExpConf.secuml_conf_from_args(args)
     classif_conf = ClassificationConf.from_args(args, secuml_conf.logger)
     model_class = classifiers.get_factory().get_class(args.model_class)
     classifier_type = get_classifier_type(model_class)
     if classifier_type in [
             ClassifierType.supervised, ClassifierType.semisupervised
     ]:
         annotations_conf = AnnotationsConf(args.annotations_file, None,
                                            secuml_conf.logger)
     else:
         annotations_conf = AnnotationsConf(None, None, secuml_conf.logger)
     already_trained = None
     if args.model_class == 'AlreadyTrained':
         already_trained = args.model_exp_id
     alerts_conf = AlertsConf.from_args(args, secuml_conf.logger)
     if (classifier_type == ClassifierType.unsupervised
             and alerts_conf.classifier_conf is not None):
         raise InvalidInputArguments('Supervised classification of the '
                                     'alerts is not supported for '
                                     'unsupervised model classes. ')
     if classif_conf.classifier_conf.multiclass:
         if alerts_conf.with_analysis():
             raise InvalidInputArguments('Alerts analysis is not supported '
                                         'for multiclass models. ')
         else:
             alerts_conf = None
     if (classif_conf.test_conf.method == 'dataset'
             and classif_conf.test_conf.streaming
             and alerts_conf.with_analysis()):
         raise InvalidInputArguments('Alerts analysis is not supported '
                                     'in streaming mode. ')
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     if (features_conf.sparse
             and not classif_conf.classifier_conf.accept_sparse):
         raise InvalidInputArguments('%s does not support sparse '
                                     'features. ' % args.model_class)
     return DiademConf(secuml_conf,
                       dataset_conf,
                       features_conf,
                       annotations_conf,
                       classif_conf,
                       alerts_conf,
                       name=args.exp_name,
                       already_trained=already_trained,
                       no_training_detection=args.no_training_detection)
예제 #8
0
파일: conf.py 프로젝트: will3b/SecuML
 def from_args(args):
     if args.annotations_file is None and args.multiclass:
         raise InvalidInputArguments('--annotations <file> is required. '
                                     'An annotation file must be specified '
                                     'to group the instances according to '
                                     'their families.')
     secuml_conf = ExpConf.secuml_conf_from_args(args)
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     annotations_conf = AnnotationsConf(args.annotations_file, None,
                                        secuml_conf.logger)
     return FeaturesAnalysisConf(secuml_conf,
                                 dataset_conf,
                                 features_conf,
                                 annotations_conf,
                                 args.multiclass,
                                 name=args.exp_name)
예제 #9
0
 def from_args(args):
     secuml_conf = ExpConf.secuml_conf_from_args(args)
     classif_conf = ClassificationConf.from_args(args, secuml_conf.logger)
     model_class = classifiers.get_factory().get_class(args.model_class)
     classifier_type = get_classifier_type(model_class)
     if classifier_type in [ClassifierType.supervised,
                            ClassifierType.semisupervised]:
         annotations_conf = AnnotationsConf(args.annotations_file, None,
                                            secuml_conf.logger)
     else:
         annotations_conf = AnnotationsConf(None, None, secuml_conf.logger)
     already_trained = None
     if args.model_class == 'AlreadyTrained':
         already_trained = args.model_exp_id
     dataset_conf = DatasetConf.from_args(args, secuml_conf.logger)
     features_conf = FeaturesConf.from_args(args, secuml_conf.logger)
     return DiademConf(secuml_conf, dataset_conf, features_conf,
                       annotations_conf, classif_conf, name=args.exp_name,
                       already_trained=already_trained)