Conformal Predictions Example¶
In [1]:
Copied!
import photonai_conformal
from sklearn.datasets import load_diabetes
from sklearn.model_selection import KFold
from sklearn.gaussian_process import GaussianProcessRegressor
from photonai.base import Hyperpipe, PipelineElement
import photonai_conformal
from sklearn.datasets import load_diabetes
from sklearn.model_selection import KFold
from sklearn.gaussian_process import GaussianProcessRegressor
from photonai.base import Hyperpipe, PipelineElement
Define Hyperpipe¶
In [2]:
Copied!
my_pipe = Hyperpipe('conformal_pipe',
optimizer='random_search',
metrics=['mean_squared_error', 'mean_absolute_error', 'explained_variance'],
best_config_metric='mean_squared_error',
outer_cv=KFold(n_splits=3, shuffle=True),
inner_cv=KFold(n_splits=3, shuffle=True),
verbosity=1,
project_folder='./tmp/')
my_pipe += PipelineElement("ConformalRegressor", estimator=GaussianProcessRegressor(), alpha=[.05, .5, .95])
my_pipe = Hyperpipe('conformal_pipe',
optimizer='random_search',
metrics=['mean_squared_error', 'mean_absolute_error', 'explained_variance'],
best_config_metric='mean_squared_error',
outer_cv=KFold(n_splits=3, shuffle=True),
inner_cv=KFold(n_splits=3, shuffle=True),
verbosity=1,
project_folder='./tmp/')
my_pipe += PipelineElement("ConformalRegressor", estimator=GaussianProcessRegressor(), alpha=[.05, .5, .95])
Load Data and fit Hyperpipe¶
In [3]:
Copied!
# load data and train
X, y = load_diabetes(return_X_y=True)
my_pipe.fit(X, y)
# load data and train
X, y = load_diabetes(return_X_y=True)
my_pipe.fit(X, y)
08/12/2022-10:09:45 | Output Folder: ./tmp/conformal_pipe_results_2022-12-08_10-09-45 ===================================================================================================== PHOTONAI ANALYSIS: conformal_pipe ===================================================================================================== 08/12/2022-10:09:45 | Preparing data and PHOTONAI objects for analysis... 08/12/2022-10:09:45 | Checking input data... 08/12/2022-10:09:45 | Running analysis with 442 samples. ***************************************************************************************************** Outer Cross validation Fold 1 ***************************************************************************************************** 08/12/2022-10:09:45 | Preparing data for outer fold 1... 08/12/2022-10:09:45 | Preparing Hyperparameter Optimization... 08/12/2022-10:09:45 | Running Dummy Estimator... +---------------------+-----------+ | PERFORMANCE DUMMY | | +---------------------+-----------+ | mean_squared_error | 5665.3336 | | mean_absolute_error | 63.2711 | | explained_variance | 0.0000 | +---------------------+-----------+ ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:45 | Computed configuration 1/10 in 0:00:00.593783 08/12/2022-10:09:45 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:45 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:46 | Computed configuration 2/10 in 0:00:00.579337 08/12/2022-10:09:46 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:46 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:47 | Computed configuration 3/10 in 0:00:00.656006 08/12/2022-10:09:47 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:47 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:47 | Computed configuration 4/10 in 0:00:00.595077 08/12/2022-10:09:47 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:47 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:48 | Computed configuration 5/10 in 0:00:00.626041 08/12/2022-10:09:48 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:48 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:48 | Computed configuration 6/10 in 0:00:00.625105 08/12/2022-10:09:48 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:48 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:49 | Computed configuration 7/10 in 0:00:00.789633 08/12/2022-10:09:49 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:49 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:50 | Computed configuration 8/10 in 0:00:00.542478 08/12/2022-10:09:50 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:50 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:51 | Computed configuration 9/10 in 0:00:00.732999 08/12/2022-10:09:51 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:51 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:51 | Computed configuration 10/10 in 0:00:00.575098 08/12/2022-10:09:51 | Performance: mean_squared_error - Train: 1.1064, Validation: 64398.6893 08/12/2022-10:09:51 | Best Performance So Far: mean_squared_error - Train: 1.1064, Validation: 64398.6893 ----------------------------------------------------------------------------------------------------- 08/12/2022-10:09:51 | Hyperparameter Optimization finished. Now finding best configuration .... 08/12/2022-10:09:51 | 10 ----------------------------------------------------------------------------------------------------- BEST_CONFIG ----------------------------------------------------------------------------------------------------- {} ----------------------------------------------------------------------------------------------------- VALIDATION PERFORMANCE ----------------------------------------------------------------------------------------------------- +---------------------+-------------------+------------------+ | METRIC | PERFORMANCE TRAIN | PERFORMANCE TEST | +---------------------+-------------------+------------------+ | mean_squared_error | 1.1064 | 64398.6893 | | mean_absolute_error | 0.5583 | 178.7847 | | explained_variance | 0.9998 | -9.6507 | +---------------------+-------------------+------------------+ 08/12/2022-10:09:51 | Calculating best model performance on test set... ----------------------------------------------------------------------------------------------------- TEST PERFORMANCE ----------------------------------------------------------------------------------------------------- +---------------------+-------------------+------------------+ | METRIC | PERFORMANCE TRAIN | PERFORMANCE TEST | +---------------------+-------------------+------------------+ | mean_squared_error | 31.5952 | 78518.8824 | | mean_absolute_error | 2.8278 | 179.6178 | | explained_variance | 0.9948 | -12.8099 | +---------------------+-------------------+------------------+ 08/12/2022-10:09:51 | Computations in outer fold 1 took 0.11271133333333333 minutes. 08/12/2022-10:09:51 | Writing results to project folder... ***************************************************************************************************** Outer Cross validation Fold 2 ***************************************************************************************************** 08/12/2022-10:09:52 | Preparing data for outer fold 2... 08/12/2022-10:09:52 | Preparing Hyperparameter Optimization... 08/12/2022-10:09:52 | Running Dummy Estimator... +---------------------+-----------+ | PERFORMANCE DUMMY | | +---------------------+-----------+ | mean_squared_error | 5589.0128 | | mean_absolute_error | 65.0693 | | explained_variance | 0.0000 | +---------------------+-----------+ ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:52 | Computed configuration 1/10 in 0:00:00.487182 08/12/2022-10:09:52 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:52 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:53 | Computed configuration 2/10 in 0:00:00.695313 08/12/2022-10:09:53 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:53 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:53 | Computed configuration 3/10 in 0:00:00.613144 08/12/2022-10:09:53 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:53 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:54 | Computed configuration 4/10 in 0:00:00.685237 08/12/2022-10:09:54 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:54 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:55 | Computed configuration 5/10 in 0:00:00.561149 08/12/2022-10:09:55 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:55 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:55 | Computed configuration 6/10 in 0:00:00.768976 08/12/2022-10:09:55 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:55 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:56 | Computed configuration 7/10 in 0:00:00.543172 08/12/2022-10:09:56 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:56 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:57 | Computed configuration 8/10 in 0:00:00.571397 08/12/2022-10:09:57 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:57 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:57 | Computed configuration 9/10 in 0:00:00.601174 08/12/2022-10:09:57 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:57 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:58 | Computed configuration 10/10 in 0:00:00.767903 08/12/2022-10:09:58 | Performance: mean_squared_error - Train: 2.9381, Validation: 158668.6659 08/12/2022-10:09:58 | Best Performance So Far: mean_squared_error - Train: 2.9381, Validation: 158668.6659 ----------------------------------------------------------------------------------------------------- 08/12/2022-10:09:58 | Hyperparameter Optimization finished. Now finding best configuration .... 08/12/2022-10:09:58 | 10 ----------------------------------------------------------------------------------------------------- BEST_CONFIG ----------------------------------------------------------------------------------------------------- {} ----------------------------------------------------------------------------------------------------- VALIDATION PERFORMANCE ----------------------------------------------------------------------------------------------------- +---------------------+-------------------+------------------+ | METRIC | PERFORMANCE TRAIN | PERFORMANCE TEST | +---------------------+-------------------+------------------+ | mean_squared_error | 2.9381 | 158668.6659 | | mean_absolute_error | 0.8032 | 254.6984 | | explained_variance | 0.9995 | -25.0422 | +---------------------+-------------------+------------------+ 08/12/2022-10:09:58 | Calculating best model performance on test set... ----------------------------------------------------------------------------------------------------- TEST PERFORMANCE ----------------------------------------------------------------------------------------------------- +---------------------+-------------------+------------------+ | METRIC | PERFORMANCE TRAIN | PERFORMANCE TEST | +---------------------+-------------------+------------------+ | mean_squared_error | 46.8030 | 61504.4041 | | mean_absolute_error | 3.8900 | 161.8759 | | explained_variance | 0.9924 | -10.8666 | +---------------------+-------------------+------------------+ 08/12/2022-10:09:58 | Computations in outer fold 2 took 0.11137263333333333 minutes. 08/12/2022-10:09:58 | Writing results to project folder... ***************************************************************************************************** Outer Cross validation Fold 3 ***************************************************************************************************** 08/12/2022-10:09:58 | Preparing data for outer fold 3... 08/12/2022-10:09:58 | Preparing Hyperparameter Optimization... 08/12/2022-10:09:58 | Running Dummy Estimator... +---------------------+-----------+ | PERFORMANCE DUMMY | | +---------------------+-----------+ | mean_squared_error | 6922.8665 | | mean_absolute_error | 70.1794 | | explained_variance | 0.0000 | +---------------------+-----------+ ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:09:59 | Computed configuration 1/10 in 0:00:00.690743 08/12/2022-10:09:59 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:09:59 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:00 | Computed configuration 2/10 in 0:00:00.655810 08/12/2022-10:10:00 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:00 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:01 | Computed configuration 3/10 in 0:00:00.710578 08/12/2022-10:10:01 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:01 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:01 | Computed configuration 4/10 in 0:00:00.571774 08/12/2022-10:10:01 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:01 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:02 | Computed configuration 5/10 in 0:00:00.573869 08/12/2022-10:10:02 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:02 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:02 | Computed configuration 6/10 in 0:00:00.621695 08/12/2022-10:10:02 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:02 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:03 | Computed configuration 7/10 in 0:00:00.630495 08/12/2022-10:10:03 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:03 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:04 | Computed configuration 8/10 in 0:00:00.724085 08/12/2022-10:10:04 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:04 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:04 | Computed configuration 9/10 in 0:00:00.594450 08/12/2022-10:10:04 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:04 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- {} {} {} 08/12/2022-10:10:05 | Computed configuration 10/10 in 0:00:00.686244 08/12/2022-10:10:05 | Performance: mean_squared_error - Train: 2.3669, Validation: 234026.1518 08/12/2022-10:10:05 | Best Performance So Far: mean_squared_error - Train: 2.3669, Validation: 234026.1518 ----------------------------------------------------------------------------------------------------- 08/12/2022-10:10:05 | Hyperparameter Optimization finished. Now finding best configuration .... 08/12/2022-10:10:05 | 10 ----------------------------------------------------------------------------------------------------- BEST_CONFIG ----------------------------------------------------------------------------------------------------- {} ----------------------------------------------------------------------------------------------------- VALIDATION PERFORMANCE ----------------------------------------------------------------------------------------------------- +---------------------+-------------------+------------------+ | METRIC | PERFORMANCE TRAIN | PERFORMANCE TEST | +---------------------+-------------------+------------------+ | mean_squared_error | 2.3669 | 234026.1518 | | mean_absolute_error | 0.7924 | 260.0707 | | explained_variance | 0.9996 | -42.4732 | +---------------------+-------------------+------------------+ 08/12/2022-10:10:05 | Calculating best model performance on test set... ----------------------------------------------------------------------------------------------------- TEST PERFORMANCE ----------------------------------------------------------------------------------------------------- +---------------------+-------------------+------------------+ | METRIC | PERFORMANCE TRAIN | PERFORMANCE TEST | +---------------------+-------------------+------------------+ | mean_squared_error | 47.3563 | 77965.6949 | | mean_absolute_error | 3.8732 | 169.7198 | | explained_variance | 0.9914 | -10.2653 | +---------------------+-------------------+------------------+ 08/12/2022-10:10:05 | Computations in outer fold 3 took 0.11340325 minutes. 08/12/2022-10:10:05 | Writing results to project folder... ***************************************************************************************************** Finished all outer fold computations. 08/12/2022-10:10:06 | Now analysing the final results... 08/12/2022-10:10:06 | Computing dummy metrics... 08/12/2022-10:10:06 | Computing mean and std for all outer fold metrics... 08/12/2022-10:10:06 | Find best config across outer folds... 08/12/2022-10:10:06 | Save final results... 08/12/2022-10:10:06 | Writing results to project folder... 08/12/2022-10:10:06 | Prepare Hyperpipe.optimum pipe with best config.. 08/12/2022-10:10:06 | Fitting best model... 08/12/2022-10:10:06 | Saved best model to file. 08/12/2022-10:10:06 | Mapping back feature importances... 08/12/2022-10:10:06 | No feature importances available for ConformalRegressor! 08/12/2022-10:10:06 | Summarizing results... 08/12/2022-10:10:06 | Write predictions to files... 08/12/2022-10:10:06 | Write summary... ***************************************************************************************************** ANALYSIS INFORMATION ================================================================================ Project Folder: ./tmp/conformal_pipe_results_2022-12-08_10-09-45, Computation Time: 2022-12-08 10:09:45.177943 - 2022-12-08 10:10:06.009422 Duration: 0:00:20.831479 Optimized for: mean_squared_error Hyperparameter Optimizer: random_search DUMMY RESULTS ======================================================================================= +---------------------+-----------+ | PERFORMANCE DUMMY | | +---------------------+-----------+ | mean_squared_error | 6059.0709 | | mean_absolute_error | 66.1733 | | explained_variance | 0.0000 | +---------------------+-----------+ AVERAGE PERFORMANCE ACROSS OUTER FOLDS ============================================================== +---------------------+---------------+--------------+--------------+-------------+ | Metric Name | Training Mean | Training Std | Test Mean | Test Std | +---------------------+---------------+--------------+--------------+-------------+ | mean_squared_error | 41.918178 | 7.302952 | 72662.993791 | 7893.545766 | | mean_absolute_error | 3.53034 | 0.496815 | 170.404479 | 7.259271 | | explained_variance | 0.992854 | 0.001436 | -11.313916 | 1.08594 | +---------------------+---------------+--------------+--------------+-------------+ BEST HYPERPARAMETER CONFIGURATION =================================================================== {} +--------+--------------------+---------------------+--------------------+----------------------------+ | fold # | mean_squared_error | mean_absolute_error | explained_variance | Best Hyperparameter Config | +--------+--------------------+---------------------+--------------------+----------------------------+ | 1 | 78518.8824 | 179.6178 | -12.8099 | {} | | 2* | 61504.4041 | 161.8759 | -10.8666 | {} | | 3 | 77965.6949 | 169.7198 | -10.2653 | {} | +--------+--------------------+---------------------+--------------------+----------------------------+ PHOTONAI 2.2.1 ====================================================================================== Your results are stored in ./tmp/conformal_pipe_results_2022-12-08_10-09-45 Go to https://explorer.photon-ai.com and upload your photon_result_file.json for convenient result visualization! For more info and documentation visit https://www.photon-ai.com
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/IPython/core/formatters.py:972, in MimeBundleFormatter.__call__(self, obj, include, exclude) 969 method = get_real_method(obj, self.print_method) 971 if method is not None: --> 972 return method(include=include, exclude=exclude) 973 return None 974 else: File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/base.py:631, in BaseEstimator._repr_mimebundle_(self, **kwargs) 629 output = {"text/plain": repr(self)} 630 if get_config()["display"] == "diagram": --> 631 output["text/html"] = estimator_html_repr(self) 632 return output File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/utils/_estimator_html_repr.py:417, in estimator_html_repr(estimator) 403 fallback_msg = ( 404 "In a Jupyter environment, please rerun this cell to show the HTML" 405 " representation or trust the notebook. <br />On GitHub, the" 406 " HTML representation is unable to render, please try loading this page" 407 " with nbviewer.org." 408 ) 409 out.write( 410 f"<style>{style_with_id}</style>" 411 f'<div id="{container_id}" class="sk-top-container">' (...) 415 '<div class="sk-container" hidden>' 416 ) --> 417 _write_estimator_html( 418 out, 419 estimator, 420 estimator.__class__.__name__, 421 estimator_str, 422 first_call=True, 423 ) 424 out.write("</div></div>") 426 html_output = out.getvalue() File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/utils/_estimator_html_repr.py:151, in _write_estimator_html(out, estimator, estimator_label, estimator_label_details, first_call) 149 """Write estimator to html in serial, parallel, or by itself (single).""" 150 if first_call: --> 151 est_block = _get_visual_block(estimator) 152 else: 153 with config_context(print_changed_only=True): File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/utils/_estimator_html_repr.py:127, in _get_visual_block(estimator) 123 # check if estimator looks like a meta estimator wraps estimators 124 if hasattr(estimator, "get_params"): 125 estimators = [ 126 (key, est) --> 127 for key, est in estimator.get_params(deep=False).items() 128 if hasattr(est, "get_params") and hasattr(est, "fit") 129 ] 130 if estimators: 131 return _VisualBlock( 132 "parallel", 133 [est for _, est in estimators], 134 names=[f"{key}: {est.__class__.__name__}" for key, est in estimators], 135 name_details=[str(est) for _, est in estimators], 136 ) File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/base.py:211, in BaseEstimator.get_params(self, deep) 209 out = dict() 210 for key in self._get_param_names(): --> 211 value = getattr(self, key) 212 if deep and hasattr(value, "get_params") and not isinstance(value, type): 213 deep_items = value.get_params().items() AttributeError: 'Hyperpipe' object has no attribute 'best_config_metric'
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/IPython/core/formatters.py:342, in BaseFormatter.__call__(self, obj) 340 method = get_real_method(obj, self.print_method) 341 if method is not None: --> 342 return method() 343 return None 344 else: File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/base.py:625, in BaseEstimator._repr_html_inner(self) 620 def _repr_html_inner(self): 621 """This function is returned by the @property `_repr_html_` to make 622 `hasattr(estimator, "_repr_html_") return `True` or `False` depending 623 on `get_config()["display"]`. 624 """ --> 625 return estimator_html_repr(self) File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/utils/_estimator_html_repr.py:417, in estimator_html_repr(estimator) 403 fallback_msg = ( 404 "In a Jupyter environment, please rerun this cell to show the HTML" 405 " representation or trust the notebook. <br />On GitHub, the" 406 " HTML representation is unable to render, please try loading this page" 407 " with nbviewer.org." 408 ) 409 out.write( 410 f"<style>{style_with_id}</style>" 411 f'<div id="{container_id}" class="sk-top-container">' (...) 415 '<div class="sk-container" hidden>' 416 ) --> 417 _write_estimator_html( 418 out, 419 estimator, 420 estimator.__class__.__name__, 421 estimator_str, 422 first_call=True, 423 ) 424 out.write("</div></div>") 426 html_output = out.getvalue() File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/utils/_estimator_html_repr.py:151, in _write_estimator_html(out, estimator, estimator_label, estimator_label_details, first_call) 149 """Write estimator to html in serial, parallel, or by itself (single).""" 150 if first_call: --> 151 est_block = _get_visual_block(estimator) 152 else: 153 with config_context(print_changed_only=True): File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/utils/_estimator_html_repr.py:127, in _get_visual_block(estimator) 123 # check if estimator looks like a meta estimator wraps estimators 124 if hasattr(estimator, "get_params"): 125 estimators = [ 126 (key, est) --> 127 for key, est in estimator.get_params(deep=False).items() 128 if hasattr(est, "get_params") and hasattr(est, "fit") 129 ] 130 if estimators: 131 return _VisualBlock( 132 "parallel", 133 [est for _, est in estimators], 134 names=[f"{key}: {est.__class__.__name__}" for key, est in estimators], 135 name_details=[str(est) for _, est in estimators], 136 ) File /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/sklearn/base.py:211, in BaseEstimator.get_params(self, deep) 209 out = dict() 210 for key in self._get_param_names(): --> 211 value = getattr(self, key) 212 if deep and hasattr(value, "get_params") and not isinstance(value, type): 213 deep_items = value.get_params().items() AttributeError: 'Hyperpipe' object has no attribute 'best_config_metric'
Out[3]:
Hyperpipe(name='conformal_pipe')