Skip to content

jlourencoo/predictive-modelling-winemaking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wine Quality Analysis Project

Overview

This project develops machine learning models for wine data analysis using two public datasets:

  • Red wine samples
  • White wine samples

The work covers data analysis, preprocessing, model selection with hyperparameter tuning, and model export.

Objectives

The code implements three tasks:

  1. Task 1 (Regression)
  • Predict the alcohol value from physicochemical features.
  • Models: Linear Regression and XGBoost Regressor.
  • Metric: RMSE.
  1. Task 2 (Binary Classification)
  • Classify wine type (red vs white).
  • Models: SVC and Random Forest Classifier.
  • Metric: Accuracy and confusion matrix.
  1. Task 3 (Multiclass Classification)
  • Predict wine quality score.
  • Models: SVC, Random Forest, Decision Tree, and a PyTorch neural network.
  • Metric: Accuracy, confusion matrix, and classification report.

Repository Structure

  • code/source code files/source_code_l31537.py: Full pipeline with Tasks 1, 2, and 3.
  • code/source code files/qualidade_vinhos.py: Task 3 focused workflow.
  • data/red_wine.csv and data/white_wine.csv: input datasets.
  • code/trained_model_files: folder intended for serialized models.
  • requirements.txt: Python dependencies.

Preprocessing Pipeline

  • Merge red and white datasets.
  • Add wine type column (Vinho: red=1, white=0).
  • Fill missing values using column means.
  • Remove outliers with quantile-based bounds and IQR filtering.
  • Standardize independent variables before training.

Task 3 Model Training and Confusion Matrices

For Task 3 (multiclass quality prediction), four classification models were trained and evaluated with confusion matrices.

Best result: task3_RedeNeuronal.

SVC

Task 3 SVC Confusion Matrix

Random Forest

Task 3 Random Forest Confusion Matrix

Decision Tree

Task 3 Decision Tree Confusion Matrix

Neural Network (Best)

Task 3 Neural Network Confusion Matrix

Environment Setup

  1. Create a Python environment.
  2. Install dependencies:

pip install -r requirements.txt

Running the Code

From the repository root, run either script:

python "code/source code files/source_code_l31537.py"

Use the terminal menu shown by each script.

Notes

  • Task 3 neural network training is computationally expensive due to K-Fold and high epoch count.
  • Model export filenames are currently written in the working directory unless manually changed in code.
  • Consider moving all model outputs to code/trained_model_files for consistency.

About

Project in Predictive Modelling and Classification in Winemaking for the Applied AI class

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages