/mlzoomcamp_midterm_project

My repo for ML ZoomCamp Midterm Project

Primary LanguagePython

Project Decription

Problem Statement

The primary problem to address is predicting machine failures in the milling process. The challenge is to build a machine learning model that can accurately forecast when a machine will fail based on the given features. This is critical for maintenance scheduling, reducing downtime, improving productivity, and ensuring the quality of the products.

Proposed Solution

The proposed solution involves developing a predictive maintenance machine learning model, specifically a binary classification model, to forecast machine failures based on historical data from a milling machine. This classification task falls under supervised learning, as it will use labeled training data (where the outcomes are known) to learn the patterns associated with failures. Techniques such as Random Forest or Gradient Boosting, known for providing insights on feature importance, will be used. These insights can then inform maintenance decisions, leading to more effective failure prevention strategies.

Download Dataset

  • The dataset can be downloaded using command below
wget -O data/raw_data.csv https://raw.githubusercontent.com/Edoar-do/AI4I-Predictive-Maintenance/main/ai4i2020.csv

Depedency & Environment Management

Activate Virtual Environment & Install Dependencies

  1. Activate the virtual environment using the appropriate command for your operating system:
  • Windows
.venv\Scripts\activate
  • MacOS and Linux
source .venv/bin/activate
  1. Upgrade PIP first using this command
python -m pip install --upgrade pip
  1. Install packages using requirements.txt
pip install -r requirements.txt
  1. Deactivate the virtual environment (optional)
deactivate

Python Version Using in This Project

Python 3.10.11

Containerization

Here are the steps and commands to create a Docker image and run a Docker container:

  1. Open Terminal: First, you need to open a terminal on your machine.
  2. Navigate to Your Project Directory: Use the cd command to navigate to the directory containing your project files.
cd .\source\
  1. Build the Docker Image: You will use the docker build command to create an image. Replace your_image_name with the name you want to give your Docker image.
docker build -t your_image_name .
  1. Check the Image: After building the image, you can see it listed by running:
docker images
  1. Run the Docker Container: Now you can run a container from the image you just built. Replace your_container_name with the name you want to give your Docker container. Also, if your application needs specific ports to be open or environment variables, make sure to specify those with the -p and -e flags respectively.
docker run --name your_container_name -p 8080:8080 -d your_image_name

Project Structure

ML ZoomCamp Midterm Project
│
├───data
│       raw_data.csv
│
├───model
│       LogisticRegression_model.joblib
│       logistic_regression_model.joblib
│
├───notebook
│       EDA.ipynb
│       ML_model.ipynb
│
└───source
    │   app.py
    │   Dockerfile
    │   logistic_regression_model.joblib
    │   ml_pipeline.py
    │   predict.py
    │
    └───modules
         viz.py

Project Evaluation Criteria

  • Problem Description
  • EDA
  • Model Training
  • Exporting to Script
  • Reproducibility
  • Model Deployment
  • Dependency and environment management
  • Containerization
  • Cloud Deployment