Spaces:
Runtime error
Runtime error
# companion script to st-space-creator.py | |
import pickle | |
import pandas as pd | |
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) | |
df.to_csv("data.csv", index=False) | |