# I have trained my classifier, now how do I do predictions?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fi-have-trained-my-classifier-now-how-do-i-do-predictions%2F3625%3E%5C
**Category:** Beginners\
**Created:** [February 13, 2021, 12:09pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fi-have-trained-my-classifier-now-how-do-i-do-predictions%2F3625 "2021-02-13T12:09:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flewtun)%5C
**Post date:** [February 13, 2021, 12:57pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fi-have-trained-my-classifier-now-how-do-i-do-predictions%2F3625%2F2 "2021-02-13T12:57:32Z")

</div>

Hi @Abe, if I understand correctly you’d like to go from an input string like “I love this movie!” to a set of predicted labels and their confidence scores (i.e. probabilities).

The simplest way to achieve that would be to wrap your model and tokenizer in a [`TextClassificationPipeline`](https://huggingface.co/transformers/main_classes/pipelines.html?highlight=textclassificationpipeline#transformers.TextClassificationPipeline) with `return_all_scores=True`:

```auto
from transformers import TextClassificationPipeline

model = ...
tokenizer = ...
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True)
# outputs a list of dicts like [[{'label': 'NEGATIVE', 'score': 0.0001223755971295759}, {'label': 'POSITIVE', 'score': 0.9998776316642761}]]
pipe("I love this movie!")

```

The above also works for multiple inputs by feed a list of examples instead of a single string:

```auto
pipe(["I love this movie!", "I hate this movie!"])

```

If you want to have human-readable labels like “positive” and “negative” you can configure the `id2label` and `label2id` attributes of your model’s config class: [Change label names on inference API - #3 by lewtun](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fchange-label-names-on-inference-api%2F3063%2F3)

HTH!

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fi-have-trained-my-classifier-now-how-do-i-do-predictions%2F3625)._
