NTMC-Community / MatchZoo

Facilitating the design, comparison and sharing of deep text matching models.
Apache License 2.0
3.82k stars 898 forks source link

How can i get prediction labels 0 or 1 for the test set. #827

Open tramya28 opened 4 years ago

tramya28 commented 4 years ago

I am using MatchZoo version 2. I have several models from match zoo working. When i use the prediction, i get a prediction score between 0 and 1. Is there a way i could get 0 or 1 for each row in my test set instead of probability score. The current code i use is

pred_x, pred_y = test_processed.unpack() result = model.predict(pred_x) When i look at the result, i see an array of probability scores = [[0.6524335 0.34756643] [0.27325273 0.72674733] [0.2813605 0.71863943] ... [0.4537154 0.54628456] [0.2675834 0.7324166 ] [0.4178532 0.58214676]]

Is there a way i could get 0s and 1s instead of the probability scores for each test row?

faneshion commented 3 years ago

Typically, we can directly transform the score to labels through a pre-defined threshold, e.g., 0.5.