95 lines
2.6 KiB
Plaintext
95 lines
2.6 KiB
Plaintext
{
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"name": "python",
|
|
"display_name": "Python (Pyodide)",
|
|
"language": "python"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "python",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8"
|
|
}
|
|
},
|
|
"nbformat_minor": 5,
|
|
"nbformat": 4,
|
|
"cells": [
|
|
{
|
|
"id": "d4cec5b7-5725-44d3-bfb7-04278fdf9bb4",
|
|
"cell_type": "code",
|
|
"source": "import pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import StandardScaler, LabelEncoder\nfrom sklearn.neural_network import MLPClassifier\nfrom sklearn.metrics import accuracy_score, confusion_matrix",
|
|
"metadata": {
|
|
"trusted": true
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 2
|
|
},
|
|
{
|
|
"id": "0e3d0d27-300b-4152-96e0-70ff1fbab83a",
|
|
"cell_type": "code",
|
|
"source": "data = pd.read_csv(\"Churn_Modelling.csv\")",
|
|
"metadata": {
|
|
"trusted": true
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 3
|
|
},
|
|
{
|
|
"id": "06fd9a81-ed4d-4796-bc38-e0c68fe1dc3e",
|
|
"cell_type": "code",
|
|
"source": "X = data.iloc[:, 3:13] # Features from CreditScore to EstimatedSalary\ny = data.iloc[:, 13] ",
|
|
"metadata": {
|
|
"trusted": true
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 4
|
|
},
|
|
{
|
|
"id": "90c9c5aa-0b8a-424b-a625-ff4fc2d73380",
|
|
"cell_type": "code",
|
|
"source": "le = LabelEncoder()\nX[\"Gender\"] = le.fit_transform(X[\"Gender\"])\nX = pd.get_dummies(X, columns=[\"Geography\"], drop_first=True)",
|
|
"metadata": {
|
|
"trusted": true
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 5
|
|
},
|
|
{
|
|
"id": "4b0ecfe6-7245-4866-a842-e422c5658928",
|
|
"cell_type": "code",
|
|
"source": "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)",
|
|
"metadata": {
|
|
"trusted": true
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 6
|
|
},
|
|
{
|
|
"id": "55cd9306-83f0-4ea6-8399-278444f3e839",
|
|
"cell_type": "code",
|
|
"source": "scaler = StandardScaler()\nX_train = scaler.fit_transform(X_train)\nX_test = scaler.transform(X_test)",
|
|
"metadata": {
|
|
"trusted": true
|
|
},
|
|
"outputs": [],
|
|
"execution_count": 7
|
|
},
|
|
{
|
|
"id": "60cdf8fb-c656-4a24-a120-de0c4c9abf94",
|
|
"cell_type": "code",
|
|
"source": "",
|
|
"metadata": {
|
|
"trusted": true
|
|
},
|
|
"outputs": [],
|
|
"execution_count": null
|
|
}
|
|
]
|
|
} |