File size: 1,006 Bytes
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
---
tags:
- structured-data-classification
dataset:
- wine-quality
library_name: scikit-learn
---

## 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


### 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`

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"]


labels = model.predict(X[:3])
```

^^ get your prediction

#### Eval

```python
model.score(X, Y)
# 0.6616635397123202
```

### 🍷 Disclaimer

No red wine was drunk (unfortunately) while training this model 🍷