Exemple #1
0
    def _cs_impl(cls):
        # todo: set random seed; set 'cache_size'
        kernel_linear = Node({"kernel": FixedP("linear")})

        kernel_poly = Node(
            {
                "kernel": FixedP("poly"),
                "degree": IntP(uniform, low=0, high=10),
                "coef0": RealP(uniform, low=0.0, high=100),
            }
        )

        kernel_rbf = Node({"kernel": FixedP("rbf")})

        kernel_sigmoid = Node({"kernel": FixedP("sigmoid"), "coef0": RealP(uniform, low=0.0, high=100),})

        kernel_nonlinear = Node(
            {"gamma": RealP(uniform, low=0.00001, high=100)}, children=[kernel_poly, kernel_rbf, kernel_sigmoid],
        )

        top = Node(
            {
                "C": RealP(uniform, low=1e-4, high=100),
                "shrinking": CatP(choice, items=[True, False]),
                "probability": FixedP(False),
                "tol": OrdP(choice, items=[0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000,],),
                "class_weight": CatP(choice, items=[None, "balanced"]),
                # 'verbose': [False],
                "max_iter": FixedP(1000000),
                "decision_function_shape": CatP(choice, items=["ovr", "ovo"]),
            },
            children=[kernel_linear, kernel_nonlinear],
        )

        return CS(nodes=[top])
Exemple #2
0
 def _cs_impl(cls):
     # TODO target and prediction
     params = {
         'function': CatP(choice, items=cls.names()),
         'target': CatP(choice, items=['Y']),
         'prediction': CatP(choice, items=['Z'])
     }
     return TransformerCS(Node(params=params))
Exemple #3
0
 def _cs_impl(cls):
     # TODO target and prediction
     params = {
         'function': CatP(choice, items=cls.names()),
         'input_field': CatP(choice, items=['S']),
         'output_field': CatP(choice, items=['S'])
     }
     return TransformerCS(Node(params=params))
 def _cs_impl(cls):
     # TODO target and prediction
     params = {
         "function": CatP(choice, items=cls.names()),
         "target": CatP(choice, items=["Y"]),
         "prediction": CatP(choice, items=["Z"]),
     }
     return CS(nodes=[Node(params=params)])
Exemple #5
0
 def _cs_impl(cls):
     params = {
         "criterion": CatP(choice, items=["gini", "entropy"]),
         "splitter": FixedP("best"),
         "class_weight": CatP(choice, items=[None, "balanced"]),
         "max_features": CatP(choice, items=["auto", "sqrt", "log2", None]),
         "max_depth": IntP(uniform, low=2, high=1000),
         "min_samples_split": RealP(uniform, low=1e-6, high=0.3),
         "min_samples_leaf": RealP(uniform, low=1e-6, high=0.3),
         "min_weight_fraction_leaf": RealP(uniform, low=0.0, high=0.3),
         "min_impurity_decrease": RealP(uniform, low=0.0, high=0.2),
     }
     return CS(nodes=[Node(params=params)])
Exemple #6
0
 def _cs_impl(cls):
     params = {
         'criterion': CatP(choice, items=['gini', 'entropy']),
         'splitter': FixedP('best'),
         'class_weight': CatP(choice, items=[None, 'balanced']),
         'max_features': CatP(choice, items=['auto', 'sqrt', 'log2', None]),
         'max_depth': IntP(uniform, low=2, high=1000),
         'min_samples_split': RealP(uniform, low=1e-6, high=0.3),
         'min_samples_leaf': RealP(uniform, low=1e-6, high=0.3),
         'min_weight_fraction_leaf': RealP(uniform, low=0.0, high=0.3),
         'min_impurity_decrease': RealP(uniform, low=0.0, high=0.2)
     }
     return TransformerCS(nodes=[Node(params=params)])
