# How to compute tag SCORE in pos.teach?

**URL:** https://support.prodi.gy/t/how-to-compute-tag-score-in-pos-teach/1179
**Category:** Uncategorized
**Tags:** pos, solved, spacy
**Created:** [February 2, 2019, 9:54pm UTC](https://support.prodi.gy/t/how-to-compute-tag-score-in-pos-teach/1179 "2019-02-02T21:54:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeff](https://support.prodi.gy/u/Jeff)
#### Post date: [February 2, 2019, 9:54pm UTC](https://support.prodi.gy/t/how-to-compute-tag-score-in-pos-teach/1179/1 "2019-02-02T21:54:32Z")

</div>

With pos.teach, you show a score in the bottom right corner that indicates the confidence in the highlighted tag. Could you let me know how this is computed?

I tried:

```
math.exp(doc[0].prob)

```

since the docs describe Token.prob as a log probability, but the result is very different from the score in pos.teach.

I’d like to use this score for my own recipes.

---

<div class="post-metadata">

### Author: ![honnibal](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/honnibal/32/35_2.png) [@honnibal](https://support.prodi.gy/u/honnibal)
#### Post date: [February 4, 2019, 10:17am UTC](https://support.prodi.gy/t/how-to-compute-tag-score-in-pos-teach/1179/2 "2019-02-04T10:17:56Z")

</div>

@jeff `doc[0].prob` is the unigram probability of the word, i.e. its frequency. To get the probabilities from spaCy’s tagger, you would do:

```python
 
doc = nlp.make_doc(eg['text'])
tagger = nlp.get_pipe('tagger')
token_vectors = tagger.model.tok2vec([doc])
scores = tagger.model.softmax(token_vectors)

```

You can read more details in the Tagger implementation here: [https://github.com/explosion/spaCy/blob/master/spacy/pipeline.pyx](https://github.com/explosion/spaCy/blob/master/spacy/pipeline.pyx)

---

<div class="post-metadata">

### Author: ![Jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeff](https://support.prodi.gy/u/Jeff)
#### Post date: [February 4, 2019, 3:20pm UTC](https://support.prodi.gy/t/how-to-compute-tag-score-in-pos-teach/1179/3 "2019-02-04T15:20:22Z")

</div>

Perfect. Just what I needed.

---

<div class="post-metadata">

### Author: ![Jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeff](https://support.prodi.gy/u/Jeff)
#### Post date: [March 7, 2019, 6:03pm UTC](https://support.prodi.gy/t/how-to-compute-tag-score-in-pos-teach/1179/4 "2019-03-07T18:03:17Z")

</div>

@honnibal, could you please provide a similar code chunk to get the probabilities for the dep labels of the parser?

I’ve been looking through Spacy code but haven’t been able to figure it out.

---

<div class="post-metadata">

### Author: ![honnibal](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/honnibal/32/35_2.png) [@honnibal](https://support.prodi.gy/u/honnibal)
#### Post date: [March 8, 2019, 2:25pm UTC](https://support.prodi.gy/t/how-to-compute-tag-score-in-pos-teach/1179/5 "2019-03-08T14:25:56Z")

</div>

Getting probabilities out of the parser is much harder, because of the way the model’s objective works. There have been a few discussions about this on the issue tracker: [https://github.com/explosion/spaCy/issues?utf8=✓&q=probabilities](https://github.com/explosion/spaCy/issues?utf8=%E2%9C%93&q=probabilities) . I think this thread is the most comprehensive about the issue: [https://github.com/explosion/spaCy/issues/881](https://github.com/explosion/spaCy/issues/881)
