SAFER¶
SAFER implements the SAFER algorithm in [1].¶
References
[1] | Yu-Feng Li, Han-Wen Zha and Zhi-Hua Zhou. Construct Safe Prediction from Multiple Regressors. In: The 31st AAAI Conference on Artificial Intelligence % (AAAI‘17), San Francisco, California, 2017. |
-
class
s3l.model_uncertainty.SAFER.
SAFER
(estimator=False)[source]¶ Bases:
s3l.base.InductiveEstimatorWOGraph
-
baseline_predict
(X, y, l_ind)[source]¶ This is a 1NN regressor with euclidean distance measure.
Parameters: - X (array-like) – Data matrix with [n_samples, n_features] or a set of prediction.
- y (array-like) – Each element is +1 or -1 for labeled instances. For unlabeled instances, this parameter could be used for computing accuracy if the ground truth is available.
- l_ind (array-like) – a row vector with length l, where l is the number of labeled instance. Each element is an index of a labeled instance.
-
fit
(X, y, l_ind=None)[source]¶ Provide an interface that can pass in multiple learners or predictive results.
Parameters: - X (array-like) – Data matrix with [n_samples, n_features] or a set of prediction.
- y (array-like) – Each element is +1 or -1 for labeled instances. For unlabeled instances, this parameter could be used for computing accuracy if the ground truth is available.
- l_ind (array-like,optional(default=None)) – a row vector with length l, where l is the number of labeled instance. Each element is an index of a labeled instance.
-
fit_estimator
(X, y, l_ind, n_neighbors=3, metric='minkowski')[source]¶ Provide a training interface that trains multiple models and give a safer prediction of these models.
Parameters: - X (array-like) – Data matrix with [n_samples, n_features] or a set of prediction.
- y (array-like) – Each element is +1 or -1 for labeled instances. For unlabeled instances, this parameter could be used for computing accuracy if the ground truth is available.
- l_ind (array-like) – a row vector with length l, where l is the number of labeled instance. Each element is an index of a labeled instance.
-
fit_pred
(candidate_prediction=None, baseline_prediction=None)[source]¶ SAFER implements the SAFER algorithm in [1].
Parameters: - candidate_prediction (array-like, optical(default=None)) – a matrix with size instance_num * candidate_num . Each column vector of candidate_prediction is a candidate regression result.
- baseline_prediction (array-like, optical(default=None)) – a column vector with length instance_num. It is the regression result of the baseline method.
Returns: Safer_prediction – a predictive regression result by SAFER.
Return type: array-like
-