chemicalchecker.tool.targetmate.nonconformist.nc.BaseModelNc
- class BaseModelNc(model, err_func, normalizer=None, beta=0)[source]
Bases:
BaseScorer
Base class for nonconformity scorers based on an underlying model.
Parameters
- modelClassifierAdapter or RegressorAdapter
Underlying classification model used for calculating nonconformity scores.
- err_funcClassificationErrFunc or RegressionErrFunc
Error function object.
- normalizerBaseScorer
Normalization model.
- betafloat
Normalization smoothing parameter. As the beta-value increases, the normalized nonconformity function approaches a non-normalized equivalent.
Methods
Fits the underlying model of the nonconformity scorer.
Get parameters for this estimator.
Calculates the nonconformity score of a set of samples.
Set the parameters of this estimator.
- fit(x, y)[source]
Fits the underlying model of the nonconformity scorer.
Parameters
- xnumpy array of shape [n_samples, n_features]
Inputs of examples for fitting the underlying model.
- ynumpy 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
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns
- paramsdict
Parameter names mapped to their values.
- score(x, y=None)[source]
Calculates the nonconformity score of a set of samples.
Parameters
- xnumpy array of shape [n_samples, n_features]
Inputs of examples for which to calculate a nonconformity score.
- ynumpy array of shape [n_samples]
Outputs of examples for which to calculate a nonconformity score.
Returns
- ncnumpy 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
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.Parameters
- **paramsdict
Estimator parameters.
Returns
- selfestimator instance
Estimator instance.