# textcat.batch-train question

**URL:** <https://support.prodi.gy/t/textcat-batch-train-question/6074>\
**Category:** Uncategorized\
**Created:** [November 4, 2022, 1:40pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074 "2022-11-04T13:40:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiebei](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jiebei](https://support.prodi.gy/u/jiebei)\
**Post date:** [November 4, 2022, 1:40pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/1 "2022-11-04T13:40:21Z")

</div>

Hi, I am following [this tutorial](https://prodi.gy/docs/text-classification#video-insults-classifier) to explore textcat. When I run the command below, i got "Can't find recipe or command 'textcat.batch-train'." error, I was wondering if this is the correct recipe to use? Thanks!

```python
python -m prodigy textcat.batch-train textcat_insults en_vectore_web_lg --output insults-model --eval-split 0.2

```

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [November 4, 2022, 1:54pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/2 "2022-11-04T13:54:17Z")

</div>

hi @jiebei!

`batch-train` recipes like `ner.batch-train` and `textcat-batch-train` were [deprecated](https://prodi.gy/docs/recipes#textcat-batch-train) and removed as of [v1.11](https://prodi.gy/docs/changelog#v1.11.0). That video was created long ago and that's the one issue with creating video tutorials: we can't fix it if we make changes to our code in the future.

Instead use the [`train`](https://prodi.gy/docs/recipes/#train) recipe. This is a general function where now you have to provide as an argument what type of model you want to train with the training dataset `train --textcat [training_dataset]` where, `[training_dataset]` is the name of your training dataset.

Let us know if you have any questions!

---

<div class="post-metadata">

**Author:** ![jiebei](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jiebei](https://support.prodi.gy/u/jiebei)\
**Post date:** [November 4, 2022, 6:24pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/3 "2022-11-04T18:24:24Z")

</div>

Thanks for pointing me to the updated docs. I used --textcat-multilabel for my two label annotation data, and obtained the results as attached below.

I am thinking of a few things to try next, e.g., revising my schema (having more labels in the same level, or creating a nested schema with more labels), and moving to use the model on a large chat dataset for real categorization. Could you recommend a few steps for me to get on track? Thanks again!

 ![image](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/9/9b6ef0ba616a9ce7adc396f7d7f1b098489d3f07.png)

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [November 7, 2022, 1:48pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/4 "2022-11-07T13:48:49Z")

</div>

hi @jiebei!

> [@jiebei](#):
>
> Could you recommend a few steps for me to get on track?

I would recommend using [`textcat.correct`](https://prodi.gy/docs/recipes/#textcat-correct) to identify weak spots in your model.

The idea would be with your current model to look at examples and to understand what are problems your model is still having (i.e., is there a pattern in the incorrect examples).

Hopefully by doing this, it should answer your question of the next step. For example, if you're finding the model is struggling on examples that seem not to fit either of your two labels, this may suggest the need of expanding to three labels. Alternatively, if it's looking like there are sub-categories within your existing categories, that's more indicative that you may want to create nested labels.

---

<div class="post-metadata">

**Author:** ![jiebei](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jiebei](https://support.prodi.gy/u/jiebei)\
**Post date:** [November 22, 2022, 1:10am UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/5 "2022-11-22T01:10:22Z")

</div>

Hi Ryan, I have a follow up question of using textcat. Let's say I have obtained a satisfactory model to categorize my chat data with Research, and Nonsearch, how can I use the model to process my over about 1 million chat data?  
If I am thinking of moving to adding more categories, but with two potential approaches, one level or two levels, how can I compare these two models down the road?

Thank you so much for your thoughts!

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [November 25, 2022, 2:34pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/6 "2022-11-25T14:34:10Z")

</div>

hi @jiebei!

> [@jiebei](#):
>
> how can I use the model to process my over about 1 million chat data?

So is your question: how to speed up your spaCy model to handle lots of text?

@koaning has a great video on using `nlp.pipe`:

[![](https://img.youtube.com/vi/OoZ-H_8vRnc/maxresdefault.jpg "Speed up spaCy pipelines via `nlp.pipe` - spaCy shorts") ](https://www.youtube.com/watch?v=OoZ-H_8vRnc)

> [@jiebei](#):
>
> If I am thinking of moving to adding more categories, but with two potential approaches, one level or two levels, how can I compare these two models down the road?

As you probably realized, if you have different categorization schemes, it's a bit hard to compare across accuracies. However, one resource is @koaning's [`spacy-report`](https://github.com/koaning/spacy-report) package. It can allow you to compare precision/recall tradeoffs by category. This package can help evaluate the performance for each model by category, thus finding where either model may have weaknesses by category.

![gif (1)](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/4/41d07c3b8d98d0120e86b6ec19158332af203113.gif)

Alternatively, you could move towards more qualitative approaches by comparing examples. One idea could be to use [`spacy-streamlit`](https://github.com/explosion/spacy-streamlit) to load either models and apply it to input text. It doesn't compare side-by-side (you'd need to load one model at a time) but it can still be informative.

Hope these help and let us know if you have further questions!

---

<div class="post-metadata">

**Author:** ![jiebei](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jiebei](https://support.prodi.gy/u/jiebei)\
**Post date:** [November 27, 2022, 8:52pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/7 "2022-11-27T20:52:53Z")

</div>

Thank you, it is so helpful!

With regards to implementing the second level for my schema, I am looking at [this post](https://prodi.gy/docs/text-classification#large-label-sets). The explanation makes a lot sense to me, but I am not not sure how to implement as it suggested. I was wondering if there are any related code examples that I can refer to? Thank you!

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [November 28, 2022, 6:11pm UTC](https://support.prodi.gy/t/textcat-batch-train-question/6074/8 "2022-11-28T18:11:31Z")

</div>

Have you seen this post?

> [@Does Prodigy supports hierarchical annotation?](https://support.prodi.gy/t/does-prodigy-supports-hierarchical-annotation/1249/2):
>
> Prodigy itself is pretty agnostic to what your annotations “mean” so you can definitely build a workflow like this. The only thing that’s kinda built-in is a strong focus on single decisions at a time and automating as much as possible. One approach could be to use the [choice interface](https://prodi.gy/demo?view_id=textchoice) and start by annotating the top-level buckets like A, B and C, without worrying about the lower-level categories. [See here](https://prodi.gy/docs/workflow-custom-recipes#example-choice) for an example recipe code. In the next step, you can then stream in the examples again a…

It outlines how to approach this with a custom recipe.
