{ "cells": [ { "metadata": { "ExecuteTime": { "end_time": "2024-11-25T18:25:52.294433Z", "start_time": "2024-11-25T18:25:52.290475Z" } }, "cell_type": "code", "source": [ "from matplotlib import pyplot as plt\n", "from sklearn.datasets import load_iris\n", "import pandas as pd\n", "from sklearn.ensemble import RandomForestClassifier\n", "from sklearn.metrics import accuracy_score, classification_report\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.preprocessing import StandardScaler\n", "import seaborn as sns" ], "id": "f48bf2b75b3d4c0a", "outputs": [], "execution_count": 50 }, { "metadata": { "ExecuteTime": { "end_time": "2024-11-25T18:21:47.693369Z", "start_time": "2024-11-25T18:21:47.684944Z" } }, "cell_type": "code", "source": [ "iris = load_iris()\n", "df = pd.DataFrame(iris.data, columns=iris.feature_names)\n", "df[\"species\"] = iris.target" ], "id": "1fcf9d27b342fee3", "outputs": [], "execution_count": 34 }, { "metadata": { "ExecuteTime": { "end_time": "2024-11-25T18:18:39.925298Z", "start_time": "2024-11-25T18:18:39.918510Z" } }, "cell_type": "code", "source": "df.head()", "id": "39a267c21147134c", "outputs": [ { "data": { "text/plain": [ " sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) \\\n", "0 5.1 3.5 1.4 0.2 \n", "1 4.9 3.0 1.4 0.2 \n", "2 4.7 3.2 1.3 0.2 \n", "3 4.6 3.1 1.5 0.2 \n", "4 5.0 3.6 1.4 0.2 \n", "\n", " species \n", "0 0 \n", "1 0 \n", "2 0 \n", "3 0 \n", "4 0 " ], "text/html": [ "
| \n", " | sepal length (cm) | \n", "sepal width (cm) | \n", "petal length (cm) | \n", "petal width (cm) | \n", "species | \n", "
|---|---|---|---|---|---|
| 0 | \n", "5.1 | \n", "3.5 | \n", "1.4 | \n", "0.2 | \n", "0 | \n", "
| 1 | \n", "4.9 | \n", "3.0 | \n", "1.4 | \n", "0.2 | \n", "0 | \n", "
| 2 | \n", "4.7 | \n", "3.2 | \n", "1.3 | \n", "0.2 | \n", "0 | \n", "
| 3 | \n", "4.6 | \n", "3.1 | \n", "1.5 | \n", "0.2 | \n", "0 | \n", "
| 4 | \n", "5.0 | \n", "3.6 | \n", "1.4 | \n", "0.2 | \n", "0 | \n", "