Spaces:
Runtime error
Runtime error
Download make-data.py from BenjaminB/skops-model-card-creator2: direct link, hf CLI and curl.
- Browser
- Download file 603 Bytes
-
https://huggingface.co/spaces/BenjaminB/skops-model-card-creator2/resolve/main/make-data.py
- Command line
-
hf download hf://spaces/BenjaminB/skops-model-card-creator2/make-data.py
-
curl -L -o make-data.py https://huggingface.co/spaces/BenjaminB/skops-model-card-creator2/resolve/main/make-data.py
603 Bytes
| # companion script to st-space-creator.py | |
| import pickle | |
| import pandas as pd | |
| import skops.io as sio | |
| from sklearn.datasets import make_classification | |
| from sklearn.linear_model import LogisticRegression | |
| from sklearn.pipeline import Pipeline | |
| from sklearn.preprocessing import StandardScaler | |
| X, y = make_classification() | |
| df = pd.DataFrame(X) | |
| clf = Pipeline( | |
| [ | |
| ("scale", StandardScaler()), | |
| ("clf", LogisticRegression(random_state=0)), | |
| ] | |
| ) | |
| clf.fit(X, y) | |
| with open("logreg.pkl", "wb") as f: | |
| pickle.dump(clf, f) | |
| sio.dump(clf, "logreg.skops") | |
| df.to_csv("data.csv", index=False) | |