Beispiel #1
0
 def fromJson(obj, session):
     experiment = ActiveLearningExperiment(obj['project'], obj['dataset'], session)
     Experiment.expParamFromJson(experiment, obj)
     experiment.labeling_method  = obj['labeling_method']
     experiment.conf = ActiveLearningConfFactory.getFactory().fromJson(
             obj['conf'], experiment)
     return experiment
Beispiel #2
0
 def setExperimentFromArgs(self, args):
     self.setFeaturesFilenames(args.features_files)
     factory = ActiveLearningConfFactory.getFactory()
     active_learning_conf = factory.fromArgs('RareCategoryDetection', args, self)
     self.setConfiguration(active_learning_conf)
     self.initLabels(args.init_labels_file)
     self.export()
Beispiel #3
0
 def generateParser():
     parser = argparse.ArgumentParser(description = 'Rare Category Detection',
             formatter_class = argparse.RawTextHelpFormatter)
     ActiveLearningExperiment.projectDatasetFeturesParser(parser)
     factory = ActiveLearningConfFactory.getFactory()
     factory.generateParser('RareCategoryDetection', parser)
     return parser
Beispiel #4
0
 def setExperimentFromArgs(self, args):
     self.setFeaturesFilenames(args.features_files)
     factory = ActiveLearningConfFactory.getFactory()
     active_learning_conf = factory.fromArgs(args.strategy, args, self)
     self.setConfiguration(active_learning_conf)
     self.checkInputParams()
     self.initLabels(args.init_labels_file)
     self.export()
 def fromJson(obj, db, cursor):
     experiment = ActiveLearningExperiment(obj['project'], obj['dataset'], db, cursor)
     Experiment.expParamFromJson(experiment, obj)
     experiment.labeling_method  = obj['labeling_method']
     # Validation configuration
     experiment.validation_conf = None
     if obj['validation_conf'] is not None:
         experiment.validation_conf = TestConfiguration.fromJson(obj['validation_conf'], experiment)
     experiment.conf = ActiveLearningConfFactory.getFactory().fromJson(obj['conf'], experiment)
     return experiment
Beispiel #6
0
 def generateParser():
     parser = argparse.ArgumentParser(description = 'Active Learning',
             formatter_class = argparse.RawTextHelpFormatter)
     Experiment.projectDatasetFeturesParser(parser)
     strategies = ['Ilab', 'RandomSampling', 'UncertaintySampling',
                   'CesaBianchi', 'Aladin', 'Gornitz']
     subparsers = parser.add_subparsers(dest = 'strategy')
     factory = ActiveLearningConfFactory.getFactory()
     for strategy in strategies:
         strategy_parser = subparsers.add_parser(strategy)
         factory.generateParser(strategy, strategy_parser)
     return parser