Skip to content

Commit

Permalink
Standardize testing output: Response Selection (#5824)
Browse files Browse the repository at this point in the history
* create plotting utils

* write errors and successes for responses

* fix file names

* update plot filenames

* add changelog entry

* add missing docstrings

* update tests

* fix type

* address deepsource issues

* use io_utils

* fix call to write_text_file

* added complete intent and response key to the 'intent' key

* Update rasa/nlu/test.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Update rasa/nlu/test.py

Co-authored-by: Daksh Varshneya <[email protected]>

* use intent_target key for confustion matrix

Co-authored-by: Daksh <[email protected]>
Co-authored-by: Roberto <[email protected]>
  • Loading branch information
3 people authored May 18, 2020
1 parent 69f0409 commit 3262797
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions test_rasa_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,40 @@ def test_test(run_in_default_project: Callable[..., RunResult]):
run_in_default_project("test")

assert os.path.exists("results")
assert os.path.exists("results/hist.png")
assert os.path.exists("results/confmat.png")
assert os.path.exists("results/intent_histogram.png")
assert os.path.exists("results/intent_confusion_matrix.png")


def test_test_no_plot(run_in_default_project: Callable[..., RunResult]):
run_in_default_project("test", "--no-plot")

assert not os.path.exists("results/hist.png")
assert not os.path.exists("results/confmat.png")
assert not os.path.exists("results/intent_histogram.png")
assert not os.path.exists("results/intent_confusion_matrix.png")
assert not os.path.exists("results/story_confmat.pdf")


def test_test_nlu(run_in_default_project: Callable[..., RunResult]):
run_in_default_project("test", "nlu", "--nlu", "data", "--successes")

assert os.path.exists("results/hist.png")
assert os.path.exists("results/confmat.png")
assert os.path.exists("results/intent_histogram.png")
assert os.path.exists("results/intent_confusion_matrix.png")
assert os.path.exists("results/intent_successes.json")


def test_test_nlu_no_plot(run_in_default_project: Callable[..., RunResult]):
run_in_default_project("test", "nlu", "--no-plot")

assert not os.path.exists("results/confmat.png")
assert not os.path.exists("results/hist.png")
assert not os.path.exists("results/intent_histogram.png")
assert not os.path.exists("results/intent_confusion_matrix.png")


def test_test_nlu_cross_validation(run_in_default_project: Callable[..., RunResult]):
run_in_default_project(
"test", "nlu", "--cross-validation", "-c", "config.yml", "-f", "2"
)

assert os.path.exists("results/hist.png")
assert os.path.exists("results/confmat.png")
assert os.path.exists("results/intent_histogram.png")
assert os.path.exists("results/intent_confusion_matrix.png")


def test_test_nlu_comparison(
Expand Down Expand Up @@ -164,8 +164,7 @@ def test_test_help(run: Callable[..., RunResult]):
[--max-stories MAX_STORIES] [--endpoints ENDPOINTS]
[--fail-on-prediction-errors] [--url URL]
[--evaluate-model-directory] [-u NLU] [--out OUT]
[--successes] [--no-errors] [--histogram HISTOGRAM]
[--confmat CONFMAT] [-c CONFIG [CONFIG ...]]
[--successes] [--no-errors] [-c CONFIG [CONFIG ...]]
[--cross-validation] [-f FOLDS] [-r RUNS]
[-p PERCENTAGES [PERCENTAGES ...]] [--no-plot]
{core,nlu} ..."""
Expand All @@ -180,8 +179,7 @@ def test_test_nlu_help(run: Callable[..., RunResult]):
output = run("test", "nlu", "--help")

help_text = """usage: rasa test nlu [-h] [-v] [-vv] [--quiet] [-m MODEL] [-u NLU] [--out OUT]
[--successes] [--no-errors] [--histogram HISTOGRAM]
[--confmat CONFMAT] [-c CONFIG [CONFIG ...]]
[--successes] [--no-errors] [-c CONFIG [CONFIG ...]]
[--cross-validation] [-f FOLDS] [-r RUNS]
[-p PERCENTAGES [PERCENTAGES ...]] [--no-plot]"""

Expand Down

0 comments on commit 3262797

Please sign in to comment.