# `compare.confusion` The function [`compare.confusion`](#digger.compare.confusion) compares the observed extent of landslide impact with a simulated extent. It classifies each location within the region of interest into the four elements of the [binary classification confusion matrix](https://en.wikipedia.org/wiki/Confusion_matrix): :::{list-table} Elements of the binary classification confusion matrix :widths: 15 30 :header-rows: 1 * - Name - Description * - True Positive - Observed and predicted as true * - False Positive - Observed as false but predicted as true * - True Negative - Observed and predicted as false * - False Negative - Observed as true but predicted as false ::: An example of using this functionality is provided in the file `digger/examples/post-run/synthetic/setpostprocess.py`. ```{literalinclude} ../../../../../examples/post-run/synthetic/setpostprocess.py :language: python ``` :::{attention} This code snippet is not fully self-sufficient. This snippet relies on simulation output files. To reproduce the example, execute the file `digger/examples/post-run/synthetic/setpostprocess.py` from within the directory in which it is located. **Before** the script is executed either the example simulation must be run or the file `digger/data/synthetic_output.zip` must be unzipped and the resulting directory (`_output`) must be placed within `digger/examples/post-run/synthetic/`. ::: This code generates a diagnostic figure that visualizes the confusion matrix. ```{figure} ../../../../_static/from_examples/confusion.png :alt: Example digger.calculate confusion summary figure. An example of the diagnostic output provided by digger.calculate.confusion. ``` It also generates a yaml file containing all of the calculated metrics. See the [function API](#digger.compare.confusion) for an explanation of each metric. ```{literalinclude} ../../../../_static/from_examples/confusion_metrics.yaml :language: yaml ```