コード例 #1
0
    def _cs_impl(cls) -> CS:
        params = {
            "path": FixedP("./"),
            "name": FixedP("blalbairis.arff"),
            "matrices_hash": FixedP("1234567890123456789"),
        }

        return CS(nodes=[Node(params=params)])
コード例 #2
0
 def _cs_impl(cls):
     params = {
         'path': FixedP('./'),
         'name': FixedP('iris.arff'),
         'description': FixedP('No description.'),
         'matrices_hash': FixedP('1234567890123456789')
     }
     return TransformerCS(Node(params=params))
コード例 #3
0
 def _cs_impl(cls) -> CS:
     # todo: set random seed; set 'cache_size'
     param = {
         "n": RealP(uniform, low=0.0, high=1.0),
         "copy": FixedP(True),
         "whiten": FixedP(False),
         "svd_solver": FixedP("auto"),
         "tol": FixedP(0.0),
         "iterated_power": FixedP("auto"),
     }
     return CS(nodes=[Node(param)])
コード例 #4
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])
コード例 #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)])
コード例 #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)])
コード例 #7
0
def hold(cs, **kwargs):
    """Freeze args passed via kwargs. Only applicable to ComponentCS.

    Keyworded args are used to freeze some parameters of
    the algorithm, regardless of what a CS sampling could have chosen.
    TODO: it may be improved to effectively traverse and change the tree
      in-place, not just extend overwritting it
    """
    cs = cs.cs
    new_nodes = []
    for node in cs.nodes:
        params = {} if node.params is None else node.params.copy()
        for k, v in kwargs.items():
            params[k] = FixedP(v)
        new_nodes.append(node.updated(params=params))
    return cs.updated(nodes=new_nodes)
コード例 #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])
コード例 #9
0
ファイル: cache.py プロジェクト: davips/pjml-may_archived
 def __new__(cls,
             *args,
             fields=None,
             engine="dump",
             db='/tmp/cururu',
             settings=None,
             blocking=False,
             seed=0,
             transformers=None):
     """Shortcut to create a ConfigSpace."""
     if transformers is None:
         transformers = args
     if all([isinstance(t, Transformer) for t in transformers]):
         return object.__new__(cls)
     node = Node(
         params={
             'fields': FixedP(fields),
             'engine': FixedP(engine),
             'db': FixedP(db),
             'settings': FixedP(settings),
             'blocking': FixedP(blocking),
             'seed': FixedP(seed),
         })
     return ContainerCS(Cache.name, Cache.path, transformers, nodes=[node])
コード例 #10
0
ファイル: store.py プロジェクト: davips/pjml-may_archived
 def _cs_impl(cls):
     params = {
         'engine': CatP(choice, items=['dump', 'mysql', 'sqlite']),
         'settings': FixedP({})
     }
     return TransformerCS(Node(params=params))
コード例 #11
0
ファイル: save.py プロジェクト: davips/pjml-may_archived
 def _cs_impl(cls):
     params = {'path': FixedP('./'), 'name': FixedP('iris.arff')}
     return TransformerCS(Node(params=params))
コード例 #12
0
 def _cs_impl(cls):
     params = {"path": FixedP("./"), "name": FixedP("iris.arff")}
     return CS(nodes=[Node(params)])
コード例 #13
0
ファイル: source.py プロジェクト: davips/pjml-may_archived
 def _cs_impl(cls):
     params = {'name': FixedP('iris_OFÆdñO')}
     return TransformerCS(nodes=[Node(params=params)])