Spaces:
Build error
Build error
Download app.py from RubieeTariq/RMZ: direct link, hf CLI and curl.
- Browser
- Download file 565 Bytes
-
https://huggingface.co/spaces/RubieeTariq/RMZ/resolve/main/app.py
- Command line
-
hf download hf://spaces/RubieeTariq/RMZ/app.py
-
curl -L -o app.py https://huggingface.co/spaces/RubieeTariq/RMZ/resolve/main/app.py
565 Bytes
| import numpy as np | |
| from sklearn.linear_model import LogisticRegression | |
| import matplotlib.pyplot as plt | |
| # Generate some sample binary data | |
| np.random.seed(0) | |
| X = np.random.randn(100, 1) | |
| y = np.where(np.dot(X, np.array([0.5, 0.5])) > 0, 1, 0) | |
| # Create logistic regression object and fit the model to the data | |
| model = LogisticRegression() | |
| model.fit(X, y) | |
| # Predict probabilities | |
| predictions = model.predict_proba(X)[:,1] | |
| # Plot the results | |
| plt.scatter(X, y) | |
| plt.plot(X, predictions, color='red', alpha=0.5) | |
| plt.xlabel('Feature') | |
| plt.ylabel('Probability') | |
| plt.show() |