https://github.com/hayatiyrtgl/ml_divorce_classification-with-5-models
The code performs data preprocessing, machine learning model training, evaluation, and model saving for a binary classification problem on the divorce dataset.
https://github.com/hayatiyrtgl/ml_divorce_classification-with-5-models
anket binary-classification classification keras keras-classification-models keras-neural-networks keras-tensorflow machine-learning machine-learning-algorithms machinelearning-python python pythonmachinelearning scikit-learn scikitlearn-machine-learning
Last synced: 2 months ago
JSON representation
The code performs data preprocessing, machine learning model training, evaluation, and model saving for a binary classification problem on the divorce dataset.
- Host: GitHub
- URL: https://github.com/hayatiyrtgl/ml_divorce_classification-with-5-models
- Owner: HayatiYrtgl
- License: mit
- Created: 2024-04-11T19:54:35.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-11T19:58:50.000Z (about 1 year ago)
- Last Synced: 2025-02-14T14:51:40.152Z (4 months ago)
- Topics: anket, binary-classification, classification, keras, keras-classification-models, keras-neural-networks, keras-tensorflow, machine-learning, machine-learning-algorithms, machinelearning-python, python, pythonmachinelearning, scikit-learn, scikitlearn-machine-learning
- Language: Jupyter Notebook
- Homepage:
- Size: 2.69 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ML_divorce_Classification-with-5-models
The code performs data preprocessing, machine learning model training, evaluation, and model saving for a binary classification problem on the divorce dataset.
----
Here's the step-by-step explanation of the code:1. **IMPORT LIBRARIES**: Imports the necessary libraries. In this code, it imports the `pandas` and `numpy` libraries.
2. **Read Data**: Reads the dataset. It reads the file `../dataset/divorce_data.csv` and assigns it to a variable named `unprocessed_data`.
3. **Info & head & describe**: Displays the first few rows of the dataset and provides basic statistics.
4. **EDA (Exploratory Data Analysis)**: Visualizes and explores the dataset. This includes creating count plots, distribution plots, and correlation analysis.
5. **TRAIN-TEST-SPLIT & PREPROCESSING**: Splits the dataset into training and testing sets. It separates the target variable (`Divorce`) from the features and performs any necessary preprocessing steps.
6. **EVALUATE FUNCTION**: Defines a function to evaluate the performance of machine learning models. It computes metrics such as accuracy and F1-score.
7. **MODELING**: Fits various machine learning models to the training data and evaluates their performance on the test data. The models used include Logistic Regression, K-Nearest Neighbors, Random Forests, Naive Bayes, and an Artificial Neural Network (ANN).
8. **SAVE MODELS**: Saves the trained models to disk using the `joblib` library for Logistic Regression, KNN, Random Forests, and Naive Bayes, and the `h5py` library for the ANN model.
9. **VISUALIZATION**: Visualizes the performance of the models using bar plots.
Overall, this code performs data exploration, model training, evaluation, and model saving for a binary classification problem on the divorce dataset.