Appendix Z — chapter5.analysis.reports
chapter5.analysis.reports
Provides functions to process the reports generated in the evaluation of classification models.
Functions
Name | Description |
---|---|
extract_metrics | Extracts metrics of interest from a classification report |
metric_increment_summary | Creates a summary with metrics increments/decrements in the provided reports to compare |
metrics_summary | Creates a summary of the classification reports generated by the evaluation of several models. |
extract_metrics
chapter5.analysis.reports.extract_metrics(report)
Extracts metrics of interest from a classification report
Parameters
Name | Type | Description | Default |
---|---|---|---|
report |
dict | list[dict] | Classification report or a list of reports. | required |
Returns
Type | Description |
---|---|
float | Accuracy obtained by the model. |
float | Precision obtained by the model. |
float | Recall obtained by the model. |
float | F1-score obtained by the model. |
metric_increment_summary
chapter5.analysis.reports.metric_increment_summary(comparisons)
Creates a summary with metrics increments/decrements in the provided reports to compare different approaches
Parameters
Name | Type | Description | Default |
---|---|---|---|
comparisons |
dict | Dict where each entry indicates which reports to compare. | required |
Returns
Type | Description |
---|---|
pandas.DataFrame |
DataFrame containing the comparisons. |
metrics_summary
chapter5.analysis.reports.metrics_summary(reports, labels)
Creates a summary of the classification reports generated by the evaluation of several models.
Parameters
Name | Type | Description | Default |
---|---|---|---|
reports |
list[dict] | List of classification reports. | required |
Returns
Type | Description |
---|---|
pandas.DataFrame |
DataFrame summarizing the results. |