notice
This is unreleased documentation for Rasa Documentation Main/Unreleased version.
For the latest released documentation, see the latest version (3.x).
rasa.model_testing
ClassificationReportException Objects
Raised when clf_report doesn't correctly set accuracy and/or micro avg.
sklearn.metrics.classification_report should provide either accuracy or micro avg.
test_core_models_in_directory
Evaluates a directory with multiple Core models using test data.
Arguments:
model_directory- Directory containing multiple model files.stories- Path to a conversation test file.output- Output directory to store results to.use_conversation_test_files-Trueif conversation test files should be used for testing instead of regular Core story files.
plot_core_results
Plot core model comparison graph.
Arguments:
output_directory- path to the output directorynumber_of_examples- number of examples per run
test_core_models
Compares multiple Core models based on test data.
Arguments:
models- A list of models files.stories- Path to test data.output- Path to output directory for test results.use_conversation_test_files-Trueif conversation test files should be used for testing instead of regular Core story files.
test_core
Tests a trained Core model against a set of test stories.
test_nlu
Tests the NLU Model.
compare_nlu_models
Trains multiple models, compares them and saves the results.
plot_nlu_results
Plot NLU model comparison graph.
Arguments:
output_directory- path to the output directorynumber_of_examples- number of examples per run
perform_nlu_cross_validation
Runs cross-validation on test data.
Arguments:
config- The model configuration.data- The data which is used for the cross-validation.output- Output directory for the cross-validation results.additional_arguments- Additional arguments which are passed to the cross-validation, like number ofdisable_plotting.
get_evaluation_metrics
Compute the f1, precision, accuracy and summary report from sklearn.
Arguments:
targets- target labelspredictions- predicted labelsoutput_dict- if True sklearn returns a summary report as dict, if False the report is in string formatexclude_label- labels to exclude from evaluation
Returns:
Report from sklearn, precision, f1, and accuracy values.
make_classification_report_complete
Completes the sklearn classification report with accuracy xor micro avg.
Arguments:
report- Report generated by metrics.classification_report with output_dict=Trueaccuracy- Model accuracy
Raises:
Exception- When sklearn.metrics.classification_report behaves different to our expectation.
Returns:
report- Report generated by metrics.classification_report enhanced with accuracy xor micro avg.
clean_labels
Remove None labels. sklearn metrics do not support them.
Arguments:
labels- list of labels
Returns:
Cleaned labels.
get_unique_labels
Get unique labels. Exclude 'exclude_label' if specified.
Arguments:
targets- labelsexclude_label- label to exclude
Returns:
Unique labels.
