# 1.10.4 prodigy.json exclude\_by bug?

**URL:** <https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590>\
**Category:** Uncategorized\
**Tags:** textcat, solved\
**Created:** [October 30, 2020, 3:36pm UTC](https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590 "2020-10-30T15:36:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![curious](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@curious](https://support.prodi.gy/u/curious)\
**Post date:** [October 30, 2020, 3:36pm UTC](https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590/1 "2020-10-30T15:36:53Z")

</div>

Hi,  
I've reported this problem for 1.10.3 and I thought it was fixed. But I saw the problem again in 1.10.4. I used the textcat.teach recipe. I observed the following lines in the log -

1. My configuration 'exclude\_by: input' was read  
15:07:55: CONTROLLER: Initialising from recipe  
{'batch\_size': 100, 'dataset': 'temp', 'db': None, **'exclude': 'input'** , 'filters': [{'name': 'RelatedSessionsFilter', 'cache\_size': 10}], 'max\_sessions': 10, 'overlap': True, 'self': \<prodigy.components.feeds.SessionFeed object at 0x7f9f24f8e350\>, 'stream': \<prodigy.components.sorters.ExpMovingAverage object at 0x7f9f24f88410\>, 'validator': \<prodigy.components.validate.Validator object at 0x7f9f24f9d190\>, 'view\_id': 'classification'}

2. However later, I saw 'exclude by input' and 'by task' both were used in the filter. Could that be wrong?  
15:07:55: FILTER: Filtering duplicates from stream  
{ **'by\_input': True, 'by\_task': True,**'stream': \<generator object at 0x7f9f25384910\>, 'warn\_fn': \<bound method Printer.warn of \<wasabi.printer.Printer object at 0x7f9fcc53cdd0\>\>, 'warn\_threshold': 0.4}

3. In the tasks, I saw 2 instances were selected although they had the same input\_hash  
{'answer': 'accept', 'text': ... for you only USD...', 'meta': {'event\_id': 'masked', 'score': 0.14207322895526886}, **'\_input\_hash': -301208957** , '\_task\_hash': -519955208, 'label': 'insider', 'score': 0.14207322895526886, 'priority': 0.14207322895526886, 'spans': [], '\_session\_id': None, '\_view\_id': 'classification'},

{'answer': 'accept', 'text': '... for you only USD...', 'meta': {'event\_id': 'masked', 'pattern': '389'}, **'\_input\_hash': -301208957** , '\_task\_hash': -2036512131, 'spans': [{'text': 'for you only', 'start': 18, 'end': 30, 'pattern': -149218508}], 'label': 'insider', '\_session\_id': None, '\_view\_id': 'classification'},

---

<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:** [November 2, 2020, 9:11am UTC](https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590/2 "2020-11-02T09:11:38Z")

</div>

Hi! Are you customising anything in a custom recipe or your `prodigy.json`?

> [@curious](#):
>
> **'exclude': 'input'** ,

~~I'm confused where this comes from 🤔 This is the `"exclude"` value returned by the custom recipe, and it should be a list of dataset names or `None`. The `exclude_by` setting is specified in the `"config"` returned by the recipe.~~

**Edit:** Ah, looked at the wrong log statement. This makes sense and indicates it's correctly passed on.

> [@curious](#):
>
> However later, I saw 'exclude by input' and 'by task' both were used in the filter. Could that be wrong?

These are the settings for the [`filter_duplicates` filter](https://prodi.gy/docs/api-components#filter_duplicates) that runs automatically on the raw source data when it's loaded. It's not related to exclusion of existing annotations – the mechanisms use similar names because it's a similar principle (which hashes should be used when filtering duplicates).

---

<div class="post-metadata">

**Author:** ![curious](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@curious](https://support.prodi.gy/u/curious)\
**Post date:** [November 3, 2020, 1:24am UTC](https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590/3 "2020-11-03T01:24:52Z")

</div>

No. I don't have any customization except the host configuration in prodigy.json. Here is my prodigy.json

{  
"exclude\_by": "input",  
"custom\_theme": {"cardMaxWidth":1500},  
"global\_css":".prodigy-content {text-align: left; font-size: 12pt}",  
"host": "0.0.0.0",  
"batch\_size": 10,  
"feed\_overlap": true,  
}

---

<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:** [November 3, 2020, 9:31am UTC](https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590/4 "2020-11-03T09:31:45Z")

</div>

Thanks, this is helpful! I also realised I looked at the wrong log statement so the `exclude: "input"` above does make sense and indicates that it's set correctly. I'll look into this!

> [@curious](#):
>
> "feed\_overlap": true,

Is this important for your use case, i.e. are you using named sessions? If not, can you try set this to `false`?

---

<div class="post-metadata">

**Author:** ![curious](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@curious](https://support.prodi.gy/u/curious)\
**Post date:** [November 3, 2020, 2:41pm UTC](https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590/5 "2020-11-03T14:41:48Z")

</div>

Yes, I'm using named session.

I've found that if I add the following filter I can prevent the same sentence from showing for the pattern and the model for the textcat.teach.

#filter out sentences are picked by the matcher and the model  
stream = filter\_duplicates(stream, by\_input=True, by\_task=False)

---

<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:** [November 10, 2020, 3:23am UTC](https://support.prodi.gy/t/1-10-4-prodigy-json-exclude-by-bug/3590/6 "2020-11-10T03:23:26Z")

</div>

Thanks for the update – I think I understand what's happening now: the `exclude_by` setting refers to the exclusion strategy for examples that are already in the dataset, not examples within the same stream. So if you set `"exclude_by"` to `"input"`, you won't see a suggestion again if the text is already in the dataset (even if it's with a different label).

If you filter duplicates out of your stream, the filtering will be applied at runtime to whatever is coming in.

> [@curious](#):
>
> I've found that if I add the following filter I can prevent the same sentence from showing for the pattern and the model for the textcat.teach.

Are you sure you want to filter by input, though? This would mean that if you have multiple categories, you'd only ever see a text once and would never get to see suggestions for a different label again. Instead, maybe you could make sure that all examples have hashes and then filter by task hash? This would mean that you don't see the same suggestion for a label twice, but still get different label suggestions.
