From c0e9b157daa5116de806a1d47186faceff48f462 Mon Sep 17 00:00:00 2001 From: Jesse Leigh Patsolic Date: Wed, 2 Oct 2019 13:35:16 -0400 Subject: [PATCH] fix string -> int --- ...classification_using_structured_RerF.ipynb | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/demos/S-RerF/MNIST_classification_using_structured_RerF.ipynb b/docs/demos/S-RerF/MNIST_classification_using_structured_RerF.ipynb index 2cd8066f..74462b77 100644 --- a/docs/demos/S-RerF/MNIST_classification_using_structured_RerF.ipynb +++ b/docs/demos/S-RerF/MNIST_classification_using_structured_RerF.ipynb @@ -40,7 +40,8 @@ "train_samples = 5000\n", "\n", "# Load data from https://www.openml.org/d/554\n", - "X, y = fetch_openml('mnist_784', version=1, return_X_y=True)" + "X, y = fetch_openml('mnist_784', version=1, return_X_y=True)\n", + "y = y.astype(int)" ] }, { @@ -73,12 +74,12 @@ "output_type": "stream", "text": [ "rerfClassifier(feature_combinations=1.5, image_height=None, image_width=None,\n", - " max_depth=None, max_features='auto', min_parent=1,\n", + " max_depth=None, max_features='auto', min_samples_split=1,\n", " n_estimators=100, n_jobs=8, oob_score=False,\n", " patch_height_max=None, patch_height_min=1, patch_width_max=None,\n", " patch_width_min=1, projection_matrix='Base', random_state=None)\n", "rerfClassifier(feature_combinations=1.5, image_height=28, image_width=28,\n", - " max_depth=None, max_features='auto', min_parent=1,\n", + " max_depth=None, max_features='auto', min_samples_split=1,\n", " n_estimators=100, n_jobs=8, oob_score=False, patch_height_max=5,\n", " patch_height_min=1, patch_width_max=5, patch_width_min=1,\n", " projection_matrix='S-RerF', random_state=None)\n" @@ -110,7 +111,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "run time rerf 0.7958900928497314\n" + "run time rerf 1.1266508102416992\n" ] } ], @@ -130,7 +131,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "run time s_rerf 3.6138932704925537\n" + "run time s_rerf 6.353916883468628\n" ] } ], @@ -158,10 +159,10 @@ } ], "source": [ - "train_acc_rerf = clf_rerf.score(X_train, y_train.astype(int))\n", + "train_acc_rerf = clf_rerf.score(X_train, y_train)\n", "print(\"train_acc rerf\", train_acc_rerf)\n", "\n", - "train_acc_s_rerf = clf_s_rerf.score(X_train, y_train.astype(int))\n", + "train_acc_s_rerf = clf_s_rerf.score(X_train, y_train)\n", "print(\"train_acc s_rerf\", train_acc_s_rerf)" ] }, @@ -176,18 +177,18 @@ "name": "stdout", "output_type": "stream", "text": [ - "score rerf 0.9361\n", - "score s_rerf 0.9427\n" + "score rerf 0.9376\n", + "score s_rerf 0.9436\n" ] } ], "source": [ "# sparsity = np.mean(clf.coef_ == 0) * 100\n", - "score = clf_rerf.score(X_test, y_test.astype(int))\n", + "score = clf_rerf.score(X_test, y_test)\n", "print(\"score rerf\", score)\n", "\n", "# sparsity = np.mean(clf.coef_ == 0) * 100\n", - "score = clf_s_rerf.score(X_test, y_test.astype(int))\n", + "score = clf_s_rerf.score(X_test, y_test)\n", "print(\"score s_rerf\", score)" ] }