当前位置: 首页>>代码示例>>Python>>正文


Python grid_search.ParameterGrid方法代码示例

本文整理汇总了Python中sklearn.grid_search.ParameterGrid方法的典型用法代码示例。如果您正苦于以下问题:Python grid_search.ParameterGrid方法的具体用法?Python grid_search.ParameterGrid怎么用?Python grid_search.ParameterGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sklearn.grid_search的用法示例。


在下文中一共展示了grid_search.ParameterGrid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cross_validate

# 需要导入模块: from sklearn import grid_search [as 别名]
# 或者: from sklearn.grid_search import ParameterGrid [as 别名]
def cross_validate(self, X, y):

        print "fitting {} to the training set".format(self.name)
        if self.param_grid is not None:
            param_sets = list(ParameterGrid(self.param_grid))
            n_param_sets = len(param_sets)
            param_scores = []
            for j, param_set in enumerate(param_sets):

                print "--------------"
                print "training the classifier..."
                print "parameter set:"
                for k, v in param_set.iteritems():
                    print "{}:{}".format(k, v)

                param_score = self.evaluate(X, y, param_set=param_set)
                param_scores.append(param_score)
                p = np.argmax(np.array(param_scores))
                self.best_param_set = param_sets[p]
                print "best parameter set", self.best_param_set
                print "best score:", param_scores[p]
        else:
            score = self.evaluate(X, y) 
开发者ID:ektormak,项目名称:Lyssandra,代码行数:25,代码来源:classify.py

示例2: fit

# 需要导入模块: from sklearn import grid_search [as 别名]
# 或者: from sklearn.grid_search import ParameterGrid [as 别名]
def fit(self, X, y=None):
        """Run fit with all sets of parameters.

        Parameters
        ----------
        X : array-like, shape = [n_samples, n_features]
            Training vector, where n_samples is the number of samples and
            n_features is the number of features.
        y : array-like, shape = [n_samples] or [n_samples, n_output], optional
            Target relative to X for classification or regression;
            None for unsupervised learning.
        """
        return self._fit(X, y, ParameterGrid(self.param_grid)) 
开发者ID:tgsmith61591,项目名称:skutil,代码行数:15,代码来源:fixes.py

示例3: fit

# 需要导入模块: from sklearn import grid_search [as 别名]
# 或者: from sklearn.grid_search import ParameterGrid [as 别名]
def fit(self, frame):
        """Fit the grid search.

        Parameters
        ----------

        frame : H2OFrame, shape=(n_samples, n_features)
            The training frame on which to fit.
        """
        return self._fit(frame, ParameterGrid(self.param_grid)) 
开发者ID:tgsmith61591,项目名称:skutil,代码行数:12,代码来源:grid_search.py

示例4: create_misc_confs

# 需要导入模块: from sklearn import grid_search [as 别名]
# 或者: from sklearn.grid_search import ParameterGrid [as 别名]
def create_misc_confs():
    from sklearn.grid_search import ParameterGrid
    params = {'break_width': [1.5, 2.0, 3.6, 5.0], 
              'recognizer': ['probout', 'hmm'], 'combine_hangoff': [.4, .6, .8], 
              'postprocess': [True, False], 'segmenter': ['experimental', 'stochastic'],
              'line_cluster_pos': ['top', 'center'],
              }
    grid = ParameterGrid(params)
    for pr in grid:
        Config(save_conf=True, **pr) 
开发者ID:zmr,项目名称:namsel,代码行数:12,代码来源:config_manager.py

示例5: __get_param_iterable

# 需要导入模块: from sklearn import grid_search [as 别名]
# 或者: from sklearn.grid_search import ParameterGrid [as 别名]
def __get_param_iterable(self, param_grid):
        if self.ramdonized_search_enable:
            parameter_iterable = ParameterSampler(param_grid,
                                          self.randomized_search_n_iter,
                                          random_state=self.ramdonized_search_random_state)
        else:
            parameter_iterable = ParameterGrid(param_grid)
                 
        return parameter_iterable 
开发者ID:LevinJ,项目名称:Supply-demand-forecasting,代码行数:11,代码来源:xgbbasemodel.py

示例6: fit

# 需要导入模块: from sklearn import grid_search [as 别名]
# 或者: from sklearn.grid_search import ParameterGrid [as 别名]
def fit(self, Z):
        return self._fit(Z, ParameterGrid(self.param_grid)) 
开发者ID:lensacom,项目名称:sparkit-learn,代码行数:4,代码来源:grid_search.py


注:本文中的sklearn.grid_search.ParameterGrid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。