Created
August 30, 2022 20:38
-
-
Save erykml/6143a1dfe6b2909c3788fb7063f60cb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N_SAMPLES = 500 | |
N_OUTLIERS = 25 | |
X, y, coef = datasets.make_regression( | |
n_samples=N_SAMPLES, | |
n_features=1, | |
n_informative=1, | |
noise=20, | |
coef=True, | |
random_state=42 | |
) | |
coef_list = [["original_coef", float(coef)]] | |
# add outliers | |
np.random.seed(42) | |
X[:N_OUTLIERS] = 10 + 0.75 * np.random.normal(size=(N_OUTLIERS, 1)) | |
y[:N_OUTLIERS] = -15 + 20 * np.random.normal(size=N_OUTLIERS) | |
plt.scatter(X, y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment