https://github.com/tigureis/aula_deployment
This project not only demonstrates a machine learning pipeline but also serves as a template for deploying models into production. By leveraging the project's structure and code, you can streamline the process of deploying your own machine learning models.
https://github.com/tigureis/aula_deployment
numpy pandas pickle sklearn
Last synced: about 1 month ago
JSON representation
This project not only demonstrates a machine learning pipeline but also serves as a template for deploying models into production. By leveraging the project's structure and code, you can streamline the process of deploying your own machine learning models.
- Host: GitHub
- URL: https://github.com/tigureis/aula_deployment
- Owner: tigureis
- Created: 2024-12-05T06:18:54.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-11T11:32:19.000Z (about 1 year ago)
- Last Synced: 2025-01-28T17:18:54.988Z (about 1 year ago)
- Topics: numpy, pandas, pickle, sklearn
- Language: Jupyter Notebook
- Homepage:
- Size: 478 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Iris Flower Classifier
This project demonstrates a simple machine learning pipeline for classifying iris flowers using the famous Iris dataset and a Decision Tree Classifier. To be used as a base for others machininbg learning projects.
## Overview
The project is divided into two main parts, implemented in separate Python files:
1. **Training (`train.py`):** This script extracts data from the Iris dataset, prepares features, trains a Decision Tree Classifier, and saves the trained model to a file (`trained_classifier.pkl`).
2. **Prediction (`predict.py`):** This script loads the trained model, loads new data, makes predictions on the new data using the loaded model, and prints the predictions.
## How to Run
1. **Install Dependencies:** Make sure you have the following libraries installed:
2. **Training:** Execute the `train.py` script to train the model and save it:
3. **Prediction:** Execute the `predict.py` script to load the trained model, make predictions on new data, and print the results:
## File Structure
- `train.py`: Python script for training the model.
- `predict.py`: Python script for making predictions.
- `trained_classifier.pkl`: This file stores the trained Decision Tree Classifier model.
## Functionality
**`train.py`:**
- `extract_data()` : Loads the Iris dataset from scikit-learn.
- `preparing_features()` : Creates a Pandas DataFrame for features (X) and target (y).
- `train_model()` : Trains a Decision Tree Classifier with a maximum depth of 2.
- `serialize_object()` : Saves the trained model to a file using pickle.
- `run()` : Orchestrates the training pipeline.
**`predict.py`:**
- `load_data()` : Loads new data for prediction.
- `load_model()` : Loads the trained model from the file.
- `make_predictions()` : Makes predictions on the new data using the loaded model.
- `write_results()` : Prints the predictions.
- `run()` : Orchestrates the prediction pipeline.
2. **Training:** Execute the `train.py` script to train the model and save it: