# Default algorithm used in prodigy train ner command

**URL:** <https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175>\
**Category:** Uncategorized\
**Tags:** usage, spacy, solved, training\
**Created:** [January 10, 2022, 1:42pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175 "2022-01-10T13:42:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sigitpurnomo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sigitpurnomo/32/2107_2.png) [@sigitpurnomo](https://support.prodi.gy/u/sigitpurnomo)\
**Post date:** [January 10, 2022, 1:42pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/1 "2022-01-10T13:42:46Z")

</div>

Hi,

What is the default algorithm that used in **prodigy train ner** command? Is it rule-based, machine learning, or already using the deep learning algorithm/architecture?

Note:  
I am using the Prodigy 1.10.8 version

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [January 11, 2022, 11:43am UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/2 "2022-01-11T11:43:50Z")

</div>

Hi! The `prodigy train` command is a thin wrapper around spaCy's `train` command: [https://spacy.io/api/cli#train](https://spacy.io/api/cli#train)

If you're not specifying your own config for training, it will generate a default one using the components you set on the CLI. For example, when used with `--ner`, this will train a named entity recognizer. All these components are trainable pipeline components with their own neural network model. You can read more about the different components and their model architectures here: [https://spacy.io/api#architecture-pipeline](https://spacy.io/api#architecture-pipeline)

---

<div class="post-metadata">

**Author:** ![sigitpurnomo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sigitpurnomo/32/2107_2.png) [@sigitpurnomo](https://support.prodi.gy/u/sigitpurnomo)\
**Post date:** [January 12, 2022, 7:11am UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/3 "2022-01-12T07:11:33Z")

</div>

Hi Ines,

In my case, I have used this command: `prodigy train ner my-dataset blank:id --output my-model-name --eval-split 0.2 --n-iter 50`.

I have explored the script [here (ner pipeline)](https://github.com/explosion/spaCy/blob/master/spacy/pipeline/ner.pyx) and if I am not wrong, the model architecture that used is `spacy.TransitionBasedParser.v2`. Is it correct?

I also have explored the TransitionBasedParser [here](https://spacy.io/api/architectures#TransitionBasedParser). Do you have any resource suggestions for me to learn more about this architecture and the implementation for the NER case?

Thank you

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [January 12, 2022, 7:42pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/4 "2022-01-12T19:42:29Z")

</div>

> [@sigitpurnomo](#):
>
> I also have explored the TransitionBasedParser [here](https://spacy.io/api/architectures#TransitionBasedParser). Do you have any resource suggestions for me to learn more about this architecture and the implementation for the NER case?

If you're interested in transition-based parsing, Matt has an in-depth video where he explains the architecture and concept:

[![](https://img.youtube.com/vi/sqDHBH9IjRU/hqdefault.jpg "SPACY'S ENTITY RECOGNITION MODEL: incremental parsing with Bloom embeddings & residual CNNs") ](https://www.youtube.com/watch?v=sqDHBH9IjRU)

---

<div class="post-metadata">

**Author:** ![sigitpurnomo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sigitpurnomo/32/2107_2.png) [@sigitpurnomo](https://support.prodi.gy/u/sigitpurnomo)\
**Post date:** [January 13, 2022, 12:09pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/5 "2022-01-13T12:09:30Z")

</div>

Hi Ines,

Thank you for the video suggestion.

In my case, I used the **prodigy 1.10.8** and **spacy 2.3.5** as the environment in my project. I am trying to explore the spacy code [here](https://github.com/explosion/spaCy/tree/v2.3.5) to learn more about the algorithm that is used in the `prodigy train ner` or `spacy train` CLI, but I didn't find the precise code that fits with the documentation about TransitionBasedParser in the new [spacy documentation here](https://spacy.io/api/architectures#TransitionBasedParser).

Can you suggest to me where I can find it? Or the model architecture that used in my environment is different?

In my case, I have used this command: `prodigy train ner my-dataset blank:id --output my-model-name --eval-split 0.2 --n-iter 50` and here is the content of cfg file in the output model:

```python
{
  "beam_width":1,
  "beam_density":0.0,
  "beam_update_prob":1.0,
  "cnn_maxout_pieces":3,
  "nr_feature_tokens":6,
  "nr_class":46,
  "hidden_depth":1,
  "token_vector_width":96,
  "hidden_width":64,
  "maxout_pieces":2,
  "pretrained_vectors":null,
  "bilstm_depth":0,
  "self_attn_depth":0,
  "conv_depth":4,
  "conv_window":1,
  "embed_size":2000
}

```

It's really important to me to know the algorithm used behind the prodigy train ner in my project environment.

Thank you

---

<div class="post-metadata">

**Author:** ![sigitpurnomo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sigitpurnomo/32/2107_2.png) [@sigitpurnomo](https://support.prodi.gy/u/sigitpurnomo)\
**Post date:** [January 14, 2022, 2:46pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/6 "2022-01-14T14:46:39Z")

</div>

I am sorry Ines, do you have any suggestions about my question [here](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/5)?

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [January 17, 2022, 11:42am UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/7 "2022-01-17T11:42:10Z")

</div>

> [@sigitpurnomo](#):
>
> Can you suggest to me where I can find it? Or the model architecture that used in my environment is different?

Sorry, I didn't see the update since you edited you post 😅 If you click the "source" icon at the top of the different documented architectures, this should take you straight to the source of the model implementation. In this case, the `TransitionBasedParser` can be found here:

> <https://github.com/explosion/spaCy/blob/master/spacy/ml/models/parser.py>

You might also find this paper helpful for background on transition-based parsing:

> **[D15-1162.pdf](https://aclanthology.org/D15-1162.pdf)**
>
> 122.02 KB

---

<div class="post-metadata">

**Author:** ![sigitpurnomo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sigitpurnomo/32/2107_2.png) [@sigitpurnomo](https://support.prodi.gy/u/sigitpurnomo)\
**Post date:** [January 17, 2022, 12:23pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/8 "2022-01-17T12:23:17Z")

</div>

Hi Ines,

I have explored that code, but I think that code is for the newest version of Spacy. Is it correct? Or is the code the same as that used in the 2.3.5 version? I am using the 2.3.5 version so I have tried to find it in the old GitHub repository and having difficulty finding it.

Thank you

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [January 18, 2022, 1:41pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/9 "2022-01-18T13:41:50Z")

</div>

Ah, sorry, I missed that. The transition-based parsing architecture has changed slightly in terms of various details between v2.x and v3.x. The v2.x implementation is a bit messier (which is one aspect we fixed in v3.x) but you can find it here:

> **[spaCy/spacy/syntax at v2.x · explosion/spaCy](https://github.com/explosion/spaCy/tree/v2.x/spacy/syntax)**
>
> v2.x/spacy/syntax

---

<div class="post-metadata">

**Author:** ![sigitpurnomo](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/sigitpurnomo/32/2107_2.png) [@sigitpurnomo](https://support.prodi.gy/u/sigitpurnomo)\
**Post date:** [January 18, 2022, 2:06pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/10 "2022-01-18T14:06:10Z")

</div>

> [@ines](#):
>
> Ah, sorry, I missed that. The transition-based parsing architecture has changed slightly in terms of various details between v2.x and v3.x.

Is there any documentation about the changes?

One more thing, do you have any suggestions for me on how to train my ner model with my annotated dataset directly from spacy, instead of using the prodigy train ner CLI?

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:** [July 13, 2022, 2:45pm UTC](https://support.prodi.gy/t/default-algorithm-used-in-prodigy-train-ner-command/5175/11 "2022-07-13T14:45:02Z")

</div>

hi @sigitpurnomo!

Sorry for the delay on the last part of your question.

> [@sigitpurnomo](#):
>
> One more thing, do you have any suggestions for me on how to train my ner model with my annotated dataset directly from spacy, instead of using the prodigy train ner CLI?

Yes, check out this [sample project repo](https://github.com/explosion/projects/tree/v3/integrations/prodigy) that compares training a `ner` model using `spacy` and `prodigy`. It uses the [spacy v3 project structure](https://spacy.io/usage/v3#features-projects) and [config file structure](https://spacy.io/usage/v3#features-training). Hope this helps!
