# get rid of toggle in choice interface

**URL:** <https://support.prodi.gy/t/get-rid-of-toggle-in-choice-interface/546>\
**Category:** Uncategorized\
**Tags:** textcat\
**Created:** [May 15, 2018, 8:39pm UTC](https://support.prodi.gy/t/get-rid-of-toggle-in-choice-interface/546 "2018-05-15T20:39:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhigginslp](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mhigginslp](https://support.prodi.gy/u/mhigginslp)\
**Post date:** [May 15, 2018, 8:39pm UTC](https://support.prodi.gy/t/get-rid-of-toggle-in-choice-interface/546/1 "2018-05-15T20:39:36Z")

</div>

So I have a text classification problem where there are multiple classes for each text. Do you have an established interface for this?

For instance, the text “What is your name and address?” Would get the labels of : request\_address, request\_name.

Is there an easy fix to so to [manual textcat](https://support.prodi.gy/t/make-gold-or-manual-for-textcat/506/2) that I can choose multiple labels?

Also, I want to confirm that the current textcat model will work with the multiclass case because you are not taking a softmax over all the labels, but a prediction for each label … correct?

Thanks!

edit: I reread Ines comments - she says to use `"choice_style": "multiple"` in your config but I am having no luck with this. Maybe I am confused where this should go …

---

<div class="post-metadata">

**Author:** ![honnibal](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/honnibal/32/35_2.png) [@honnibal](https://support.prodi.gy/u/honnibal)\
**Post date:** [May 15, 2018, 8:58pm UTC](https://support.prodi.gy/t/get-rid-of-toggle-in-choice-interface/546/2 "2018-05-15T20:58:09Z")

</div>

Not 100% sure this is what you're asking, but could the `"choice_style": "multiple"` do what you need?

> [@make-gold or manual for textcat?](https://support.prodi.gy/t/make-gold-or-manual-for-textcat/506/2):
>
> Depending on your label scheme, you can set "choice\_style": "multiple" in your config to allow multiple selection, or "choice\_auto\_accept": true to automatically accept a task if an option was selected.

For your other question:

> [@mhigginslp](#):
>
> Also, I want to confirm that the current textcat model will work with the multiclass case because you are not taking a softmax over all the labels, but a prediction for each label … correct?

In theory yes, that's correct --- that's how the model works, although we haven't tested this well with a choice interface for textcat. So if your results seem to not make sense, it's possible we have a bug in the data transformation around the multiple labels.

---

<div class="post-metadata">

**Author:** ![mhigginslp](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mhigginslp](https://support.prodi.gy/u/mhigginslp)\
**Post date:** [May 15, 2018, 9:01pm UTC](https://support.prodi.gy/t/get-rid-of-toggle-in-choice-interface/546/3 "2018-05-15T21:01:48Z")

</div>

Maybe I’m confused about where “config” is …  
for custom recipes would I do something like:

```python

@prodigy.recipe('textcat_manual_multilabel',
    dataset=prodigy.recipe_args['dataset'],
    file_path=("Path to texts", "positional", None, str),
    label=prodigy.recipe_args['label'])
def textcat_manual_multilabel(dataset, file_path,label):
    """Annotate the sentiment of texts using different mood options."""
    stream = JSONL(file_path) # load in the JSONL file
    stream = add_options(stream,label) # add options to each task
    
    return {
        'dataset': dataset, # save annotations in this dataset
        'view_id': 'choice', # use the choice interface
        "choice_style": "multiple",
        'stream': stream,
    }

```

This does not seam to be working.

If I’m using textcat.teach can I pass `--choice_style multiple` flag?

thanks!

---

<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:** [May 15, 2018, 9:10pm UTC](https://support.prodi.gy/t/get-rid-of-toggle-in-choice-interface/546/4 "2018-05-15T21:10:50Z")

</div>

> [@mhigginslp](#):
>
> If I’m using textcat.teach can I pass --choice\_style multiple flag?

Ah, sorry if this was confusing. Your code is _almost_ correct– the config just needs to be within a dictionary `'config'`, for example:

```python
return {
    'dataset': dataset, # save annotations in this dataset
    'view_id': 'choice', # use the choice interface
    'stream': stream,
    'config': {
        'choice_style': 'multiple'
    }
}

```

Since you're using a custom recipe, you can also add your own custom arguments if you want to toggle single/multiple choice from the command line. The following will let you set a boolean flag `--multiple` or `-m`:

```python
@prodigy.recipe('textcat_manual_multilabel',
    dataset=prodigy.recipe_args['dataset'],
    file_path=("Path to texts", "positional", None, str),
    label=prodigy.recipe_args['label'],
    multiple=("Multiple choice", "flag", "m", bool))
def textcat_manual_multilabel(dataset, file_path,label, multiple=False):
    # your code here
    return {
        # your other return values here
        'config': {
            'choice_style': 'multiple' if multiple else 'single'
        }
    }

```

You can be as creative with the recipe arguments as you like 🙂

---

<div class="post-metadata">

**Author:** ![mhigginslp](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@mhigginslp](https://support.prodi.gy/u/mhigginslp)\
**Post date:** [May 16, 2018, 3:55pm UTC](https://support.prodi.gy/t/get-rid-of-toggle-in-choice-interface/546/5 "2018-05-16T15:55:56Z")

</div>

Can you point me to the documentation for the possible options for configuration …

Does the default textcat.teach work consistently with allowing multiple labels for each text?

Thanks, you guys are a big help!
