Autoencoder prediction for single record


WE have trained a dataset for credit fraud detection and we want to predict single record whether it belongs to class 1 or 0
FYI: 1 means fraud and 0 means normal

The below code is inspired from the below link


autoencoder = load_model(‘model.h5’)
predictions = autoencoder.predict(b,verbose=0)

From the output “predictions” we r not able to get the class. pls suggest


It looks like you are using Keras or did you implement the same model in PyTorch?
If so, could you post the model architecture or the shape of your last linear layer?
I assume you’ve used a single output with nn.BCELoss/nn.BCEWithLogitsLoss or two output units with nn.CrossEntropyLoss/nn.NLLLoss.
In the first case, you can just apply a threshold (e.g. 0.5) or fine tune it using the ROC, which you would apply torch.argmax(output, 1) in the latter case to get the prediction.