{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "5cd83bae-8836-44e0-96fd-3fbae94120d2", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import joblib\n", "\n", "from sklearn.preprocessing import LabelEncoder\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.tree import DecisionTreeClassifier\n", "from sklearn.metrics import accuracy_score, classification_report" ] }, { "cell_type": "code", "execution_count": 2, "id": "c5c8cd0e-69d9-47bb-90a6-f37f2cf2c560", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Jumlah data: 2000\n", "\n", "Distribusi label:\n", "label\n", "Ringan 780\n", "Sedang 675\n", "Intensif 545\n", "Name: count, dtype: int64\n" ] }, { "data": { "text/html": [ "
| \n", " | mood | \n", "durasi_belajar | \n", "durasi_tidur | \n", "label | \n", "
|---|---|---|---|---|
| 0 | \n", "Lumayan | \n", "72 | \n", "7.2 | \n", "Intensif | \n", "
| 1 | \n", "Biasa Saja | \n", "59 | \n", "4.8 | \n", "Ringan | \n", "
| 2 | \n", "Bagus | \n", "110 | \n", "8.9 | \n", "Intensif | \n", "
| 3 | \n", "Lumayan | \n", "64 | \n", "5.6 | \n", "Sedang | \n", "
| 4 | \n", "Biasa Saja | \n", "26 | \n", "6.9 | \n", "Ringan | \n", "
DecisionTreeClassifier(max_depth=6, min_samples_leaf=3, min_samples_split=5,\n",
" random_state=42)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. DecisionTreeClassifier(max_depth=6, min_samples_leaf=3, min_samples_split=5,\n",
" random_state=42)