pipefitter.model_selection.HyperParameterTuning

class pipefitter.model_selection.HyperParameterTuning(**kwargs)

Bases: pipefitter.base.BaseGridSearchCV

Perform search over all combinations of specified parameters

Parameters:

estimator : estimator

The estimator class/object to use for fitting

param_grid : dict or list of dicts

The combinations of parameters to use.
  • dict - each key in the dictionary corresponds to a parameter name. The values in the dictionary are lists of the parameter values to use.
  • list of dicts - each dictionary is a set of parameters to use.

score_type : string

The score value to use in each iteration. The default is ‘MisClassificationRate’ for targets that are class variables, or ‘AverageSquaredError’ for targets that are interval variables.

cv : int or float or generator, optional

Indicates the cross validation folding scheme.
  • int - indicates the number of folds to apply to the data set.
  • float - indicates that one fold should be applied. The value is the percentage of observations to use for the training data set.
  • generator - specifies a generator that will return training and scoring data sets.
Returns:

HyperParameterTuning

Examples

Using a dict of parameter lists:

>>> hpt = HyperParameterTuning(estimator=estimator,
...                            param_grid = dict(
...                                max_depth=[6, 10],
...                                leaf_size=[3, 5]
...                            ))

Using a list of parameter dictionaries:

>>> hpt = HyperParameterTuning(estimator=estimator,
...                            param_grid = [
...                                dict(max_depth=6, leaf_size=3),
...                                dict(max_depth=6, leaf_size=5),
...                                dict(max_depth=10, leaf_size=3),
...                                dict(max_depth=10, leaf_size=5),
...                            ])
__init__(**kwargs)

Methods

__init__(\*\*kwargs)
fit(table, \*args, \*\*kwargs)
get_combined_params(\*args, \*\*kwargs) Merge all parameters and verify that they valid
get_filtered_params(\*args, \*\*kwargs) Merge parameters that keys that belong to self
get_param(\*names) Return a copy of the requested parameters
get_params(\*names) Return a copy of the requested parameters
gridsearch(table[, n_jobs]) Fit model over various permutations of parameters
has_param(name) Does the parameter exist?
score(table, \*args, \*\*kwargs)
set_param(\*args, \*\*kwargs) Set one or more parameters
set_params(\*args, \*\*kwargs) Set one or more parameters

Attributes

param_defs
static_params