File size: 2,696 Bytes
4d8c0d4 2b04264 ee936e4 da9aabc 4d8c0d4 180a5b5 e63a929 4d8c0d4 9f33adf 4d8c0d4 cae06d8 4d8c0d4 cae06d8 4d8c0d4 cae06d8 4d8c0d4 cae06d8 4d8c0d4 cae06d8 4d8c0d4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
---
tags:
- tabular-classification
- sklearn
datasets:
- wine-quality
- lvwerra/red-wine
widget:
structuredData:
fixed_acidity:
- 7.4
- 7.8
- 10.3
volatile_acidity:
- 0.7
- 0.88
- 0.32
citric_acid:
- 0
- 0
- 0.45
residual_sugar:
- 1.9
- 2.6
- 6.4
chlorides:
- 0.076
- 0.098
- 0.073
free_sulfur_dioxide:
- 11
- 25
- 5
total_sulfur_dioxide:
- 34
- 67
- 13
density:
- 0.9978
- 0.9968
- 0.9976
pH:
- 3.51
- 3.2
- 3.23
sulphates:
- 0.56
- 0.68
- 0.82
alcohol:
- 9.4
- 9.8
- 12.6
---
## Wine Quality classification
### A Simple Example of Scikit-learn Pipeline
> Inspired by https://towardsdatascience.com/a-simple-example-of-pipeline-in-machine-learning-with-scikit-learn-e726ffbb6976 by Saptashwa Bhattacharyya
### How to use
```python
from huggingface_hub import hf_hub_url, cached_download
import joblib
import pandas as pd
REPO_ID = "julien-c/wine-quality"
FILENAME = "sklearn_model.joblib"
model = joblib.load(cached_download(
hf_hub_url(REPO_ID, FILENAME)
))
# model is a `sklearn.pipeline.Pipeline`
```
#### Get sample data from this repo
```python
data_file = cached_download(
hf_hub_url(REPO_ID, "winequality-red.csv")
)
winedf = pd.read_csv(data_file, sep=";")
X = winedf.drop(["quality"], axis=1)
Y = winedf["quality"]
print(X[:3])
```
| | fixed acidity | volatile acidity | citric acid | residual sugar | chlorides | free sulfur dioxide | total sulfur dioxide | density | pH | sulphates | alcohol |
|---:|----------------:|-------------------:|--------------:|-----------------:|------------:|----------------------:|-----------------------:|----------:|-----:|------------:|----------:|
| 0 | 7.4 | 0.7 | 0 | 1.9 | 0.076 | 11 | 34 | 0.9978 | 3.51 | 0.56 | 9.4 |
| 1 | 7.8 | 0.88 | 0 | 2.6 | 0.098 | 25 | 67 | 0.9968 | 3.2 | 0.68 | 9.8 |
| 2 | 7.8 | 0.76 | 0.04 | 2.3 | 0.092 | 15 | 54 | 0.997 | 3.26 | 0.65 | 9.8 |
#### Get your prediction
```python
labels = model.predict(X[:3])
# [5, 5, 5]
```
#### Eval
```python
model.score(X, Y)
# 0.6616635397123202
```
### 🍷 Disclaimer
No red wine was drunk (unfortunately) while training this model 🍷
|