{ "cells": [ { "cell_type": "markdown", "id": "486ee836", "metadata": {}, "source": [ "# Class 20: Decision Trees and Cross Validation\n", "\n", "\n", "1. Share your favorite beverage (or say hi) in the zoom chat\n", "1. log onto prismia\n", "1. Accept assignment 7\n", "\n", "\n", "\n", "## Assignment 7\n", "\n", "Make a plan with a group:\n", "- what methods do you need to use in part 1?\n", "- try to outline with psuedocode what you'll do for part 2 & 3\n", "\n", "Share any questions you have.\n", "\n", "Followup:\n", "1. assignment clarified to require 3 values for the parameter in part 2\n", "1. more tips on finding data sets added to assignment text" ] }, { "cell_type": "markdown", "id": "fcff09f9", "metadata": {}, "source": [ "\n", "## Complexity of Decision Trees" ] }, { "cell_type": "code", "execution_count": 1, "id": "d3bb4217", "metadata": {}, "outputs": [], "source": [ "# %load http://drsmb.co/310\n", "import pandas as pd\n", "import seaborn as sns\n", "import numpy as np\n", "from sklearn import tree\n", "from sklearn.model_selection import cross_val_score\n", "from sklearn.model_selection import train_test_split\n", "d6_url = 'https://raw.githubusercontent.com/rhodyprog4ds/06-naive-bayes/main/data/dataset6.csv'" ] }, { "cell_type": "code", "execution_count": 2, "id": "46bb711d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | x0 | \n", "x1 | \n", "char | \n", "
---|---|---|---|
0 | \n", "6.14 | \n", "2.10 | \n", "B | \n", "
1 | \n", "2.22 | \n", "2.39 | \n", "A | \n", "
2 | \n", "2.27 | \n", "5.44 | \n", "B | \n", "
3 | \n", "1.03 | \n", "3.19 | \n", "A | \n", "
4 | \n", "2.25 | \n", "1.71 | \n", "A | \n", "