def gen_parser(): parser = argparse.ArgumentParser( description='Learn a detection model. ' 'The ground-truth must be stored in ' 'annotations/ground_truth.csv.') ExpConf.gen_parser(parser) ClassificationConf.gen_parser(parser) factory = classifiers.get_factory() models = factory.get_methods() models.remove('AlreadyTrained') subparsers = parser.add_subparsers(dest='model_class') subparsers.required = True for model in models: model_parser = subparsers.add_parser(model) factory.gen_parser(model, model_parser) classifier_type = get_classifier_type(factory.get_class(model)) if classifier_type in [ClassifierType.supervised, ClassifierType.semisupervised]: AnnotationsConf.gen_parser( model_parser, required=False, message='CSV file containing the annotations of ' 'some or all the instances.') # Add subparser for already trained model already_trained = subparsers.add_parser('AlreadyTrained') factory.gen_parser('AlreadyTrained', already_trained) return parser
def gen_parser(): parser = argparse.ArgumentParser( description='Clustering of the data for data exploration.') ExpConf.gen_parser(parser) AnnotationsConf.gen_parser( parser, message='''CSV file containing the annotations of some instances, or GROUND_TRUTH to use the ground truth annotations stored in idents.csv. These annotations are used for semi-supervised projections.''') parser.add_argument( '--label', choices=['all', 'malicious', 'benign'], default='all', help='''The clustering is built from all the instances in the dataset, or only from the benign or malicious ones. By default, the clustering is built from all the instances. The malicious and benign instances are selected according to the ground-truth stored in idents.csv.''') subparsers = parser.add_subparsers(dest='algo') subparsers.required = True factory = clustering_conf.get_factory() for algo in factory.get_methods(): algo_parser = subparsers.add_parser(algo) factory.gen_parser(algo, algo_parser) return parser
def gen_parser(): parser = argparse.ArgumentParser(description='Features Analysis') ExpConf.gen_parser(parser, filters=False) AnnotationsConf.gen_parser( parser, required=True, message='CSV file containing the annotations of some or all' ' the instances.') return parser
def gen_parser(): parser = argparse.ArgumentParser( description='Rare Category Detection', formatter_class=argparse.RawTextHelpFormatter) ExpConf.gen_parser(parser, filters=True, sparse=True) AnnotationsConf.gen_parser( parser, default='init_annotations.csv', required=False, message='CSV file containing the initial annotations ' 'used to learn the first supervised detection ' 'model.') strategies_conf.get_factory().gen_parser('Rcd', parser) return parser
def gen_parser(): parser = argparse.ArgumentParser(description='Features Analysis') ExpConf.gen_parser(parser, filters=False, sparse=True) AnnotationsConf.gen_parser( parser, required=False, message='CSV file containing the annotations of some or ' 'all the instances.') parser.add_argument('--multiclass', default=False, action='store_true', help='The instances are grouped according to ' 'their families instead of their binary ' 'labels.') return parser
def gen_parser(): parser = argparse.ArgumentParser( description='Projection of the data for data visualization.') ExpConf.gen_parser(parser) AnnotationsConf.gen_parser( parser, message='CSV file containing the annotations of some' ' instances. These annotations are used for ' 'semi-supervised projections.') subparsers = parser.add_subparsers(dest='algo') subparsers.required = True for algo in projection_conf.get_factory().get_methods(): algo_parser = subparsers.add_parser(algo) projection_conf.get_factory().gen_parser(algo, algo_parser) return parser
def gen_parser(): parser = argparse.ArgumentParser( description='Active Learning', formatter_class=argparse.RawTextHelpFormatter) ExpConf.gen_parser(parser, filters=True, sparse=True) AnnotationsConf.gen_parser( parser, default=None, required=False, message='CSV file containing the initial annotations ' 'used to learn the first detection model.') subparsers = parser.add_subparsers(dest='strategy') subparsers.required = True strategies = strategies_conf.get_factory().get_methods() for strategy in strategies: strategy_parser = subparsers.add_parser(strategy) strategies_conf.get_factory().gen_parser(strategy, strategy_parser) return parser
def gen_parser(): parser = argparse.ArgumentParser( description='Projection of the data for data visualization.') ExpConf.gen_parser(parser) AnnotationsConf.gen_parser( parser, message='''CSV file containing the annotations of some instances, or GROUND_TRUTH to use the ground truth annotations stored in idents.csv. These annotations are used for semi-supervised projections and are displayed in the GUI.''') subparsers = parser.add_subparsers(dest='algo') subparsers.required = True for algo in projection_conf.get_factory().get_methods(): algo_parser = subparsers.add_parser(algo) projection_conf.get_factory().gen_parser(algo, algo_parser) return parser
def gen_parser(): parser = argparse.ArgumentParser( description='Train and evaluate a detection ' 'model. ') ExpConf.gen_parser(parser, sparse=True) parser.add_argument('--no-training-detection', action='store_true', default=False, help='''When specified, the detection model is not applied to the training instances. ''') factory = classifiers.get_factory() models = factory.get_methods() models.remove('AlreadyTrained') subparsers = parser.add_subparsers(dest='model_class') subparsers.required = True for model in models: model_parser = subparsers.add_parser(model) factory.gen_parser(model, model_parser) classifier_type = get_classifier_type(factory.get_class(model)) if classifier_type in [ ClassifierType.supervised, ClassifierType.semisupervised ]: default = None message = '''CSV file containing the annotations of some instances, or GROUND_TRUTH to use the ground truth annotations stored in idents.csv. ''' if classifier_type == ClassifierType.supervised: default = 'GROUND_TRUTH' message = '%s Default: GROUND_TRUTH.' % message AnnotationsConf.gen_parser(model_parser, required=default is None, default=default, message=message) ClassificationConf.gen_parser(model_parser) AlertsConf.gen_parser(model_parser) # Add subparser for already trained model already_trained = subparsers.add_parser('AlreadyTrained') factory.gen_parser('AlreadyTrained', already_trained) ClassificationConf.gen_parser(already_trained) AlertsConf.gen_parser(already_trained) return parser