Exemple #7
0
 def _cs_impl(cls):
     n_estimators = [100, 500, 1000, 3000, 5000]
     params = {
         'bootstrap': CatP(choice, items=[True, False]),
         'criterion': CatP(choice, items=['gini', 'entropy']),
         'max_features': CatP(choice, items=['auto', 'sqrt', 'log2', None]),
         'min_impurity_decrease': RealP(uniform, low=0.0, high=0.2),
         'min_samples_split': RealP(uniform, low=1e-6, high=0.3),
         'min_samples_leaf': RealP(uniform, low=1e-6, high=0.3),
         'min_weight_fraction_leaf': RealP(uniform, low=0.0, high=0.3),
         'max_depth': IntP(uniform, low=2, high=1000),
         'n_estimators':  CatP(choice, items=n_estimators),
     }
     return TransformerCS(nodes=[Node(params=params)])
Exemple #8
0
    def _cs_impl(cls):
        # todo: set random seed; set 'cache_size'
        kernel_linear = Node({'kernel': FixedP('linear')})

        kernel_poly = Node({
            'kernel': FixedP('poly'),
            'degree': IntP(uniform, low=0, high=10),
            'coef0': RealP(uniform, low=0.0, high=100)
        })

        kernel_rbf = Node({'kernel': FixedP('rbf')})

        kernel_sigmoid = Node({
            'kernel': FixedP('sigmoid'),
            'coef0': RealP(uniform, low=0.0, high=100),
        })

        kernel_nonlinear = Node(
            {'gamma': RealP(uniform, low=0.00001, high=100)},
            children=[kernel_poly, kernel_rbf, kernel_sigmoid])

        top = Node(
            {
                'C':
                RealP(uniform, low=1e-4, high=100),
                'shrinking':
                CatP(choice, items=[True, False]),
                'probability':
                FixedP(False),
                'tol':
                OrdP(choice,
                     items=[
                         0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1, 10,
                         100, 1000, 10000
                     ]),
                'class_weight':
                CatP(choice, items=[None, 'balanced']),
                # 'verbose': [False],
                'max_iter':
                FixedP(1000000),
                'decision_function_shape':
                CatP(choice, items=['ovr', 'ovo'])
            },
            children=[kernel_linear, kernel_nonlinear])

        return TransformerCS(nodes=[top])
 def _cs_impl(cls):
     params = {
         'score_func': CatP(
             choice,
             items=["chi2", "f_classif", "mutual_info_classif"]
         ),
         'k_perc': RealP(uniform, low=0.0, high=1.0)
     }
     return TransformerCS(nodes=[Node(params=params)])
Exemple #10
0
    def _cs_impl(cls):
        # TODO target and prediction
        params = {
            'input_field1': CatP(choice, items=['S']),
            'input_field2': CatP(choice, items=['S']),
            'direction': CatP(choice, items=[0, 1]),
            'output_field': CatP(choice, items=['S'])
        }
        return TransformerCS(Node(params=params))


# TODO: create a proper test?
# p = Pipeline(
#     File('iris.arff'),
#     ApplyUsing(NB()),
#     Report('$X $Y $Z'),
#     MConcat(fields=['X','Y','Z'], output_field='A'),
#     Report('$A')
# )
# p.apply()
Exemple #11
0
 def _cs_impl(cls):
     params = {'feature_range': CatP(choice, items=[(-1, 1), (0, 1)])}
     return TransformerCS(nodes=[Node(params=params)])
Exemple #12
0
 def _cs_impl(cls, data=None):
     params = {
         'sampling_strategy':
             CatP(choice, items=['not minority', 'not majority', 'all'])
     }
     return TransformerCS(Node(params=params))
Exemple #13
0
 def _cs_impl(cls):
     params = {
         'engine': CatP(choice, items=['dump', 'mysql', 'sqlite']),
         'settings': FixedP({})
     }
     return TransformerCS(Node(params=params))
Exemple #14
0
 def _cs_impl(cls):
     params = {
         'function': CatP(choice, items=cls.function_from_name.keys()),
         'field': CatP(choice, items=['z', 'r', 's'])
     }
     return TransformerCS(Node(params))
Exemple #15
0
 def _cs_impl(cls, data=None):
     params = {
         'operation': CatP(choice, items=['full', 'translate', 'scale'])
     }
     return TransformerCS(nodes=[Node(params=params)])
Exemple #16
0
 def _cs_impl(cls):
     params = {
         'distribution': CatP(choice, items=['gaussian', 'bernoulli'])
     }
     return TransformerCS(nodes=[Node(params=params)])