# Is the lookup table working?

**URL:** <https://forum.rasa.com/t/is-the-lookup-table-working/13421>\
**Category:** Rasa Open Source\
**Created:** [July 23, 2019, 4:46pm UTC](https://forum.rasa.com/t/is-the-lookup-table-working/13421 "2019-07-23T16:46:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![twittmin](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/twittmin/32/2091_2.png) [@twittmin](https://forum.rasa.com/u/twittmin)\
**Post date:** [July 23, 2019, 4:46pm UTC](https://forum.rasa.com/t/is-the-lookup-table-working/13421/1 "2019-07-23T16:46:56Z")

</div>

I downloaded this lookup table demo:

> **[GitHub - RasaHQ/rasa\_lookup\_demo: Improving entity extraction from text using...](https://github.com/RasaHQ/rasa_lookup_demo)**
>
> Improving entity extraction from text using the lookup table feature in rasa\_nlu - GitHub - RasaHQ/rasa\_lookup\_demo: Improving entity extraction from text using the lookup table feature in rasa\_nlu

and run the ‘food’ experiment, but found no difference after lookup table is used:

```
100%|██████████| 57/57 [00:00<00:00, 63.74it/s]
F1-Score: 0.7751422415446251
Precision: 0.8254441057849204
Accuracy: 0.8395061728395061
Classification report: 
              precision recall f1-score support

        food 0.75 0.04 0.08 67
   no_entity 0.84 1.00 0.91 338

   micro avg 0.84 0.84 0.84 405
   macro avg 0.80 0.52 0.50 405
weighted avg 0.83 0.84 0.78 405

100%|██████████| 57/57 [00:00<00:00, 64.51it/s]
F1-Score: 0.7751422415446251
Precision: 0.8254441057849204
Accuracy: 0.8395061728395061
Classification report: 
              precision recall f1-score support

        food 0.75 0.04 0.08 67
   no_entity 0.84 1.00 0.91 338

   micro avg 0.84 0.84 0.84 405
   macro avg 0.80 0.52 0.50 405
weighted avg 0.83 0.84 0.78 405

```

Why are the numbers exactly the same? The first set of numbers are food without lookup table, and the 2nd has lookup table.

---

<div class="post-metadata">

**Author:** ![fede](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/fede/32/7095_2.png) [@fede](https://forum.rasa.com/u/fede)\
**Post date:** [July 24, 2019, 7:54am UTC](https://forum.rasa.com/t/is-the-lookup-table-working/13421/2 "2019-07-24T07:54:39Z")

</div>

Hey @twittmin, could you describe what you changed exactly between each run? (config files, command line arguments, etc)

---

<div class="post-metadata">

**Author:** ![twittmin](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/twittmin/32/2091_2.png) [@twittmin](https://forum.rasa.com/u/twittmin)\
**Post date:** [July 24, 2019, 7:28pm UTC](https://forum.rasa.com/t/is-the-lookup-table-working/13421/3 "2019-07-24T19:28:07Z")

</div>

Hi, @fede, I barely changed anything. Just run the program and got these numbers. Also, at the end, it receied this error:

```
Traceback (most recent call last):
  File "/Users/lingvisa/Nlp/chatbot/rasa_lookup_demo/run_lookup.py", line 234, in <module>
    run_demo(key, disp_bar=disp_bar)
  File "/Users/lingvisa/Nlp/chatbot/rasa_lookup_demo/run_lookup.py", line 127, in run_demo
    plot_metrics(metric_list)
  File "/Users/lingvisa/Nlp/chatbot/rasa_lookup_demo/run_lookup.py", line 178, in plot_metrics
    print_metrics(metric_list)
  File "/Users/lingvisa/Nlp/chatbot/rasa_lookup_demo/run_lookup.py", line 156, in print_metrics
    key = metric_list[0]["key"]
IndexError: list index out of range
```

---

<div class="post-metadata">

**Author:** ![amn41](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/amn41/32/20_2.png) [@amn41](https://forum.rasa.com/u/amn41)\
**Post date:** [July 25, 2019, 9:16am UTC](https://forum.rasa.com/t/is-the-lookup-table-working/13421/4 "2019-07-25T09:16:42Z")

</div>

@twittmin - what exact commands are you running? Since the numbers are exactly the same, maybe double check that you are really evaluating two different models?

---

<div class="post-metadata">

**Author:** ![twittmin](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/twittmin/32/2091_2.png) [@twittmin](https://forum.rasa.com/u/twittmin)\
**Post date:** [July 25, 2019, 3:37pm UTC](https://forum.rasa.com/t/is-the-lookup-table-working/13421/5 "2019-07-25T15:37:56Z")

</div>

@amn41I simply run this as instructed in the github instruction:

```auto
python run_lookup.py food

```

The code from the function:

```
    def run_demo(key, disp_bar=True):
        # runs the demo specified by key

        # get the data for this key and the configs
        training_data, training_data_lookup, test_data, model_dir = get_path_dicts(key)
        config_file = "configs/config.yaml"
        config_baseline = "configs/config_no_features.yaml"

        # run a baseline
        model_loc = train_model(training_data, config_baseline, model_dir)
        evaluate_model(test_data, model_loc)

        # run with more features in CRF
        model_loc = train_model(training_data, config_file, model_dir)
        evaluate_model(test_data, model_loc)

        # run with the lookup table
        model_loc = train_model(training_data_lookup, config_file, model_dir)
        evaluate_model(test_data, model_loc)

        # get the metrics
        metric_list = strip_metrics(key)

        # either print or plot them
        if disp_bar:
            plot_metrics(metric_list)
        else:
            print_metrics(metric_list)
```
