https://github.com/adrianprelipcean/confusion_matrix
plpgsql function for generating a confusion matrix represented as a table
https://github.com/adrianprelipcean/confusion_matrix
Last synced: 3 months ago
JSON representation
plpgsql function for generating a confusion matrix represented as a table
- Host: GitHub
- URL: https://github.com/adrianprelipcean/confusion_matrix
- Owner: adrianprelipcean
- Created: 2016-03-08T13:10:17.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-08T13:20:38.000Z (about 9 years ago)
- Last Synced: 2025-01-11T03:53:53.469Z (5 months ago)
- Language: PLpgSQL
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Confusion Matrix
plpgsql function for generating a confusion matrix represented as a table##### Function Description
stat_conf_matrix(
in_table_name text,
actual_class_column text,
predicted_class_column text,
out_table_name text)**in_table_name** -> Name of the table where the predictions are stored
**actual_class_column** -> Name of the column that stores the ground truth / correct class of a classified entity
**predicted_class_column** -> Name of the column that stores the inferred / predicted class of a classified entity
**out_table_name** -> Name of the table that will store the confusion matrix. **Warning** The table will be overwritten if it already exists.
##### Example
```sql
Create table prediction_table
(id serial, class_name_or_id text , actual_class text , predicted_class text);insert into prediction_table (class_name_or_id, actual_class, predicted_class)
values ('foo', 'c1', 'c2'),
('foo2', 'c1', 'c1'),
('foo3', 'c2', 'c2'),
('foo4', 'c2', 'c2'),
('foo5', 'c2', 'c3'),
('foo6', 'c3', 'c1'),
('foo7', 'c1', 'c1');select * from stat_conf_matrix(
'prediction_table',
'actual_class',
'predicted_class',
'confusion_table');
```