{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "ddf867c1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'2.3.4'" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from pycaret.utils import version\n", "version()" ] }, { "cell_type": "code", "execution_count": 3, "id": "fbccb83d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
cyclestatedem_poll_avgdem_poll_avg_marginincumbent_partyincumbent_runningparty_winner
01976California42.797994-3.270222republican1republican
11976Colorado42.180101-1.373191republican1republican
21976Connecticut41.698014-1.469654republican1republican
31976Delaware33.3707482.445322republican1democrat
41976Georgia59.79654629.379760republican1democrat
\n", "
" ], "text/plain": [ " cycle state dem_poll_avg dem_poll_avg_margin incumbent_party \\\n", "0 1976 California 42.797994 -3.270222 republican \n", "1 1976 Colorado 42.180101 -1.373191 republican \n", "2 1976 Connecticut 41.698014 -1.469654 republican \n", "3 1976 Delaware 33.370748 2.445322 republican \n", "4 1976 Georgia 59.796546 29.379760 republican \n", "\n", " incumbent_running party_winner \n", "0 1 republican \n", "1 1 republican \n", "2 1 republican \n", "3 1 democrat \n", "4 1 democrat " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from pycaret.datasets import get_data\n", "data = get_data('us_presidential_election_results')" ] }, { "cell_type": "code", "execution_count": 20, "id": "5cb4297f", "metadata": {}, "outputs": [], "source": [ "data.cycle = data.cycle.astype('float64')" ] }, { "cell_type": "code", "execution_count": 11, "id": "c69bed71", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ4AAAD4CAYAAADcpoD8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAN4ElEQVR4nO3cf4xlZ13H8feH3bIFW0vLVrIWZFqyUquU2q5IsRREQaBqMaApGG0i2iiYKEn/qGkgbTRxMdEgkRZLRH6IUKkQKgQFoQg0FLq7dLtby9JKl2CtrRVYkF9C+/WP+wxc1p3Zmdnd790Z3q9kMueec+65zzNndt89595uqgpJkro8ZNYDkCR9bzE8kqRWhkeS1MrwSJJaGR5JUqv1sx7A0WTjxo01Nzc362FI0qqyffv2+6vq5KXub3imzM3NsW3btlkPQ5JWlSSfXc7+3mqTJLUyPJKkVoZHktTK8EiSWhkeSVIrwyNJamV4JEmtDI8kqZXhkSS1MjySpFaGR5LUyvBIkloZHklSK8MjSWpleCRJrQyPJKmV4ZEktTI8kqRWhkeS1MrwSJJaGR5JUivDI0lqZXgkSa0MjySpleGRJLUyPJKkVutnPYCjya679zF32XtmPQxJw96tF8x6CDoCvOKRJLUyPJKkVoZHktTK8EiSWhkeSVIrwyNJamV4JEmtDI8kqZXhkSS1MjySpFaGR5LUyvBIkloZHklSK8MjSWpleCRJrQyPJKmV4ZEktTI8kqRWhkeS1MrwSJJaGR5JUivDI0lqZXgkSa0OS3iSXJHk0sNxrMMtyVySF816HJKkiTVxxZNk/SKb5wDDI0lHiRWHJ8nlST6d5KPA48e6xyX5xyTbk3wkyelj/RuSXJ3kpiSfSfL0JK9PcnuSN0wd84VJdiXZneSVU+ufnWRHkp1JPjDWXZHkzUluBN48rmw+MvbbkeQp4+lbgacmuSXJy1Y6X0nS4bHYlcKCkpwDXAScNY6xA9g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206r6rOBp4DvDTJ+dMba3JNvGY+R7/W5gNcDTwOOAu4B/jTmY7mECU5Dvh74Per6kvT21b7uTvA3NbEuauqB6rqLODRTK7MTj+cxzc8cDfwmKnHjx7rVq2qunt8vw94J5NfnHvnb1uM7/fNboSHxULzWfXns6ruHX/wHwRex3duyay6uSU5hslfzG+pqneM1Wvi3B1obmvp3AFU1ReBG4Bzmdz6nP/3PafH/+25je0nAP+92HEND9wMbB6f2HgokzfHrp/xmFYsyfclOX5+GXgWsJvJnC4eu10MvGs2IzxsFprP9cCvj09IPRnYN3VbZ1XY732NX2Jy/mAyt4vGp4hOBTYDn+ge31KN+/x/BdxeVX82tWnVn7uF5rYWzl2Sk5M8Yiw/DHgmk/ewbgBeMHbb/7zNn88XAB8cV7ILm/UnKI6GLyafpvk0k/uYl896PIc4l9OYfHpmJ3Db/HyY3HP9AHAH8M/ASbMe6zLm9FYmty2+yeTe8osXmg+TT+S8ZpzLXcCWWY9/BXN78xj7reMP9aap/S8fc9sDPGfW4z/I3M5jchvtVuCW8fXctXDuFpnbqj93wJnAJ8ccdgOvGOtPYxLLO4G3AxvG+mPH4zvH9tMO9hr+kzmSpFbeapMktTI8kqRWhkeS1MrwSJJaGR5JUivDI0lqZXgkSa3+DzLrLt6H174nAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "data.party_winner.value_counts().plot.barh()" ] }, { "cell_type": "code", "execution_count": 23, "id": "104383c7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 DescriptionValue
0session_id123
1Targetparty_winner
2Target TypeBinary
3Label Encodeddemocrat: 0, republican: 1
4Original Data(497, 7)
5Missing ValuesFalse
6Numeric Features3
7Categorical Features3
8Ordinal FeaturesFalse
9High Cardinality FeaturesFalse
10High Cardinality MethodNone
11Transformed Train Set(347, 56)
12Transformed Test Set(150, 56)
13Shuffle Train-TestTrue
14Stratify Train-TestFalse
15Fold GeneratorStratifiedKFold
16Fold Number10
17CPU Jobs-1
18Use GPUFalse
19Log ExperimentTrue
20Experiment Nameus_election_model
21USI581f
22Imputation Typesimple
23Iterative Imputation IterationNone
24Numeric Imputermean
25Iterative Imputation Numeric ModelNone
26Categorical Imputerconstant
27Iterative Imputation Categorical ModelNone
28Unknown Categoricals Handlingleast_frequent
29NormalizeFalse
30Normalize MethodNone
31TransformationFalse
32Transformation MethodNone
33PCAFalse
34PCA MethodNone
35PCA ComponentsNone
36Ignore Low VarianceFalse
37Combine Rare LevelsFalse
38Rare Level ThresholdNone
39Numeric BinningFalse
40Remove OutliersFalse
41Outliers ThresholdNone
42Remove MulticollinearityFalse
43Multicollinearity ThresholdNone
44Remove Perfect CollinearityTrue
45ClusteringFalse
46Clustering IterationNone
47Polynomial FeaturesFalse
48Polynomial DegreeNone
49Trignometry FeaturesFalse
50Polynomial ThresholdNone
51Group FeaturesFalse
52Feature SelectionFalse
53Feature Selection Methodclassic
54Features Selection ThresholdNone
55Feature InteractionFalse
56Feature RatioFalse
57Interaction ThresholdNone
58Fix ImbalanceFalse
59Fix Imbalance MethodSMOTE
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from pycaret.classification import *\n", "s = setup(data, target = 'party_winner', session_id = 123,\n", " log_experiment=True, log_plots=True, experiment_name = 'us_election_model')" ] }, { "cell_type": "code", "execution_count": 24, "id": "06771216", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 ModelAccuracyAUCRecallPrec.F1KappaMCCTT (Sec)
catboostCatBoost Classifier0.93660.99070.94620.95110.94650.86800.87370.5080
xgboostExtreme Gradient Boosting0.93630.98570.94050.95520.94450.86930.87710.0640
rfRandom Forest Classifier0.93070.98870.93140.95430.94030.85720.86340.0680
gbcGradient Boosting Classifier0.92190.98230.91690.95250.93180.84030.84610.0280
lightgbmLight Gradient Boosting Machine0.92190.97520.92600.94610.93270.83900.84660.0450
dtDecision Tree Classifier0.91910.91710.92670.94190.93140.83210.83880.0040
knnK Neighbors Classifier0.91660.97760.95120.91930.93180.82350.83440.0090
etExtra Trees Classifier0.91350.97730.91740.94000.92670.82090.82620.0620
lrLogistic Regression0.91080.98420.93190.92440.92540.81390.82160.0100
adaAda Boost Classifier0.90210.95130.91710.92370.91680.79680.80600.0260
ldaLinear Discriminant Analysis0.89340.94550.89710.92730.90870.77930.78810.0050
ridgeRidge Classifier0.89330.00000.90190.92200.90880.77900.78700.0040
nbNaive Bayes0.67410.84070.48950.93400.63530.39210.46230.0040
svmSVM - Linear Kernel0.66900.00000.78570.57490.65670.30880.36350.0050
qdaQuadratic Discriminant Analysis0.66260.78440.47000.93150.61580.37350.44640.0050
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "best = compare_models()" ] }, { "cell_type": "code", "execution_count": 25, "id": "0fa76e08", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "ccd5c31bec374416892c4c93781703aa", "version_major": 2, "version_minor": 0 }, "text/plain": [ "interactive(children=(ToggleButtons(description='Plot Type:', icons=('',), options=(('Hyperparameters', 'param…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "evaluate_model(best)" ] }, { "cell_type": "code", "execution_count": 27, "id": "964429f6", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 AccuracyAUCRecallPrec.F1KappaMCC
00.94290.97960.95240.95240.95240.88100.8810
10.88570.98640.95240.86960.90910.75610.7618
20.97140.99321.00000.95450.97670.93980.9415
30.91430.93201.00000.87500.93330.81480.8292
40.91430.97280.90480.95000.92680.82350.8250
50.97140.94561.00000.95450.97670.93980.9415
60.94291.00000.90001.00000.94740.88520.8911
70.88240.98210.80001.00000.88890.76710.7888
80.88240.98210.80001.00000.88890.76710.7888
90.91180.97860.95000.90480.92680.81590.8174
Mean0.92190.97520.92600.94610.93270.83900.8466
SD0.03230.01990.07160.04640.02990.06540.0605
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "lightgbm = create_model('lightgbm')" ] }, { "cell_type": "code", "execution_count": 28, "id": "aba9e706", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 AccuracyAUCRecallPrec.F1KappaMCC
01.00001.00001.00001.00001.00001.00001.0000
10.85710.83330.95240.83330.88890.69140.7035
20.97140.97620.95241.00000.97560.94120.9428
30.88570.86900.95240.86960.90910.75610.7618
40.88570.89290.85710.94740.90000.76740.7727
50.94290.94050.95240.95240.95240.88100.8810
60.97140.96671.00000.95240.97560.94120.9428
70.88240.90000.80001.00000.88890.76710.7888
80.91180.92500.85001.00000.91890.82350.8367
90.88240.86790.95000.86360.90480.75180.7577
Mean0.91910.91710.92670.94190.93140.83210.8388
SD0.04630.05100.06380.06070.03880.09740.0933
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "dt = create_model('dt')" ] }, { "cell_type": "code", "execution_count": 29, "id": "4d38de73", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 AccuracyAUCRecallPrec.F1KappaMCC
00.97140.99490.95241.00000.97560.94120.9428
10.88570.98470.95240.86960.90910.75610.7618
21.00001.00001.00001.00001.00001.00001.0000
30.88570.88270.95240.86960.90910.75610.7618
40.85710.93200.80950.94440.87180.71260.7235
50.94290.96090.95240.95240.95240.88100.8810
60.85710.95170.90000.85710.87800.70590.7071
70.91180.95180.85001.00000.91890.82350.8367
80.91180.92500.85001.00000.91890.82350.8367
90.88240.98390.95000.86360.90480.75180.7577
Mean0.91060.95670.91690.93570.92390.81520.8209
SD0.04530.03470.05810.06080.03870.09380.0919
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "tuned_dt = tune_model(dt)" ] }, { "cell_type": "code", "execution_count": null, "id": "bb389034", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 35, "id": "05990fcd", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 AccuracyAUCRecallPrec.F1KappaMCC
00.88570.96940.90480.90480.90480.76190.7619
10.85710.93200.95240.83330.88890.69140.7035
20.94290.99660.95240.95240.95240.88100.8810
30.91430.94901.00000.87500.93330.81480.8292
40.91430.97280.90480.95000.92680.82350.8250
50.97140.93541.00000.95450.97670.93980.9415
60.94291.00000.90001.00000.94740.88520.8911
70.91180.98570.85001.00000.91890.82350.8367
80.88240.97860.80001.00000.88890.76710.7888
90.94120.96071.00000.90910.95240.87590.8827
Mean0.91640.96800.92640.93790.92900.82640.8341
SD0.03270.02250.06410.05390.02760.06910.0662
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "lgbs = []\n", "for i in [0.1,0.2,0.3,0.4,0.5]:\n", " lgbs.append(create_model('lightgbm', learning_rate = i))" ] }, { "cell_type": "code", "execution_count": null, "id": "6f6b5fd9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "2b048aba", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 26, "id": "f943727d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "^C\n" ] } ], "source": [ "!mlflow ui" ] }, { "cell_type": "code", "execution_count": null, "id": "6bb40f21", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "pycaret-new", "language": "python", "name": "pycaret-new" }, "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.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }