This file contains 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
def get_jacobian(net, x, noutputs): | |
x = x.squeeze() | |
n = x.size()[0] | |
x = x.repeat(noutputs, 1) | |
x.requires_grad_(True) | |
y = net(x) | |
y.backward(torch.eye(noutputs)) | |
return x.grad.data |
This file contains 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, |
OlderNewer