scikit-learn/scikit-learn

cross_validate hang randomly when training svc with polynomial kernel.

Open

#13,557 创建于 2019年4月2日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Python (66,084 star) (27,020 fork)batch import
Bughelp wantedmodule:svm

描述

Description

cross_validate hang randomly when training svc with polynomial kernel.

Steps/Code to Reproduce

from sklearn import datasets
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split, cross_validate

iris = datasets.load_iris()
x = iris.data
y = iris.target
X_choose, x_test, y_choose, y_test = train_test_split(x, y, test_size=0.3)

params = [[0.6652997139930452, 'poly', 7, 4178.386000737241],
          [1.2346990434544882, 'poly', 7, 4317.581190465473],
          [0.8156943235551155, 'poly', 8, 864.1583649816441]]

for c, kernel, degree, gamma in params:
    clf = SVC(C=c, kernel=kernel, degree=degree, gamma=gamma)
    cv_results = cross_validate(clf, X_choose, y_choose, cv=5,
                                return_train_score=False)
    print(cv_results['test_score'].mean())

Expected Results

Three scores should be shown.

Actual Results

Sometimes hang. I waited for few minutes. Also I checked running code line doesn't change using gdb. Backtrace is here

Versions

>>> import sklearn; sklearn.show_versions()
System:
    python: 3.7.3 (default, Mar 27 2019, 22:11:17)  [GCC 7.3.0]
executable: /home/yusuke/miniconda3/envs/py37_automl_examples2/bin/python
   machine: Linux-4.20.0-042000-generic-x86_64-with-debian-buster-sid

BLAS:
    macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
  lib_dirs: /home/yusuke/miniconda3/envs/py37_automl_examples2/lib
cblas_libs: mkl_rt, pthread

Python deps:
       pip: 19.0.3
setuptools: 40.8.0
   sklearn: 0.20.3
     numpy: 1.16.2
     scipy: 1.2.1
    Cython: None
    pandas: None

Thank you!

贡献者指南