Python sklearn.grid_search.ParameterGrid() Examples
The following are 6
code examples of sklearn.grid_search.ParameterGrid().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sklearn.grid_search
, or try the search function
.
Example #1
Source File: classify.py From Lyssandra with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #2
Source File: fixes.py From skutil with BSD 3-Clause "New" or "Revised" License | 5 votes |
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))
Example #3
Source File: grid_search.py From skutil with BSD 3-Clause "New" or "Revised" License | 5 votes |
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))
Example #4
Source File: config_manager.py From namsel with MIT License | 5 votes |
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)
Example #5
Source File: xgbbasemodel.py From Supply-demand-forecasting with MIT License | 5 votes |
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
Example #6
Source File: grid_search.py From sparkit-learn with Apache License 2.0 | 5 votes |
def fit(self, Z): return self._fit(Z, ParameterGrid(self.param_grid))