Skip to content

Commit 3bde035

Browse files
committed
fix scikit-learn deprecation warnings in SVC unit
1 parent 475499f commit 3bde035

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

notebooks/05.07-Support-Vector-Machines.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -775,10 +775,10 @@
775775
"outputs": [],
776776
"source": [
777777
"from sklearn.svm import SVC\n",
778-
"from sklearn.decomposition import RandomizedPCA\n",
778+
"from sklearn.decomposition import PCA\n",
779779
"from sklearn.pipeline import make_pipeline\n",
780780
"\n",
781-
"pca = RandomizedPCA(n_components=150, whiten=True, random_state=42)\n",
781+
"pca = PCA(n_components=150, whiten=True, svd_solver='randomized', random_state=42)\n",
782782
"svc = SVC(kernel='rbf', class_weight='balanced')\n",
783783
"model = make_pipeline(pca, svc)"
784784
]
@@ -798,7 +798,7 @@
798798
},
799799
"outputs": [],
800800
"source": [
801-
"from sklearn.cross_validation import train_test_split\n",
801+
"from sklearn.model_selection import train_test_split\n",
802802
"Xtrain, Xtest, ytrain, ytest = train_test_split(faces.data, faces.target,\n",
803803
" random_state=42)"
804804
]
@@ -829,7 +829,7 @@
829829
}
830830
],
831831
"source": [
832-
"from sklearn.grid_search import GridSearchCV\n",
832+
"from sklearn.model_selection import GridSearchCV\n",
833833
"param_grid = {'svc__C': [1, 5, 10, 50],\n",
834834
" 'svc__gamma': [0.0001, 0.0005, 0.001, 0.005]}\n",
835835
"grid = GridSearchCV(model, param_grid)\n",

0 commit comments

Comments
 (0)