Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: Using GridSearchCV with scoring='roc_auc' and GMM as classifier gives IndexError #7598

Closed
@Rendiere

Description

@Rendiere

When performing grid search using GridSearchCV using ootb scoring method 'roc_auc' and ootb GMM classifier from sklearn.mixture.GMM I get an index error.
Code to reproduce:

from sklearn import datasets
from sklearn.grid_search import GridSearchCV
from sklearn.mixture import GMM
X,y = datasets.make_classification(n_samples = 10000, n_features=10,n_classes=2)
# Vanilla GMM_model
gmm_model = GMM()
# Standard param grid
param_grid = {'n_components' : [1,2,3,4],
              'covariance_type': ['tied','full','spherical']}
grid_search = GridSearchCV(gmm_model, param_grid, scoring='roc_auc')
# Fit GS with this data
grid_search.fit(X, y)

Sorry if the format is incorrect. First time I am posting.

ERROR:
File "*/python2.7/site-packages/sklearn/metrics/scorer.py", line 175, in call
y_pred = y_pred[:, 1]
IndexError: index 1 is out of bounds for axis 1 with size 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions