Create additional functions needed to evaluate the filter quality.
Task:
quality_score(tp, tn, fp, fn)
in module quality.py
.
quality_score(tp, tn, fp, fn) Compute the quality score based on the confusion matrix. |
|
---|---|
Inputs | 4 nonnegative integers for TP, TN, FP, FN. |
Outputs | A number between 0 and 1 showing the prediction quality measure. |
Task:
quality.py
, create function compute_quality_for_corpus(corpus_dir)
which evaluates the filter quality based on the information contained in files !truth.txt
and !prediction.txt
in the given corpus.
read_classification_from_file()
.
compute_confusion_matrix()
function from step 2.
quality_score()
.
Why do we need it?
compute_quality_for_corpus(corpus_dir) | Compute the quality of predictions for given corpus. |
---|---|
Inputs | A corpus directory evaluated by a filter (i.e. a directory containing !truth.txt and !prediction.txt files). |
Outputs | Quality of the filter as a number between 0 and 1. |