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

Skip to content

CalibratedClassifierCV in conjunction with SVC and multiclass results in index out of bounds error #4634

@adjgiulio

Description

@adjgiulio

Reported this on StackOverflow:
http://stackoverflow.com/questions/29873981/error-with-sklearn-calibratedclassifiercv-and-svm

kf = StratifiedShuffleSplit(y, n_iter=1, test_size=0.2)
clf = svm.SVC(C=1,probability=True)            
sig_clf = CalibratedClassifierCV(clf, method="isotonic", cv=kf)
sig_clf.fit(X, y)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/g/anaconda/lib/python2.7/site-packages/sklearn/calibration.py", line 166, in fit
    calibrated_classifier.fit(X[test], y[test])
  File "/home/g/anaconda/lib/python2.7/site-packages/sklearn/calibration.py", line 309, in fit
    calibrator.fit(this_df, Y[:, k], sample_weight)
IndexError: index 9 is out of bounds for axis 1 with size 9

This is not an issue with any other classifiers I have used, including RandomForestClassifier and LogisticRegression.

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