Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of Pipeline #17

Open
epigos opened this issue Mar 26, 2020 · 0 comments
Open

Support of Pipeline #17

epigos opened this issue Mar 26, 2020 · 0 comments

Comments

@epigos
Copy link

epigos commented Mar 26, 2020

Could you please let me know if this support sklearn.pipeline.Pipeline estimators. I tried it and had some errors.

Below is my pipeline

hog_svc_pipe = Pipeline(steps=[
    ('hog', HogTransformer()),
    ('svc', svm.SVC(random_state=42))
])
# define gridsearch parameters
param_grid = {
    'svc__kernel': ['linear', 'rbf'], 
    'svc__C': [1, 10, 100], 
    'svc__gamma': ['scale', 'auto'],
    'hog__block_norm': ['L2-Hys', 'L1', 'L1-sqrt'],
}

# est = svm.SVC(random_state=42)
hog_svc_grid = GridSearch(model=hog_svc_pipe, param_grid=param_grid)
# Grid-search all parameter combinations using a validation set.
hog_svc_grid.fit(train_data.images, train_data.target, val_data.images, val_data.target)

I get the following error

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-60-6ba446e48e56> in <module>()
----> 1 get_ipython().run_cell_magic('time', '', "# define gridsearch parameters\nparam_grid = {\n    'svc__kernel': ['linear', 'rbf'], \n    'svc__C': [1, 10, 100], \n    'svc__gamma': ['scale', 'auto'],\n    'hog__block_norm': ['L2-Hys', 'L1', 'L1-sqrt'],\n}\n\n# est = svm.SVC(random_state=42)\nhog_svc_grid = GridSearch(model=hog_svc_pipe, param_grid=param_grid)\n# Grid-search all parameter combinations using a validation set.\nhog_svc_grid.fit(train_data.images, train_data.target, val_data.images, val_data.target)")

3 frames
<decorator-gen-60> in time(self, line, cell, local_ns)

<timed exec> in <module>()

/usr/local/lib/python3.6/dist-packages/hypopt/model_selection.py in fit(self, X_train, y_train, X_val, y_val, scoring, scoring_params, verbose)
    361             else:
    362                 results = [_run_thread_job(job) for job in params]
--> 363             models, scores = list(zip(*results))
    364             self.model = models[np.argmax(scores)]
    365         else:

ValueError: not enough values to unpack (expected 2, got 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant