# How to convert single-class BertForSequenceClassification prediction into probability?

**URL:** <https://discuss.huggingface.co/t/how-to-convert-single-class-bertforsequenceclassification-prediction-into-probability/21250>\
**Category:** Models\
**Created:** [August 4, 2022, 7:03pm UTC](https://discuss.huggingface.co/t/how-to-convert-single-class-bertforsequenceclassification-prediction-into-probability/21250 "2022-08-04T19:03:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thalesfc](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/thalesfc/32/23182_2.png) [@thalesfc](https://discuss.huggingface.co/u/thalesfc)\
**Post date:** [August 4, 2022, 7:03pm UTC](https://discuss.huggingface.co/t/how-to-convert-single-class-bertforsequenceclassification-prediction-into-probability/21250/1 "2022-08-04T19:03:22Z")

</div>

- I am using MS MARCO Cross-Encoders([MS MARCO Cross-Encoders — Sentence-Transformers documentation](https://www.sbert.net/docs/pretrained-models/ce-msmarco.html)) to calculate the similarity between two sentences.

- Looking at the pre-trained model configuration, this is a BertForSequenceClassification.

- As pointed out by this question([Which loss function in bertforsequenceclassification regression](https://discuss.huggingface.co/t/which-loss-function-in-bertforsequenceclassification-regression/1432)), with single class this model trains as a regression.

- Currently, my recommendations are coming in a range outside 0…1, for example:

- **Quesstion:** how do I convert this prediction into a probability?
