{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Learning Practice 10 for the University of Tulsa's QM-7063 Data Mining Course\n", "# Evaluating Predictive Performance\n", "# Professor: Dr. Abdulrashid, Spring 2023\n", "# Noah L. Schrick - 1492657" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Imports" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 5.7 \n", "Table 5.7 shows a small set of predictive model validation results for a classification\n", "model, with both actual values and propensities.\n", "\n", "| Propensity of 1 | Actual |\n", "|-----------------|-----------------|\n", "| 0.03 | 0 |\n", "| 0.52 | 0 |\n", "| 0.38 | 0 |\n", "| 0.82 | 1 |\n", "| 0.33 | 0 |\n", "| 0.42 | 0 |\n", "| 0.55 | 1 |\n", "| 0.59 | 0 |\n", "| 0.09 | 0 |\n", "| 0.21 | 0 |\n", "| 0.43 | 0 |\n", "| 0.04 | 0 |\n", "| 0.08 | 0 |\n", "| 0.13 | 0 |\n", "| 0.01 | 0 |\n", "| 0.79 | 1 |\n", "| 0.42 | 0 |\n", "| 0.29 | 0 |\n", "| 0.08 | 0 |\n", "| 0.02 | 0 |" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# a.\n", "Calculate error rates, sensitivity, and specificity using cutoffs of 0.25, 0.5, and 0.75." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Propensity of 1 Actual\n", "0 0.03 0\n", "1 0.52 0\n", "2 0.38 0\n", "3 0.82 1\n", "4 0.33 0\n", "5 0.42 0\n", "6 0.55 1\n", "7 0.59 0\n", "8 0.09 0\n", "9 0.21 0\n", "10 0.43 0\n", "11 0.04 0\n", "12 0.08 0\n", "13 0.13 0\n", "14 0.01 0\n", "15 0.79 1\n", "16 0.42 0\n", "17 0.29 0\n", "18 0.08 0\n", "19 0.02 0\n" ] } ], "source": [ "data = [\n", " [0.03, 0],\n", " [0.52, 0],\n", " [0.38, 0], \n", " [0.82, 1], \n", " [0.33, 0], \n", " [0.42, 0], \n", " [0.55, 1], \n", " [0.59, 0], \n", " [0.09, 0], \n", " [0.21, 0], \n", " [0.43, 0], \n", " [0.04, 0], \n", " [0.08, 0], \n", " [0.13, 0], \n", " [0.01, 0], \n", " [0.79, 1], \n", " [0.42, 0], \n", " [0.29, 0], \n", " [0.08, 0],\n", " [0.02, 0]\n", " ]\n", "\n", "table = pd.DataFrame(data, columns = ['Propensity of 1', 'Actual'])\n", "print(table)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# b.\n", "Create a decile lift chart." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.10" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }