nonconformist.nc
.BaseModelNc¶
-
class
nonconformist.nc.
BaseModelNc
(model, err_func, normalizer=None, beta=0)¶ Base class for nonconformity scorers based on an underlying model.
Parameters: model : ClassifierAdapter or RegressorAdapter
Underlying classification model used for calculating nonconformity scores.
err_func : ClassificationErrFunc or RegressionErrFunc
Error function object.
-
__init__
(model, err_func, normalizer=None, beta=0)¶
-
fit
(x, y)¶ Fits the underlying model of the nonconformity scorer.
Parameters: x : numpy array of shape [n_samples, n_features]
Inputs of examples for fitting the underlying model.
y : numpy array of shape [n_samples]
Outputs of examples for fitting the underlying model.
Returns: None
-
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.
-
score
(x, y=None)¶ Calculates the nonconformity score of a set of samples.
Parameters: x : numpy array of shape [n_samples, n_features]
Inputs of examples for which to calculate a nonconformity score.
y : numpy array of shape [n_samples]
Outputs of examples for which to calculate a nonconformity score.
Returns: nc : numpy array of shape [n_samples]
Nonconformity scores of samples.
-
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
-