nonconformist.evaluation.RegIcpCvHelper

class nonconformist.evaluation.RegIcpCvHelper(icp, calibration_portion=0.25)

Helper class for running the cross_val_score evaluation method on IcpRegressors.

See also

IcpClassCrossValHelper

Examples

>>> from sklearn.datasets import load_boston
>>> from sklearn.ensemble import RandomForestRegressor
>>> from nonconformist.icp import IcpRegressor
>>> from nonconformist.nc import RegressorNc, AbsErrorErrFunc
>>> from nonconformist.evaluation import RegIcpCvHelper
>>> from nonconformist.evaluation import reg_mean_errors
>>> from nonconformist.evaluation import cross_val_score
>>> data = load_boston()
>>> nc = RegressorNc(RandomForestRegressor(), AbsErrorErrFunc())
>>> icp = IcpRegressor(nc)
>>> icp_cv = RegIcpCvHelper(icp)
>>> cross_val_score(icp_cv,
...                 data.data,
...                 data.target,
...                 iterations=2,
...                 folds=2,
...                 scoring_funcs=[reg_mean_errors],
...                 significance_levels=[0.1])
...     
   fold  iter  reg_mean_errors  significance
0     0     0         0.185771           0.1
1     1     0         0.138340           0.1
2     0     1         0.071146           0.1
3     1     1         0.043478           0.1
__init__(icp, calibration_portion=0.25)
get_params(deep=True)

Get parameters for this estimator.

Parameters:

deep : boolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params : mapping of string to any

Parameter names mapped to their values.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:self