{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import torch" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "PyTorch version: 2.6.0+cu118\n", "CUDA available: True\n", "Current device: NVIDIA GeForce RTX 3050 6GB Laptop GPU\n" ] } ], "source": [ "import torch\n", "print(f\"PyTorch version: {torch.__version__}\")\n", "print(f\"CUDA available: {torch.cuda.is_available()}\")\n", "print(f\"Current device: {torch.cuda.get_device_name(0)}\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv('spam_ham_india.csv')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | Msg | \n", "Label | \n", "
|---|---|---|
| 0 | \n", "CONGRATULATIONS! FREE 2GB data is yours! Claim... | \n", "spam | \n", "
| 1 | \n", "Hi! Thank you for being with Vi-India's FASTES... | \n", "spam | \n", "
| 2 | \n", "As part of Cyber Swachhta Pakhwada, CERT-In Go... | \n", "spam | \n", "
| 3 | \n", "I will try to manage took tablets | \n", "ham | \n", "
| 4 | \n", "Study from Home with Vi!! Watch Kite Victers C... | \n", "spam | \n", "
| ... | \n", "... | \n", "... | \n", "
| 2262 | \n", "Dear Customer, You have a missed call from +91... | \n", "spam | \n", "
| 2263 | \n", "Dear User, Vistor Id - 7538XXX. Loan Applicati... | \n", "spam | \n", "
| 2264 | \n", "Congrats, Y0UR Received Rs.592000 L0AN is Appr... | \n", "spam | \n", "
| 2265 | \n", "Hi! 50% off on proc. fees will be gone soon! A... | \n", "spam | \n", "
| 2266 | \n", "Congrats User, Rs.15OOO Bonus is Credited to y... | \n", "spam | \n", "
2267 rows × 2 columns
\n", "XGBClassifier(base_score=None, booster=None, callbacks=None,\n",
" colsample_bylevel=None, colsample_bynode=None,\n",
" colsample_bytree=0.6875760635879894, device=None,\n",
" early_stopping_rounds=None, enable_categorical=False,\n",
" eval_metric='logloss', feature_types=None,\n",
" gamma=0.15163263655810333, grow_policy=None, importance_type=None,\n",
" interaction_constraints=None, learning_rate=0.029923689735900552,\n",
" max_bin=None, max_cat_threshold=None, max_cat_to_onehot=None,\n",
" max_delta_step=None, max_depth=8, max_leaves=None,\n",
" min_child_weight=1.0026864337114683, missing=nan,\n",
" monotone_constraints=None, multi_strategy=None, n_estimators=290,\n",
" n_jobs=None, num_parallel_tree=None, random_state=None, ...)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. XGBClassifier(base_score=None, booster=None, callbacks=None,\n",
" colsample_bylevel=None, colsample_bynode=None,\n",
" colsample_bytree=0.6875760635879894, device=None,\n",
" early_stopping_rounds=None, enable_categorical=False,\n",
" eval_metric='logloss', feature_types=None,\n",
" gamma=0.15163263655810333, grow_policy=None, importance_type=None,\n",
" interaction_constraints=None, learning_rate=0.029923689735900552,\n",
" max_bin=None, max_cat_threshold=None, max_cat_to_onehot=None,\n",
" max_delta_step=None, max_depth=8, max_leaves=None,\n",
" min_child_weight=1.0026864337114683, missing=nan,\n",
" monotone_constraints=None, multi_strategy=None, n_estimators=290,\n",
" n_jobs=None, num_parallel_tree=None, random_state=None, ...)RandomForestClassifier(max_depth=31, max_features=0.2535, min_samples_leaf=2,\n",
" min_samples_split=19, n_estimators=969, n_jobs=-1,\n",
" random_state=48)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. RandomForestClassifier(max_depth=31, max_features=0.2535, min_samples_leaf=2,\n",
" min_samples_split=19, n_estimators=969, n_jobs=-1,\n",
" random_state=48)