Downloads · 30 days
41
13% of all-time downloads
neck392/p3-wine-quality-keras-ensemble-mixed-top5
p3-wine-quality-keras-ensemble-mixed-top5 is a tabular regression model from neck392. Use it for the tabular regression task on the model card, and read the license before you ship it in a product. It is set up for keras. The card lists the license as mit.
This repository contains the final selected Keras ensemble model developed for wine quality prediction.
Downloads · 30 days
41
13% of all-time downloads
All-time downloads
325
Public
Repo size
2.5 KB
Likes
0
Public
Click a slice to open those files.
.keras154 KB · 82%
From the Hugging Face model README
This repository contains the final selected Keras ensemble model developed for wine quality prediction.
The ensemble predicts wine quality from 11 physicochemical input features. Each member model first produces a continuous regression output. The final ensemble prediction is calculated by averaging the continuous outputs of the five selected member models, followed by threshold-based integer quality conversion.
Ensemble_Mixed_Top5Q_MLP_32_16_HuberQ_MLP_16_8Q_MLP_32Q_MLP_64AEPC_MLP_64qualityTwo preprocessing strategies are used across the ensemble member models.
This preprocessing strategy clips selected feature values using the 1st and 99th percentiles computed from the training set. It then applies log1p transformation to selected skewed features and StandardScaler normalization.
AEPC is a project-designed preprocessing strategy for handling upper-tail extreme values. Instead of fully cutting values above a cap, AEPC compresses the excess part while preserving a controlled portion of the original extreme-value signal.
For a value above the AEPC cap, the adjusted value is computed as:
adjusted_value = cap + alpha * (original_value - cap)
Here, alpha controls how much of the excess signal is preserved. The value of alpha is determined from upper-tail characteristics such as tail ratio, target signal, and tail continuity. This makes AEPC less aggressive than hard clipping while still reducing the influence of extreme values.
['chlorides', 'volatile acidity', 'free sulfur dioxide', 'citric acid', 'residual sugar']
The selected threshold values are:
[3.5, 4.4, 5.65, 6.55, 7.35, 8.5]
| Split | RMSE Raw | MAE Raw | R2 Raw | Accuracy | Kappa | MAE_int | Macro F1 | Weighted F1 |
|---|---|---|---|---|---|---|---|---|
| Validation | 0.689850 | 0.531597 | 0.391591 | 0.577551 | 0.344654 | 0.465306 | 0.296927 | 0.555434 |
| Test | 0.693902 | 0.539958 | 0.386628 | 0.572449 | 0.339306 | 0.469388 | 0.277822 | 0.552183 |
Compared with the final single model, the selected ensemble improved integer quality prediction performance. The final single model achieved a test accuracy of 0.560204, test kappa of 0.310787, and test MAE_int of 0.492857, while this ensemble achieved a test accuracy of 0.572449, test kappa of 0.339306, and test MAE_int of 0.469388.
| File | Description |
|---|---|
models/ | Trained Keras member models |
preprocess/ | Preprocessing scalers and transformation parameters |
ensemble_config.json | Ensemble configuration and selected thresholds |
preprocess_config.json | Dataset, preprocessing, and training configuration |
metrics.json | Evaluation metrics |
member_model_results.csv | Raw regression results of the five member models |
confusion_matrix_selected.csv | Confusion matrix of the selected ensemble |
classification_report_selected.txt | Classification report of the selected ensemble |
inference.py | Example inference script |
requirements.txt | Required Python packages |
from inference import predict_quality
sample = {
"fixed acidity": 7.0,
"volatile acidity": 0.27,
"citric acid": 0.36,
"residual sugar": 20.7,
"chlorides": 0.045,
"free sulfur dioxide": 45.0,
"total sulfur dioxide": 170.0,
"density": 1.001,
"pH": 3.00,
"sulphates": 0.45,
"alcohol": 8.8
}
result = predict_quality(sample)
print(result)
The dataset is concentrated around middle quality scores, especially 5 and 6. As a result, predictions for rare extreme quality scores may be less reliable.
The ensemble can improve prediction stability by averaging multiple member models, but it may still have difficulty predicting rare extreme quality labels.