Chandan Singh commited on
Commit
6849df4
1 Parent(s): 132dd26

update readme

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md CHANGED
@@ -1,3 +1,64 @@
1
  ---
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+
5
+ ---
6
+ tags:
7
+ - tabular-classification
8
+ - sklearn
9
+ datasets:
10
+ - wine-quality
11
+ - imodels/compas-recidivism
12
+ ---
13
+
14
+
15
+ ### Load the data
16
+
17
+ ```python
18
+ from datasets import load_dataset
19
+ import imodels
20
+ import numpy as np
21
+ from sklearn.model_selection import GridSearchCV
22
+ import joblib
23
+
24
+ dataset = load_dataset("imodels/compas-recidivism")
25
+ df = pd.DataFrame(dataset['train'])
26
+ X_train = df.drop(columns=['is_recid'])
27
+ y_train = df['is_recid'].values
28
+
29
+ df_test = pd.DataFrame(dataset['test'])
30
+ X_test = df.drop(columns=['is_recid'])
31
+ y_test = df['is_recid'].values
32
+ ```
33
+
34
+ ### Load the model
35
+ ## Wine Quality classification
36
+
37
+ ### A Simple Example of Scikit-learn Pipeline
38
+
39
+ > Inspired by https://towardsdatascience.com/a-simple-example-of-pipeline-in-machine-learning-with-scikit-learn-e726ffbb6976 by Saptashwa Bhattacharyya
40
+
41
+
42
+ ### Load the model
43
+
44
+ ```python
45
+ from huggingface_hub import hf_hub_url, cached_download
46
+ import joblib
47
+ import pandas as pd
48
+
49
+ REPO_ID = "imodels/figs-compas-recidivism"
50
+ FILENAME = "figs_model.joblib"
51
+
52
+ model = joblib.load(cached_download(
53
+ hf_hub_url(REPO_ID, FILENAME)
54
+ ))
55
+
56
+ # model is a `imodels.FIGSClassifier`
57
+ ```
58
+
59
+ ### Make prediction
60
+
61
+ ```
62
+ preds = model.predict(X_test)
63
+ print('accuracy', np.mean(preds==y_test))
64
+ ```