@@ -37,7 +37,7 @@ Let us start with a basic regression problem.
3737Here, we generate one-dimensional noisy data that we fit with a linear model.
3838
3939..
40- Comment to developers: the following piece of code is duplicated in `examples/regression/1-quickstart/plot_toy_model.py`.
40+ Comment to developers: the following piece of code is heavily inspired by `examples/regression/1-quickstart/plot_toy_model.py`.
4141 When updating it, please replicate the changes to this other file.
4242
4343.. testcode ::
@@ -46,25 +46,18 @@ Here, we generate one-dimensional noisy data that we fit with a linear model.
4646 from sklearn.datasets import make_regression
4747 from sklearn.model_selection import train_test_split
4848
49- RANDOM_STATE = 42
50- X, y = make_regression(n_samples=500, n_features=1, noise=20, random_state=RANDOM_STATE)
51- X_train_conformalize, X_test, y_train_conformalize, y_test = train_test_split(
52- X, y, test_size=0.5, random_state=RANDOM_STATE
53- )
54- X_train, X_conformalize, y_train, y_conformalize = train_test_split(
55- X_train_conformalize, y_train_conformalize, test_size=0.5, random_state=RANDOM_STATE
56- )
49+ X, y = make_regression(n_samples=500, n_features=1, noise=20)
50+
51+ X_train, X_temp, y_train, y_temp = train_test_split(X, y)
52+ X_test, X_conformalize, y_test, y_conformalize = train_test_split(X_temp, y_temp)
5753
5854 # We follow a sequential ``fit ``, ``conformalize ``, and ``predict `` process.
5955 # We set the confidence level to estimate prediction intervals at approximately one and two
6056 # standard deviation from the mean.
6157
6258 from mapie_v1.regression import SplitConformalRegressor
6359
64- mapie_regressor = SplitConformalRegressor(
65- confidence_level=[0.95, 0.68],
66- prefit=False,
67- )
60+ mapie_regressor = SplitConformalRegressor(confidence_level=[0.95, 0.68], prefit=False)
6861 mapie_regressor.fit(X_train, y_train)
6962 mapie_regressor.conformalize(X_conformalize, y_conformalize)
7063
0 commit comments