I am working with otpod to estimate POD with the Adaptive Hit-Miss method. I did not manage to reuse the classifier to compute confusion matrix. Of course, there is a method to compute confusion matrix directly, but it is only computed on added points, not on the whole dataset. I would like to compute the confusion matrix on new data by using the method AdaptiveHitMissPOD.getClassifier)(), but i don’t understand the type of argument which is required. The input data object we used to run the HitMiss method is not compatible with the ot.Function returned by getClassifier().
How can I use the ot.Function properly to evaluate the confusion matrix with sklearn ?
HM_model = POD1.getClassifier()
pred = HM_model(inputDOE)
from sklearn.metrics import confusion_matrix
# outputDOE is composed of floats, but we need 1 (>detection) or 0.
ref = np.where(np.array(outputDOE) > detection, 1, 0)
# pred is composed of 2 columns, but we want just one !
pred_melt = pred.argmax(axis=1)
# confusion matrix
cf_mat = confusion_matrix(ref, pred_melt)
Is it correct ?
I haven’t check if the classifier is used directly like this inside AdaptiveHitMissPOD.
This part of the module was developped using scikit learn. Yes I checked inside the code, the confusion matrix is computed using the method imported from metrics: