This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import bisect | |
from sklearn.preprocessing import LabelEncoder, MultiLabelBinarizer | |
from sklearn.utils.validation import check_is_fitted | |
class InductiveConformalPredictor(): | |
""" | |
Standard Conformal Predictor with uncertainty non-conformity score. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.model_selection import train_test_split | |
from sklearn.linear_model import LogisticRegression | |
from conformal.conformal_predictor import InductiveConformalPredictor | |
data = load_digits() | |
X, y = data.data, data.target | |
alpha = 0.05 | |
seed = 41 | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, |