sepandhaghighi / pycm

Multi-class confusion matrix library in Python
http://pycm.io
MIT License
1.45k stars 124 forks source link

New output print for high dimension matrix #185

Closed kleysonr closed 4 years ago

kleysonr commented 5 years ago

Working with a high dimensional matrix, I would like to have a better visualization of my confusion matrix to understand how wrong predictions were classified.

Removing the 'zeros columns' we could end up in a report like this:

    Class  500131
0  400155       1

    Class  *500001*  500021  500033  500045  500049  500057  500063  500076  500086  500088  500110  500118  500131  500152  500188  500390  500401  500411  500453  500455  500456  501317
1  500001      2613     557       8       1       3     177       3      11      34      11      18       1       7      44       5       3       4       1      13      13       2       4

    Class  500001  500021
2  500003       1       1

    Class  500001  500021
3  500004       7       2

    Class  500001
4  500005       2

    Class  500001  500021
5  500006       5       1

    Class  500001  500021  500033  500057  500088  500110  500131  500188  500390  500401  500455
6  500008      53      21       1       3       1       2       2       6       3       1       3

The report above cames from a 300 x 300 confusion matrix.

Best Regards. Kleyson Rios.

sepandhaghighi commented 5 years ago

@sadrasabouri Hi An old issue that talk about a method we called sparse printing.

Recommended procedure:

  1. Add sparse printing function (sparse_table_print) to pycm_output.py
  2. Add an optional flag (default : False, suggested name : sparse) to print_matrix, print_normalized_matrix , save_stat methods
  3. Update CLASS_NUMBER_WARNING warning in pycm_param.py
  4. Update tests

I hope the above is useful to you, please feel free to contact me if you need any further information ;-)

sadrasabouri commented 5 years ago

@sepandhaghighi Ok, i'll handle it.

sepandhaghighi commented 4 years ago

fixed