diff --git a/intro-neural-networks/student-admissions/StudentAdmissions.ipynb b/intro-neural-networks/student-admissions/StudentAdmissions.ipynb index 37b296a7d4..73ba32d197 100644 --- a/intro-neural-networks/student-admissions/StudentAdmissions.ipynb +++ b/intro-neural-networks/student-admissions/StudentAdmissions.ipynb @@ -188,7 +188,7 @@ "metadata": {}, "source": [ "## Splitting the data into features and targets (labels)\n", - "Now, as a final step before the training, we'll split the data into features (X) and targets (y)." + "Now, as a final step before the training, we'll split the data into features (X) and targets (y). We must also convert the values in the one hot encoded ranks from a boolean (true or false) to a float (1 or 0)." ] }, { @@ -201,6 +201,7 @@ "targets = train_data['admit']\n", "features_test = test_data.drop('admit', axis=1)\n", "targets_test = test_data['admit']\n", + "features = features.astype(float)\n", "\n", "print(features[:10])\n", "print(targets[:10])" @@ -324,7 +325,7 @@ "outputs": [], "source": [ "# Calculate accuracy on test data\n", - "test_out = sigmoid(np.dot(features_test, weights))\n", + "test_out = sigmoid(np.dot(features_test.astype(float), weights))\n", "predictions = test_out > 0.5\n", "accuracy = np.mean(predictions == targets_test)\n", "print(\"Prediction accuracy: {:.3f}\".format(accuracy))"