Skip to content

Commit

Permalink
update sklearn calls to use latest API
Browse files Browse the repository at this point in the history
Version 0.18 moved cross-validation to sklearn.model_selection - see https://scikit-learn.org/stable/whats_new.html#version-0-18
Version 0.17 deprecated class_weight="auto" in favor of class_weight="balanced"
  • Loading branch information
downes committed Jul 12, 2017
1 parent 4efdf7e commit af9d6bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/brewing-logreg.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
")\n",
"\n",
"# Split into train and test\n",
"X, Xt, y, yt = sklearn.cross_validation.train_test_split(X, y)\n",
"X, Xt, y, yt = sklearn.model_selection.train_test_split(X, y)\n",
"\n",
"# Visualize sample of the data\n",
"ind = np.random.permutation(X.shape[0])[:1000]\n",
Expand Down Expand Up @@ -111,7 +111,7 @@
"%%timeit\n",
"# Train and test the scikit-learn SGD logistic regression.\n",
"clf = sklearn.linear_model.SGDClassifier(\n",
" loss='log', n_iter=1000, penalty='l2', alpha=5e-4, class_weight='auto')\n",
" loss='log', n_iter=1000, penalty='l2', alpha=5e-4, class_weight='balanced')\n",
"\n",
"clf.fit(X, y)\n",
"yt_pred = clf.predict(Xt)\n",
Expand Down

0 comments on commit af9d6bc

Please sign in to comment.