Autoencoder prediction for single record

HI,

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

x=[402,-0.160626023844866,-0.0644592715749079,2.53107242920104,-1.32826789668652,-0.970429962152532,0.185030499749121,-0.380184273955408,0.078119056922537,1.77595623371714,-1.24231480332541,-0.364953829901919,0.435456870671237,0.0395015202936356,-0.760588288546284,1.70160412646751,-1.23341666950173,0.497776404087423,0.194699717703905,1.43068504978307,0.130322208087451,0.262123747446068,1.34069624745507,-0.25386003202542,0.178600525071912,-0.491121059669452,0.24497199815904,0.0748290902309209,-0.0699236364318091]

autoencoder = load_model(‘model.h5’)
b=np.reshape(x,(1,29))
predictions = autoencoder.predict(b,verbose=0)

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

Thanks
vijay

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.