# Dataset preparation

**URL:** <https://support.prodi.gy/t/dataset-preparation/6525>\
**Category:** Uncategorized\
**Created:** [May 1, 2023, 10:13pm UTC](https://support.prodi.gy/t/dataset-preparation/6525 "2023-05-01T22:13:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shabbirrafiq](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@shabbirrafiq](https://support.prodi.gy/u/shabbirrafiq)\
**Post date:** [May 1, 2023, 10:13pm UTC](https://support.prodi.gy/t/dataset-preparation/6525/1 "2023-05-01T22:13:40Z")

</div>

Hello, I am new to prodigy and using it for creating a dataset and then training for span categorization. I have extracted a dataset of 6000 samples, in which I will keep 2000 best ones in my final dataset. I have loaded the 6000 samples in prodigy and have manually annotated 400 samples using spans.manual. Going further I want to use spans.correct to annotate the remaining samples excluding the already annotated data. How can I extract the best 2000 samples from my final dataset (i.e. only include the accepted annotated samples)? Thank you

---

<div class="post-metadata">

**Author:** ![koaning](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/koaning/32/230_2.png) [@koaning](https://support.prodi.gy/u/koaning)\
**Post date:** [May 2, 2023, 8:59am UTC](https://support.prodi.gy/t/dataset-preparation/6525/2 "2023-05-02T08:59:14Z")

</div>

> [@shabbirrafiq](#):
>
> I have extracted a dataset of 6000 samples, in which I will keep 2000 best ones in my final dataset.

Could you elaborate what you mean with "2000 best ones"?

If you want to train a spancat model for `spans.correct` you can leverage the `train` recipe that's documented [here](https://prodi.gy/docs/recipes/#training). There's also a full guide on training spancat models on our docs here:

> **[Span Categorization · Prodigy · An annotation tool for AI, Machine Learning...](https://prodi.gy/docs/span-categorization/)**
>
> A downloadable annotation tool for NLP and computer vision tasks such as named entity recognition, text classification, object detection, image segmentation, A/B evaluation and more.

---

<div class="post-metadata">

**Author:** ![shabbirrafiq](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@shabbirrafiq](https://support.prodi.gy/u/shabbirrafiq)\
**Post date:** [May 2, 2023, 8:30pm UTC](https://support.prodi.gy/t/dataset-preparation/6525/3 "2023-05-02T20:30:22Z")

</div>

Yes I am planning to try spans.correct. I hope it works fine.  
To elaborate, I actually have a dataset of 6000 patent claims extracted from Big query but all of them are not complete and some contain very less text and are not very relevant . My target is to annotate 2000 claims from these 6000. I extracted extra claims so that I could pick out the 2000 best samples for my model. I have loaded all of them in prodigy now and have annotated 400 manually and will use the spans.correct on this dataset of 6000 claims, While annotating, the claims that I do not find relevant are rejected by me (using the reject button on the prodigy interface) and the ones relevant are annotated and accepted. I want to keep 2000 accepted claims now, as soon as I reach 2000 accepted samples my dataset is done. I then want to extract my dataset. Is it possible, if yes how to do it?  
I hope I clarified my concern. Reach out if I am not clear

---

<div class="post-metadata">

**Author:** ![koaning](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/koaning/32/230_2.png) [@koaning](https://support.prodi.gy/u/koaning)\
**Post date:** [May 15, 2023, 12:32pm UTC](https://support.prodi.gy/t/dataset-preparation/6525/4 "2023-05-15T12:32:05Z")

</div>

> [@shabbirrafiq](#):
>
> While annotating, the claims that I do not find relevant are rejected by me (using the reject button on the prodigy interface) and the ones relevant are annotated and accepted.

If there are no spans in a document, you may also want to hit "accept", but it depends a bit on what you're interested in doing with them afterwards. By accepting a document with no spans, you are still collecting training data in the sense that a model should not detect any spans there. Examples that demonstrate when spans should not be predicted are still useful for the model.

If you really want to focus on examples where a span does appear you may choose to train a spancat model (which you can do with [prodigy train](https://prodi.gy/docs/recipes/#train)) and then use this to make your annotation easier. One way of doing this is to write a Python script that will filter all the examples to only keep the examples with detect spans. Then, you can pass this subset to [spans.manual](https://prodi.gy/docs/recipes/#spans-manual) or [spans.correct](https://prodi.gy/docs/recipes/#spans-correct).

Just to check, are the spans that you're interested in rare? If not, it might be easier to not worry about creating a subset and to spend the effort of creating more annotations instead.

---

<div class="post-metadata">

**Author:** ![shabbirrafiq](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@shabbirrafiq](https://support.prodi.gy/u/shabbirrafiq)\
**Post date:** [May 18, 2023, 12:13pm UTC](https://support.prodi.gy/t/dataset-preparation/6525/5 "2023-05-18T12:13:05Z")

</div>

Thank you very much
