Пример #1
0
    def cs(cls, **kwargs):
        """
        Each tree represents a set of hyperparameter spaces and is a, possibly
        infinite, set of configurations.
        Parameters
        ----------
        data
            If given, 'data' limits the search interval of some hyperparameters

        Returns
        -------
            Tree representing all the possible hyperparameter spaces.
        """
        tree = cls.cs_impl(**kwargs)
        if 'config_spaces' in kwargs:
            del kwargs['config_spaces']
        hps = tree.hps.copy()

        hps['module'] = CatHP(choice, a=[cls.__module__])
        hps['class'] = CatHP(choice, a=[cls.__name__])

        # Freeze args passed via kwargs
        for k, v in kwargs.items():
            hps[k] = FixedHP(v)

        return tree.updated(hps=hps)
Пример #2
0
    def cs_impl(cls):
        hps = {
            'n_neighbors': IntHP(uniform, low=1, high=15),
            'weights': CatHP(choice, a=['uniform', 'distance']),
            'algorithm': CatHP(choice, a=['kd_tree', 'ball_tree']),
            'leaf_size': IntHP(uniform, low=15, high=100),
            'p': IntHP(uniform, low=1, high=5)
        }  #default metric: 'minkowski'

        return ConfigSpace(name='KNN', hps=hps)
Пример #3
0
 def cs_impl(cls, config_spaces):
     hps = [
         CatHP('configs',
               cls.sampling_function,
               config_spaces=config_spaces[0]),
         CatHP('reduce',
               cls.sampling_function,
               config_spaces=config_spaces[1])
     ]
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #4
0
    def cs_impl(cls):

        hps = {
            'n_neighbors': IntHP(uniform, low=2, high=1000),
            'weights': CatHP(choice, a=['uniform', 'distance']),
            'algorithm': CatHP(choice,
                               a=['auto', 'ball_tree', 'kd_tree', 'brute']),
            'leaf_size': IntHP(uniform, low=2, high=1000),
            'p': IntHP(uniform, low=1, high=6)
        }

        return ConfigSpace(name=cls.__name__, hps=hps)
Пример #5
0
    def cs_impl(cls):
        hps = {
            'C': RealHP(uniform, low=0.0, high=10000.0),
            'kernel': CatHP(choice, a=['linear', 'poly', 'rbf', 'sigmoid']),
            'degree': IntHP(uniform, low=0, high=1000),
            'gamma': CatHP(choice, a=['scale', 'auto']),
            'coef0': RealHP(uniform, low=0.0, high=1000.0),
            'shrinking': CatHP(choice, a=[True, False]),
            'probability': CatHP(choice, a=[True, False]),
            'tol': RealHP(uniform, low=1e-6, high=0.5),
            'max_iter': IntHP(uniform, low=-1, max=10000),
            'decision_function_shape': CatHP(choice, a=['ovo', 'ovr'])
        }

        return ConfigSpace(name=cls.__name__, hps=hps)
 def cs_impl(cls, data=None):
     hps = {
         'sampling_strategy':
         CatHP(choice,
               items=['majority', 'not minority', 'not majority', 'all'])
     }
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #7
0
    def cs_impl(cls):
        # Sw
        # cs = ConfigSpace('Switch')
        # st = cs.start()
        # st.add_children([a.start, b.start, c.start])
        # cs.finish([a.end,b.end,c.end])

        hps = {
            'criterion': CatHP(choice, a=['gini', 'entropy']),
            'splitter': CatHP(choice, a=['best']),
            'class_weight': CatHP(choice, a=[None, 'balanced']),
            'max_features': CatHP(choice, a=['auto', 'sqrt', 'log2', None]),
            'max_depth': IntHP(uniform, low=2, high=1000),
            'min_samples_split': RealHP(uniform, low=1e-6, high=0.3),
            'min_samples_leaf': RealHP(uniform, low=1e-6, high=0.3),
            'min_weight_fraction_leaf': RealHP(uniform, low=0.0, high=0.3),
            'min_impurity_decrease': RealHP(uniform, low=0.0, high=0.2)
        }

        return ConfigSpace(name='DT', hps=hps)
Пример #8
0
 def cs_impl(cls):
     hps = {
         'sampling_strategy':
         CatHP(choice,
               items=[
                   'not minority', 'not majority', 'all', 'minority', 'auto'
               ]),
         'k_neighbours':
         IntHP(uniform, low=2, high=1000)
     }
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #9
0
    def cs_impl(cls):

        hps = {
            'n_estimators': IntHP(uniform, low=2, high=1000),
            'criterion': CatHP(choice, a=['mse', 'mae', 'friedman_mse']),
            'max_features': CatHP(choice, a=['auto', 'sqrt', 'log2', None]),
            'max_depth': IntHP(uniform, low=2, high=100),
            'min_samples_split': RealHP(uniform, low=1e-6, high=0.5),
            'min_samples_leaf': RealHP(uniform, low=1e-6, high=0.5),
            'min_weight_fraction_leaf': RealHP(uniform, low=0.0, high=0.5),
            'min_impurity_decrease': RealHP(uniform, low=0.0, high=0.2),
            'loss': CatHP(choice, a=['ls', 'lad', 'huber', 'quantile']),
            'learning_rate': RealHP(uniform, low=1e-4, high=1e-1),
            'subsample': RealHP(uniform, low=0.1, high=0.9),
            'alpha': RealHP(uniform, low=0.1,
                            high=0.9),  #ignored if loss != huber or quantile
            'validation_fraction': RealHP(uniform, low=0.1,
                                          high=0.9),  # Using Early Stopping #
            'n_iter_no_change': IntHP(uniform, low=5,
                                      high=20)  #                      #
        }

        return ConfigSpace(name='GB', hps=hps)
Пример #10
0
 def cs_impl(cls):
     hps = {'function': CatHP(choice, items=['mean'])}
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #11
0
 def cs_impl(cls, config_spaces):
     hps = {'configs': CatHP(cls.sampling_function,
                             config_spaces=config_spaces)}
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #12
0
 def cs_impl(cls, data=None):
     hps = {
         '@with_mean/std':
         CatHP(choice, items=[(True, False), (False, True), (True, True)])
     }
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #13
0
 def cs_impl(cls):
     hps = {'@nb_type': CatHP(choice, items=['GaussianNB', 'BernoulliNB'])}
     return ConfigSpace(name='NB', hps=hps)
Пример #14
0
 def cs_impl(cls):
     # TODO: cirar funcao no data
     hps = {'field': CatHP(choice, items=['X', 'Y', 'Z'])}
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #15
0
 def cs_impl(self):
     hps = {
         '@nb_type': CatHP(choice, items=["MultinomialNB", "ComplementNB"])
     }
     return ConfigSpace(name='NB', hps=hps)
Пример #16
0
 def cs_impl(cls):
     # TODO: cirar funcao no data
     hps = [CatHP('field', choice, itens=['X', 'Y', 'Z'])]
     return ConfigSpace(name=cls.__name__, hps=hps)
Пример #17
0
 def cs_impl(cls):
     hps = {'feature_range': CatHP(choice, items=[(-1, 1), (0, 1)])}
     return ConfigSpace(name=cls.__name__, hps=hps)