I'm using CalibratedClassifierCV to calibrate the probabilities of my CNN model. I'm using the following code:
from tensorflow.keras.models import load_model
from tensorflow.keras.wrappers.scikit_learn import KerasClassifier
from sklearn.calibration import CalibratedClassifierCV
def load_model(*args, **kwargs):
path="my_model.hd5"
model = load_model(path)
return model
clf = KerasClassifier(build_fn=load_model)
calib = CalibratedClassifierCV(clf, cv='prefit', method='sigmoid')
calib.fit(X_train, y_train)
When using this code I'm getting the error message AttributeError: 'KerasClassifier' object has no attribute 'model'. Also when I use clf.predict(X_test) I'm getting the same error. So something seems to be wrong with KerasClassifier.
Is there a mistake in my code?