wine_quality_prediction

Wine Quality Prediction

Overview

The Wine Quality Prediction project aims to predict the quality of red and white wines based on their chemical properties. Using a machine learning model, this project analyzes various features, such as acidity, alcohol content, and residual sugar, to predict a wine’s quality on a scale from 0 to 10.

The dataset used for this project is the Wine Quality Dataset, which can be found on the UCI Machine Learning Repository.


Project Structure

wine_quality_prediction/
│
├── data/
│   ├── winequality-red.csv            # Wine dataset (red wine)
│
├── notebooks/
│   ├── data_analysis.ipynb             # Jupyter notebook for EDA
│
├── src/
│   ├── __init__.py                     # Init file for the src module
│   ├── data_preprocessing.py           # Script for data preprocessing and cleaning
│   ├── model_training.py               # Script for training the model
│   ├── evaluate_model.py               # Script for evaluating the model
│   ├── prediction.py                   # Script for making predictions
│
├── model/
│   ├── wine_quality_model.pkl          # Trained model saved as a pickle file
│
├── static/                             # Static folder for UI (optional)
│   └── css/
│
├── templates/                          # HTML templates for web UI (optional)
│   └── index.html
│
├── app.py                              # Flask application for deploying the project
├── requirements.txt                    # Project dependencies
├── Dockerfile                          # Docker file for containerization (optional)
└── README.md                           # Documentation file

Installation

1. Clone the Repository

First, clone the project repository to your local machine:

git clone https://github.com/yourusername/wine_quality_prediction.git
cd wine_quality_prediction

2. Install Dependencies

Make sure you have Python installed (preferably Python 3.8+). Then, install the project dependencies:

pip install -r requirements.txt

3. Download Dataset

Download the wine quality dataset (red wine or white wine) from the UCI repository:

Place the dataset file into the data/ folder.


Usage

1. Train the Model

To train the model, use the following command:

python src/model_training.py

This will train the model using the RandomForestClassifier and save it in the model/ directory as wine_quality_model.pkl.

2. Evaluate the Model

To evaluate the model’s performance, run:

python src/evaluate_model.py

This will output a classification report with metrics such as precision, recall, and F1-score.

3. Make Predictions

To predict wine quality using custom data, edit the sample data in the src/prediction.py script and run:

python src/prediction.py

This will output the predicted wine quality based on the input features.


Files and Scripts


Technologies Used


Future Enhancements


Contributors


License

This project is licensed under the MIT License - see the LICENSE file for details.