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.
The code implements three tasks:
- Task 1 (Regression)
- Predict the alcohol value from physicochemical features.
- Models: Linear Regression and XGBoost Regressor.
- Metric: RMSE.
- Task 2 (Binary Classification)
- Classify wine type (red vs white).
- Models: SVC and Random Forest Classifier.
- Metric: Accuracy and confusion matrix.
- 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.
- 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.
- 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.
For Task 3 (multiclass quality prediction), four classification models were trained and evaluated with confusion matrices.
Best result: task3_RedeNeuronal.
- Create a Python environment.
- Install dependencies:
pip install -r requirements.txt
From the repository root, run either script:
python "code/source code files/source_code_l31537.py"
Use the terminal menu shown by each script.
- 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.



