Пример #1
0
        return conf

    def toJson(self):
        conf = ClassifierConfiguration.toJson(self)
        conf['__type__'] = 'SvcConfiguration'
        conf['c'] = self.c.toJson()
        return conf

    def probabilistModel(self):
        return False

    def semiSupervisedModel(self):
        return False

    def featureCoefficients(self):
        return True

    @staticmethod
    def generateParser(parser):
        classifier_group = ClassifierConfiguration.generateParser(parser)

    @staticmethod
    def generateParamsFromArgs(args, experiment):
        params = ClassifierConfiguration.generateParamsFromArgs(
            args, experiment)
        return params


ClassifierConfFactory.getFactory().registerClass('SvcConfiguration',
                                                 SvcConfiguration)
                            help=help_message)
        parser.add_argument('--min-impurity-decrease',
                            type=float,
                            default=0,
                            help=help_message)
        parser.add_argument('--presort', type=bool, default=True)

    @staticmethod
    def generateParamsFromArgs(args, experiment):
        params = ClassifierConfiguration.generateParamsFromArgs(
            args, experiment)
        params['sample_weight'] = args.sample_weight
        params['loss'] = args.loss
        params['learning_rate'] = args.learning_rate
        params['n_estimators'] = args.n_estimators
        params['max_features'] = args.max_features
        params['criterion'] = args.criterion
        params['max_depth'] = args.max_depth
        params['min_samples_split'] = args.min_samples_split
        params['subsample'] = args.subsample
        params['min_samples_leaf'] = args.min_samples_leaf
        params['min_weight_fraction_leaf'] = args.min_weight_fraction_leaf
        params['max_leaf_nodes'] = args.max_leaf_nodes
        params['min_impurity_decrease'] = args.min_impurity_decrease
        params['presort'] = args.presort
        return params


ClassifierConfFactory.getFactory().registerClass(
    'GradientBoostingConfiguration', GradientBoostingConfiguration)
Пример #3
0
        conf['penalty'] = self.penalty.toJson()
        return conf

    def probabilistModel(self):
        return True

    def semiSupervisedModel(self):
        return False

    def featureCoefficients(self):
        return not (self.families_supervision)

    @staticmethod
    def generateParser(parser):
        ClassifierConfiguration.generateParser(parser)
        parser.add_argument('--optim-algo',
                            choices=['sag', 'liblinear'],
                            default='liblinear',
                            help='sag is recommended for large datasets.')

    @staticmethod
    def generateParamsFromArgs(args, experiment):
        params = ClassifierConfiguration.generateParamsFromArgs(
            args, experiment)
        params['optim_algo'] = args.optim_algo
        return params


ClassifierConfFactory.getFactory().registerClass(
    'LogisticRegressionConfiguration', LogisticRegressionConfiguration)
Пример #4
0
    def setBestValues(self, grid_search):
        return

    def getBestValues(self):
        return None

    @staticmethod
    def fromJson(obj, exp):
        conf = LabelPropagationConfiguration(obj['num_folds'],
                                             obj['families_supervision'])
        ClassifierConfiguration.setTestConfiguration(conf, obj, exp)
        return conf

    def toJson(self):
        conf = ClassifierConfiguration.toJson(self)
        conf['__type__'] = 'LabelPropagationConfiguration'
        return conf

    def probabilistModel(self):
        return True

    def semiSupervisedModel(self):
        return True

    def featureCoefficients(self):
        return False


ClassifierConfFactory.getFactory().registerClass(
    'LabelPropagationConfiguration', LabelPropagationConfiguration)
                            type=int,
                            default=None,
                            help=help_message)
        parser.add_argument('--max-leaf_nodes',
                            type=int,
                            default=None,
                            help=help_message)
        parser.add_argument('--min-impurity-decrease',
                            type=float,
                            default=0,
                            help=help_message)

    @staticmethod
    def generateParamsFromArgs(args, experiment):
        params = ClassifierConfiguration.generateParamsFromArgs(
            args, experiment)
        params['criterion'] = args.criterion
        params['splitter'] = args.splitter
        params['max_depth'] = args.max_depth
        params['min_samples_split'] = args.min_samples_split
        params['min_samples_leaf'] = args.min_samples_leaf
        params['min_weight_fraction_leaf'] = args.min_weight_fraction_leaf
        params['max_features'] = args.max_features
        params['max_leaf_nodes'] = args.max_leaf_nodes
        params['min_impurity_decrease'] = args.min_impurity_decrease
        return params


ClassifierConfFactory.getFactory().registerClass('DecisionTreeConfiguration',
                                                 DecisionTreeConfiguration)
                            type=int,
                            default=None,
                            help=help_message)
        parser.add_argument('--min-impurity-decrease',
                            type=float,
                            default=0,
                            help=help_message)
        parser.add_argument('--bootstrap', type=bool, default=True)
        parser.add_argument('--oob-score', type=bool, default=False)

    @staticmethod
    def generateParamsFromArgs(args, experiment):
        params = ClassifierConfiguration.generateParamsFromArgs(
            args, experiment)
        params['n_estimators'] = args.n_estimators
        params['criterion'] = args.criterion
        params['max_features'] = args.max_features
        params['max_depth'] = args.max_depth
        params['min_samples_split'] = args.min_samples_split
        params['min_samples_leaf'] = args.min_samples_leaf
        params['min_weight_fraction_leaf'] = args.min_weight_fraction_leaf
        params['max_leaf_nodes'] = args.max_leaf_nodes
        params['min_impurity_decrease'] = args.min_impurity_decrease
        params['bootstrap'] = args.bootstrap
        params['oob_score'] = args.oob_score
        return params


ClassifierConfFactory.getFactory().registerClass('RandomForestConfiguration',
                                                 RandomForestConfiguration)
        conf = GaussianNaiveBayesConfiguration(obj['num_folds'], obj['sample_weight'],
                                               obj['families_supervision'], test_conf)
        ClassifierConfiguration.setTestConfiguration(conf, obj, exp)
        return conf

    def toJson(self):
        conf = ClassifierConfiguration.toJson(self)
        conf['__type__'] = 'GaussianNaiveBayesConfiguration'
        return conf

    def probabilistModel(self):
        return True

    def semiSupervisedModel(self):
        return False

    def featureCoefficients(self):
        return False

    @staticmethod
    def generateParser(parser):
        classifier_group = ClassifierConfiguration.generateParser(parser)

    @staticmethod
    def generateParamsFromArgs(args, experiment):
        params = ClassifierConfiguration.generateParamsFromArgs(args, experiment)
        return params

ClassifierConfFactory.getFactory().registerClass('GaussianNaiveBayesConfiguration',
        GaussianNaiveBayesConfiguration)