diff --git a/ann1.h5 b/ann1.h5 deleted file mode 100644 index 3eb337c..0000000 Binary files a/ann1.h5 and /dev/null differ diff --git a/app.py b/app.py index 5e901cd..93d474c 100644 --- a/app.py +++ b/app.py @@ -3,10 +3,10 @@ import pickle import tensorflow -model = tensorflow.keras.models.load_model("ann1.h5") -ohe_geo = pickle.load(open("ohe_geo.pkl", "rb")) -le_gender = pickle.load(open("le_gender.pkl", "rb")) -sc = pickle.load(open("sc.pkl", "rb")) +model = tensorflow.keras.models.load_model("models/ann1.h5") +ohe_geo = pickle.load(open("preprocessing/ohe_geo.pkl", "rb")) +le_gender = pickle.load(open("preprocessing/le_gender.pkl", "rb")) +sc = pickle.load(open("preprocessing/sc.pkl", "rb")) st.title("Customer Churn Predictor developed by Akashvarma26") @@ -48,9 +48,9 @@ st.subheader(f"Churn Prediction Result of the customer:") st.progress(pred_percent) if pred_prob>0.5: - st.error(f'⚠️ {name}, the customer is likely to churn with a probability of {pred_prob:.3f}.') + st.error(f'⚠️ {name}, the customer is likely to churn. The churn probability is {pred_prob:.3f}.') else: - st.success(f'✅ {name}, the customer is not likely to churn with a probability of {pred_prob:.3f}.') + st.success(f'✅ {name}, the customer is not likely to churn. The churn probability is {pred_prob:.3f}.') if credit_score<500: st.warning(f"{name}, the credit score is quite low. Customers with low credit scores might have higher churn probabilities.") if balance==0: diff --git a/Churn_Modelling.csv b/dataset/Churn_Modelling.csv similarity index 100% rename from Churn_Modelling.csv rename to dataset/Churn_Modelling.csv diff --git a/logs/fit/20241019-115828/train/events.out.tfevents.1729319308.ASUS.7224.0.v2 b/logs/fit/20241019-115828/train/events.out.tfevents.1729319308.ASUS.7224.0.v2 new file mode 100644 index 0000000..f7b27f5 Binary files /dev/null and b/logs/fit/20241019-115828/train/events.out.tfevents.1729319308.ASUS.7224.0.v2 differ diff --git a/logs/fit/20241019-115828/validation/events.out.tfevents.1729319312.ASUS.7224.1.v2 b/logs/fit/20241019-115828/validation/events.out.tfevents.1729319312.ASUS.7224.1.v2 new file mode 100644 index 0000000..9bf8bd4 Binary files /dev/null and b/logs/fit/20241019-115828/validation/events.out.tfevents.1729319312.ASUS.7224.1.v2 differ diff --git a/models/ann1.h5 b/models/ann1.h5 new file mode 100644 index 0000000..2e30b4c Binary files /dev/null and b/models/ann1.h5 differ diff --git a/notebook.ipynb b/notebook.ipynb index 01cb52e..4adc8b7 100644 --- a/notebook.ipynb +++ b/notebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -15,9 +15,19 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 14, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "<>:1: SyntaxWarning: invalid escape sequence '\\C'\n", + "<>:1: SyntaxWarning: invalid escape sequence '\\C'\n", + "C:\\Users\\rkdat\\AppData\\Local\\Temp\\ipykernel_7224\\184311580.py:1: SyntaxWarning: invalid escape sequence '\\C'\n", + " df=pd.read_csv(\"dataset\\Churn_Modelling.csv\")\n" + ] + }, { "data": { "text/html": [ @@ -168,19 +178,19 @@ "4 79084.10 0 " ] }, - "execution_count": 2, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "df=pd.read_csv(\"Churn_Modelling.csv\")\n", + "df=pd.read_csv(\"dataset\\Churn_Modelling.csv\")\n", "df.head()" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -189,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -198,7 +208,7 @@ "array(['France', 'Spain', 'Germany'], dtype=object)" ] }, - "execution_count": 4, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -209,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -231,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -241,7 +251,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -251,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -324,7 +334,7 @@ "4 0.0 0.0 1.0" ] }, - "execution_count": 8, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -336,7 +346,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -346,7 +356,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -493,7 +503,7 @@ "4 0.0 1.0 " ] }, - "execution_count": 10, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -504,7 +514,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -519,18 +529,18 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ - "pickle.dump(le_gender,open(\"le_gender.pkl\",\"wb\"))\n", - "pickle.dump(ohe_geo,open(\"ohe_geo.pkl\",\"wb\"))\n", - "pickle.dump(sc,open(\"sc.pkl\",\"wb\"))" + "pickle.dump(le_gender,open(\"preprocessing/le_gender.pkl\",\"wb\"))\n", + "pickle.dump(ohe_geo,open(\"preprocessing/ohe_geo.pkl\",\"wb\"))\n", + "pickle.dump(sc,open(\"preprocessing/sc.pkl\",\"wb\"))" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -543,7 +553,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -552,7 +562,7 @@ "12" ] }, - "execution_count": 14, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -563,7 +573,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -675,7 +685,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -685,7 +695,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -695,7 +705,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ @@ -704,7 +714,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -712,41 +722,43 @@ "output_type": "stream", "text": [ "Epoch 1/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 4ms/step - accuracy: 0.8079 - loss: 0.4441 - val_accuracy: 0.8525 - val_loss: 0.3555\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 3ms/step - accuracy: 0.8223 - loss: 0.4436 - val_accuracy: 0.8410 - val_loss: 0.3824\n", "Epoch 2/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8528 - loss: 0.3645 - val_accuracy: 0.8550 - val_loss: 0.3445\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8572 - loss: 0.3554 - val_accuracy: 0.8570 - val_loss: 0.3546\n", "Epoch 3/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8623 - loss: 0.3388 - val_accuracy: 0.8550 - val_loss: 0.3572\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8530 - loss: 0.3646 - val_accuracy: 0.8590 - val_loss: 0.3467\n", "Epoch 4/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - accuracy: 0.8578 - loss: 0.3388 - val_accuracy: 0.8545 - val_loss: 0.3562\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8637 - loss: 0.3447 - val_accuracy: 0.8565 - val_loss: 0.3422\n", "Epoch 5/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8565 - loss: 0.3460 - val_accuracy: 0.8545 - val_loss: 0.3477\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8632 - loss: 0.3358 - val_accuracy: 0.8580 - val_loss: 0.3480\n", "Epoch 6/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - accuracy: 0.8615 - loss: 0.3417 - val_accuracy: 0.8610 - val_loss: 0.3413\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8635 - loss: 0.3426 - val_accuracy: 0.8555 - val_loss: 0.3454\n", "Epoch 7/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8647 - loss: 0.3323 - val_accuracy: 0.8520 - val_loss: 0.3415\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8622 - loss: 0.3367 - val_accuracy: 0.8575 - val_loss: 0.3411\n", "Epoch 8/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8493 - loss: 0.3438 - val_accuracy: 0.8615 - val_loss: 0.3357\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8645 - loss: 0.3419 - val_accuracy: 0.8590 - val_loss: 0.3400\n", "Epoch 9/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8677 - loss: 0.3299 - val_accuracy: 0.8605 - val_loss: 0.3625\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8652 - loss: 0.3289 - val_accuracy: 0.8585 - val_loss: 0.3382\n", "Epoch 10/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8705 - loss: 0.3301 - val_accuracy: 0.8605 - val_loss: 0.3378\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8677 - loss: 0.3254 - val_accuracy: 0.8620 - val_loss: 0.3430\n", "Epoch 11/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8619 - loss: 0.3361 - val_accuracy: 0.8605 - val_loss: 0.3542\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8669 - loss: 0.3286 - val_accuracy: 0.8565 - val_loss: 0.3480\n", "Epoch 12/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8641 - loss: 0.3350 - val_accuracy: 0.8580 - val_loss: 0.3438\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8643 - loss: 0.3345 - val_accuracy: 0.8585 - val_loss: 0.3447\n", "Epoch 13/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8672 - loss: 0.3216 - val_accuracy: 0.8560 - val_loss: 0.3501\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8664 - loss: 0.3295 - val_accuracy: 0.8525 - val_loss: 0.3462\n", "Epoch 14/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8710 - loss: 0.3159 - val_accuracy: 0.8625 - val_loss: 0.3505\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8687 - loss: 0.3174 - val_accuracy: 0.8615 - val_loss: 0.3431\n", "Epoch 15/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8689 - loss: 0.3254 - val_accuracy: 0.8455 - val_loss: 0.3575\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8721 - loss: 0.3100 - val_accuracy: 0.8525 - val_loss: 0.3570\n", "Epoch 16/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8724 - loss: 0.3086 - val_accuracy: 0.8625 - val_loss: 0.3418\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8722 - loss: 0.3060 - val_accuracy: 0.8585 - val_loss: 0.3417\n", "Epoch 17/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - accuracy: 0.8706 - loss: 0.3159 - val_accuracy: 0.8585 - val_loss: 0.3419\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8765 - loss: 0.3106 - val_accuracy: 0.8550 - val_loss: 0.3499\n", "Epoch 18/100\n", - "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 3ms/step - accuracy: 0.8708 - loss: 0.3126 - val_accuracy: 0.8515 - val_loss: 0.3597\n" + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8724 - loss: 0.3057 - val_accuracy: 0.8615 - val_loss: 0.3477\n", + "Epoch 19/100\n", + "\u001b[1m250/250\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 2ms/step - accuracy: 0.8726 - loss: 0.3118 - val_accuracy: 0.8565 - val_loss: 0.3476\n" ] } ], @@ -756,7 +768,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -768,12 +780,12 @@ } ], "source": [ - "model.save('ann1.h5')" + "model.save('models/ann1.h5')" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ @@ -782,19 +794,28 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 34, "metadata": {}, "outputs": [ + { + "data": { + "text/plain": [ + "Reusing TensorBoard on port 6006 (pid 19204), started 10:07:45 ago. (Use '!kill 19204' to kill it.)" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "text/html": [ "\n", - " \n", "