|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 2, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [ |
| 8 | + { |
| 9 | + "data": { |
| 10 | + "text/plain": [ |
| 11 | + "'d:\\\\Machine_Learning\\\\self_projects\\\\end_to_end_projects_with_deployment\\\\ML_projects\\\\bank_customer_churn\\\\Machine-Learning-project-with-MLflow-deployment\\\\research'" |
| 12 | + ] |
| 13 | + }, |
| 14 | + "execution_count": 2, |
| 15 | + "metadata": {}, |
| 16 | + "output_type": "execute_result" |
| 17 | + } |
| 18 | + ], |
| 19 | + "source": [ |
| 20 | + "import os\n", |
| 21 | + "\n", |
| 22 | + "%pwd" |
| 23 | + ] |
| 24 | + }, |
| 25 | + { |
| 26 | + "cell_type": "code", |
| 27 | + "execution_count": 3, |
| 28 | + "metadata": {}, |
| 29 | + "outputs": [], |
| 30 | + "source": [ |
| 31 | + "os.chdir(\"../\")" |
| 32 | + ] |
| 33 | + }, |
| 34 | + { |
| 35 | + "cell_type": "code", |
| 36 | + "execution_count": 4, |
| 37 | + "metadata": {}, |
| 38 | + "outputs": [ |
| 39 | + { |
| 40 | + "data": { |
| 41 | + "text/plain": [ |
| 42 | + "'d:\\\\Machine_Learning\\\\self_projects\\\\end_to_end_projects_with_deployment\\\\ML_projects\\\\bank_customer_churn\\\\Machine-Learning-project-with-MLflow-deployment'" |
| 43 | + ] |
| 44 | + }, |
| 45 | + "execution_count": 4, |
| 46 | + "metadata": {}, |
| 47 | + "output_type": "execute_result" |
| 48 | + } |
| 49 | + ], |
| 50 | + "source": [ |
| 51 | + "%pwd" |
| 52 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "code", |
| 56 | + "execution_count": 6, |
| 57 | + "metadata": {}, |
| 58 | + "outputs": [], |
| 59 | + "source": [ |
| 60 | + "import pandas as pd" |
| 61 | + ] |
| 62 | + }, |
| 63 | + { |
| 64 | + "cell_type": "code", |
| 65 | + "execution_count": 7, |
| 66 | + "metadata": {}, |
| 67 | + "outputs": [], |
| 68 | + "source": [ |
| 69 | + "train_data = pd.read_csv(\"artifacts/data_transformation/train.csv\")\n", |
| 70 | + "val_data = pd.read_csv(\"artifacts/data_transformation/test.csv\")" |
| 71 | + ] |
| 72 | + }, |
| 73 | + { |
| 74 | + "cell_type": "code", |
| 75 | + "execution_count": 8, |
| 76 | + "metadata": {}, |
| 77 | + "outputs": [], |
| 78 | + "source": [ |
| 79 | + "X_train = train_data.drop(['Exited'], axis=1)\n", |
| 80 | + "y_train = train_data['Exited']\n", |
| 81 | + "X_val = val_data.drop(['Exited'], axis=1)\n", |
| 82 | + "y_val = val_data['Exited']" |
| 83 | + ] |
| 84 | + }, |
| 85 | + { |
| 86 | + "cell_type": "code", |
| 87 | + "execution_count": 10, |
| 88 | + "metadata": {}, |
| 89 | + "outputs": [], |
| 90 | + "source": [ |
| 91 | + "from sklearn.ensemble import RandomForestClassifier" |
| 92 | + ] |
| 93 | + }, |
| 94 | + { |
| 95 | + "cell_type": "code", |
| 96 | + "execution_count": 18, |
| 97 | + "metadata": {}, |
| 98 | + "outputs": [], |
| 99 | + "source": [ |
| 100 | + "clf = RandomForestClassifier(n_estimators = 1000, \n", |
| 101 | + " criterion = 'gini', \n", |
| 102 | + " max_depth = None,\n", |
| 103 | + " min_samples_split = 2,\n", |
| 104 | + " min_samples_leaf = 1,\n", |
| 105 | + " bootstrap = True,\n", |
| 106 | + " #ccp_alpha = 0.0,\n", |
| 107 | + " n_jobs = -1,\n", |
| 108 | + " verbose = 1\n", |
| 109 | + " )" |
| 110 | + ] |
| 111 | + }, |
| 112 | + { |
| 113 | + "cell_type": "code", |
| 114 | + "execution_count": 19, |
| 115 | + "metadata": {}, |
| 116 | + "outputs": [ |
| 117 | + { |
| 118 | + "name": "stderr", |
| 119 | + "output_type": "stream", |
| 120 | + "text": [ |
| 121 | + "[Parallel(n_jobs=-1)]: Using backend ThreadingBackend with 12 concurrent workers.\n", |
| 122 | + "[Parallel(n_jobs=-1)]: Done 26 tasks | elapsed: 0.1s\n", |
| 123 | + "[Parallel(n_jobs=-1)]: Done 176 tasks | elapsed: 1.4s\n", |
| 124 | + "[Parallel(n_jobs=-1)]: Done 426 tasks | elapsed: 3.5s\n", |
| 125 | + "[Parallel(n_jobs=-1)]: Done 776 tasks | elapsed: 8.3s\n", |
| 126 | + "[Parallel(n_jobs=-1)]: Done 1000 out of 1000 | elapsed: 11.9s finished\n" |
| 127 | + ] |
| 128 | + }, |
| 129 | + { |
| 130 | + "data": { |
| 131 | + "text/plain": [ |
| 132 | + "RandomForestClassifier(n_estimators=1000, n_jobs=-1, verbose=1)" |
| 133 | + ] |
| 134 | + }, |
| 135 | + "execution_count": 19, |
| 136 | + "metadata": {}, |
| 137 | + "output_type": "execute_result" |
| 138 | + } |
| 139 | + ], |
| 140 | + "source": [ |
| 141 | + "clf.fit(X_train, y_train)" |
| 142 | + ] |
| 143 | + }, |
| 144 | + { |
| 145 | + "cell_type": "code", |
| 146 | + "execution_count": null, |
| 147 | + "metadata": {}, |
| 148 | + "outputs": [], |
| 149 | + "source": [] |
| 150 | + } |
| 151 | + ], |
| 152 | + "metadata": { |
| 153 | + "kernelspec": { |
| 154 | + "display_name": "mlops", |
| 155 | + "language": "python", |
| 156 | + "name": "python3" |
| 157 | + }, |
| 158 | + "language_info": { |
| 159 | + "codemirror_mode": { |
| 160 | + "name": "ipython", |
| 161 | + "version": 3 |
| 162 | + }, |
| 163 | + "file_extension": ".py", |
| 164 | + "mimetype": "text/x-python", |
| 165 | + "name": "python", |
| 166 | + "nbconvert_exporter": "python", |
| 167 | + "pygments_lexer": "ipython3", |
| 168 | + "version": "3.7.0" |
| 169 | + } |
| 170 | + }, |
| 171 | + "nbformat": 4, |
| 172 | + "nbformat_minor": 2 |
| 173 | +} |
0 commit comments