Skip to content

Commit

Permalink
Add Multiclass roccurve (#23)
Browse files Browse the repository at this point in the history
* add multiclass prob histogram

* improvements for historgram

* add multiclass roc curve

* add black bounding box as titles

* many small improvements

* added custom color maps

* color update and small adjustments

* add test for hist plot and preliminary test for roc curve

* refine tests

* mypy, pylint and black improvements

* tiny fix

* improve histplot testing
  • Loading branch information
joshuawe committed Dec 16, 2023
1 parent 0960c45 commit 23c83cc
Show file tree
Hide file tree
Showing 19 changed files with 1,731 additions and 610 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
tests/test_results/










# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ fig_auroc.show()

+ [DALL-E 3](https://openai.com/dall-e-3) created the project logo on 17th October 2023. Prompt used: *Illustration of a stylized graph with colorful lines and bars, representing data visualization, suitable for a project logo named 'plots and graphs'.*

+ The [Scientific colour maps](https://www.fabiocrameri.ch/colourmaps/) in the `plotsandgraphs/cmaps` folder [(Crameri 2018)](https://doi.org/10.5281/zenodo.1243862) are used in this library to prevent visual distortion of the data and exclusion of readers with colour-vision deficiencies [(Crameri et al., 2020)](https://www.nature.com/articles/s41467-020-19160-7).


# Reference

Expand Down
Binary file added images/multiclass/histogram_4_classes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/multiclass/roc_curves_multiclass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion notebooks/calllibration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
},
"language_info": {
"name": "python",
"version": "3.10.3"
"version": "3.8.8"
},
"orig_nbformat": 4
},
Expand Down
239 changes: 219 additions & 20 deletions notebooks/multiclass_classification.ipynb

Large diffs are not rendered by default.

256 changes: 256 additions & 0 deletions plotsandgraphs/cmaps/hawaii.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
0.550541 0.006842 0.451980
0.551494 0.015367 0.447972
0.552426 0.023795 0.443998
0.553328 0.032329 0.440021
0.554227 0.041170 0.436063
0.555098 0.049286 0.432125
0.555948 0.056667 0.428188
0.556797 0.063525 0.424272
0.557619 0.069970 0.420377
0.558415 0.076028 0.416509
0.559210 0.081936 0.412663
0.559991 0.087507 0.408823
0.560746 0.092811 0.405012
0.561495 0.098081 0.401237
0.562235 0.103128 0.397471
0.562954 0.108005 0.393736
0.563663 0.112872 0.390025
0.564355 0.117530 0.386344
0.565032 0.122122 0.382698
0.565709 0.126681 0.379074
0.566380 0.131171 0.375474
0.567037 0.135542 0.371905
0.567679 0.139872 0.368378
0.568312 0.144198 0.364861
0.568939 0.148416 0.361384
0.569559 0.152618 0.357942
0.570171 0.156806 0.354519
0.570777 0.160934 0.351127
0.571377 0.165008 0.347764
0.571972 0.169120 0.344417
0.572562 0.173131 0.341120
0.573142 0.177166 0.337836
0.573711 0.181138 0.334602
0.574276 0.185151 0.331356
0.574840 0.189095 0.328170
0.575406 0.193035 0.324992
0.575967 0.196978 0.321854
0.576518 0.200854 0.318740
0.577060 0.204783 0.315654
0.577596 0.208664 0.312565
0.578135 0.212545 0.309542
0.578676 0.216431 0.306516
0.579214 0.220287 0.303496
0.579746 0.224106 0.300518
0.580271 0.227977 0.297566
0.580793 0.231817 0.294618
0.581315 0.235646 0.291715
0.581835 0.239463 0.288810
0.582353 0.243268 0.285910
0.582870 0.247097 0.283066
0.583386 0.250916 0.280201
0.583901 0.254739 0.277381
0.584416 0.258531 0.274552
0.584931 0.262342 0.271740
0.585443 0.266156 0.268980
0.585951 0.269966 0.266198
0.586456 0.273771 0.263439
0.586961 0.277575 0.260676
0.587466 0.281374 0.257925
0.587972 0.285180 0.255221
0.588478 0.289013 0.252494
0.588984 0.292818 0.249767
0.589491 0.296652 0.247081
0.589999 0.300465 0.244376
0.590507 0.304300 0.241716
0.591016 0.308135 0.239031
0.591526 0.311969 0.236379
0.592038 0.315846 0.233692
0.592548 0.319698 0.231058
0.593055 0.323559 0.228420
0.593562 0.327429 0.225773
0.594071 0.331309 0.223134
0.594583 0.335229 0.220510
0.595095 0.339131 0.217865
0.595609 0.343048 0.215226
0.596126 0.346976 0.212613
0.596645 0.350921 0.209994
0.597164 0.354880 0.207388
0.597680 0.358830 0.204776
0.598196 0.362821 0.202147
0.598721 0.366829 0.199533
0.599248 0.370837 0.196964
0.599771 0.374879 0.194370
0.600294 0.378931 0.191738
0.600819 0.383009 0.189149
0.601346 0.387090 0.186548
0.601874 0.391215 0.183949
0.602403 0.395345 0.181345
0.602933 0.399486 0.178782
0.603464 0.403678 0.176158
0.603995 0.407873 0.173594
0.604521 0.412102 0.171015
0.605043 0.416348 0.168436
0.605562 0.420618 0.165848
0.606084 0.424928 0.163317
0.606609 0.429252 0.160731
0.607129 0.433600 0.158195
0.607639 0.437998 0.155649
0.608144 0.442412 0.153086
0.608644 0.446848 0.150582
0.609134 0.451324 0.148071
0.609610 0.455826 0.145615
0.610079 0.460356 0.143119
0.610542 0.464933 0.140685
0.610991 0.469544 0.138267
0.611421 0.474170 0.135829
0.611833 0.478839 0.133514
0.612226 0.483539 0.131212
0.612600 0.488287 0.128920
0.612950 0.493049 0.126718
0.613275 0.497875 0.124574
0.613572 0.502705 0.122487
0.613837 0.507592 0.120512
0.614069 0.512502 0.118669
0.614264 0.517459 0.116848
0.614418 0.522434 0.115160
0.614530 0.527456 0.113657
0.614594 0.532510 0.112266
0.614607 0.537595 0.111032
0.614566 0.542708 0.109999
0.614468 0.547849 0.109114
0.614308 0.553016 0.108421
0.614082 0.558212 0.108010
0.613787 0.563446 0.107850
0.613419 0.568682 0.107943
0.612974 0.573946 0.108312
0.612449 0.579232 0.109026
0.611842 0.584522 0.110040
0.611148 0.589820 0.111320
0.610353 0.595132 0.112963
0.609471 0.600443 0.114856
0.608494 0.605748 0.117169
0.607411 0.611060 0.119811
0.606215 0.616350 0.122763
0.604930 0.621618 0.126124
0.603536 0.626876 0.129757
0.602026 0.632107 0.133692
0.600413 0.637306 0.137967
0.598689 0.642469 0.142496
0.596862 0.647588 0.147334
0.594916 0.652662 0.152416
0.592872 0.657697 0.157790
0.590707 0.662667 0.163419
0.588441 0.667579 0.169258
0.586085 0.672429 0.175280
0.583613 0.677213 0.181507
0.581049 0.681916 0.187985
0.578388 0.686560 0.194586
0.575646 0.691121 0.201310
0.572809 0.695614 0.208243
0.569878 0.700018 0.215285
0.566888 0.704346 0.222470
0.563814 0.708597 0.229738
0.560662 0.712753 0.237171
0.557458 0.716845 0.244622
0.554182 0.720839 0.252219
0.550853 0.724766 0.259874
0.547470 0.728605 0.267574
0.544043 0.732376 0.275394
0.540571 0.736058 0.283238
0.537067 0.739685 0.291141
0.533507 0.743228 0.299094
0.529936 0.746702 0.307079
0.526333 0.750112 0.315113
0.522696 0.753461 0.323192
0.519049 0.756752 0.331281
0.515367 0.759983 0.339437
0.511681 0.763162 0.347595
0.507990 0.766293 0.355785
0.504280 0.769372 0.363984
0.500550 0.772410 0.372217
0.496820 0.775405 0.380485
0.493085 0.778365 0.388763
0.489350 0.781287 0.397049
0.485614 0.784180 0.405376
0.481884 0.787038 0.413711
0.478142 0.789866 0.422057
0.474411 0.792674 0.430440
0.470680 0.795455 0.438824
0.466955 0.798219 0.447235
0.463220 0.800964 0.455667
0.459518 0.803693 0.464121
0.455810 0.806409 0.472577
0.452124 0.809110 0.481054
0.448436 0.811796 0.489555
0.444772 0.814472 0.498091
0.441108 0.817144 0.506616
0.437487 0.819803 0.515175
0.433858 0.822465 0.523755
0.430280 0.825110 0.532352
0.426720 0.827756 0.540960
0.423186 0.830401 0.549598
0.419708 0.833036 0.558241
0.416257 0.835673 0.566923
0.412868 0.838305 0.575612
0.409520 0.840937 0.584314
0.406245 0.843562 0.593044
0.403035 0.846190 0.601780
0.399905 0.848819 0.610541
0.396872 0.851439 0.619320
0.393950 0.854061 0.628104
0.391152 0.856683 0.636905
0.388472 0.859301 0.645709
0.385935 0.861918 0.654530
0.383585 0.864526 0.663367
0.381407 0.867128 0.672196
0.379424 0.869728 0.681023
0.377672 0.872325 0.689863
0.376170 0.874907 0.698686
0.374923 0.877482 0.707507
0.373981 0.880045 0.716318
0.373340 0.882596 0.725106
0.373043 0.885136 0.733865
0.373112 0.887654 0.742601
0.373570 0.890156 0.751300
0.374439 0.892639 0.759946
0.375723 0.895095 0.768546
0.377467 0.897524 0.777098
0.379671 0.899923 0.785572
0.382352 0.902288 0.793974
0.385527 0.904619 0.802283
0.389213 0.906913 0.810503
0.393385 0.909161 0.818619
0.398074 0.911369 0.826627
0.403255 0.913528 0.834507
0.408926 0.915628 0.842255
0.415083 0.917688 0.849859
0.421704 0.919678 0.857309
0.428791 0.921615 0.864606
0.436305 0.923489 0.871734
0.444231 0.925293 0.878682
0.452541 0.927032 0.885454
0.461203 0.928705 0.892037
0.470211 0.930311 0.898424
0.479521 0.931839 0.904620
0.489103 0.933297 0.910617
0.498950 0.934685 0.916408
0.509019 0.936004 0.922005
0.519281 0.937246 0.927394
0.529715 0.938416 0.932588
0.540292 0.939517 0.937592
0.550997 0.940549 0.942401
0.561804 0.941509 0.947020
0.572686 0.942411 0.951459
0.583621 0.943243 0.955728
0.594606 0.944015 0.959825
0.605610 0.944731 0.963765
0.616637 0.945388 0.967563
0.627648 0.945989 0.971214
0.638645 0.946543 0.974739
0.649620 0.947052 0.978146
0.660548 0.947515 0.981449
0.671439 0.947934 0.984653
0.682276 0.948316 0.987765
0.693064 0.948662 0.990803
0.703779 0.948977 0.993775
100 changes: 100 additions & 0 deletions plotsandgraphs/cmaps/hawaiiS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
0.550541 0.006842 0.451980
0.703779 0.948977 0.993775
0.611842 0.584522 0.110040
0.423186 0.830401 0.549598
0.590507 0.304300 0.241716
0.398074 0.911369 0.826627
0.540571 0.736058 0.283238
0.573711 0.181138 0.334602
0.607129 0.433600 0.158195
0.582353 0.243268 0.285910
0.588441 0.667579 0.169258
0.377672 0.872325 0.689863
0.481884 0.787038 0.413711
0.529715 0.938416 0.932588
0.598721 0.366829 0.199533
0.563663 0.112872 0.390025
0.613572 0.502705 0.122487
0.594583 0.335229 0.220510
0.511681 0.763162 0.347595
0.603536 0.626876 0.129757
0.452541 0.927032 0.885454
0.614566 0.542708 0.109999
0.602933 0.399486 0.178782
0.566888 0.704346 0.222470
0.396872 0.851439 0.619320
0.557619 0.069970 0.420377
0.374439 0.892639 0.759946
0.568939 0.148416 0.361384
0.586456 0.273771 0.263439
0.452124 0.809110 0.481054
0.578135 0.212545 0.309542
0.616637 0.945388 0.967563
0.610542 0.464933 0.140685
0.600819 0.383009 0.189149
0.421704 0.919678 0.857309
0.613787 0.563446 0.107850
0.612226 0.483539 0.131212
0.575967 0.196978 0.321854
0.660548 0.947515 0.981449
0.614418 0.522434 0.115160
0.373340 0.882596 0.725106
0.526333 0.750112 0.315113
0.596645 0.350921 0.209994
0.382352 0.902288 0.793974
0.437487 0.819803 0.515175
0.605043 0.416348 0.168436
0.409520 0.840937 0.584314
0.489103 0.933297 0.910617
0.588478 0.289013 0.252494
0.584416 0.258531 0.274552
0.578388 0.686560 0.194586
0.385935 0.861918 0.654530
0.554182 0.720839 0.252219
0.580271 0.227977 0.297566
0.496820 0.775405 0.380485
0.572686 0.942411 0.951459
0.592548 0.319698 0.231058
0.571377 0.165008 0.347764
0.560746 0.092811 0.405012
0.554227 0.041170 0.436063
0.566380 0.131171 0.375474
0.596862 0.647588 0.147334
0.466955 0.798219 0.447235
0.608494 0.605748 0.117169
0.608644 0.446848 0.150582
0.585443 0.266156 0.268980
0.614308 0.553016 0.108421
0.572562 0.173131 0.341120
0.552426 0.023795 0.443998
0.430280 0.825110 0.532352
0.606084 0.424928 0.163317
0.381407 0.867128 0.672196
0.614594 0.532510 0.112266
0.612974 0.573946 0.108312
0.562235 0.103128 0.397471
0.565032 0.122122 0.382698
0.574840 0.189095 0.328170
0.519049 0.756752 0.331281
0.595609 0.343048 0.215226
0.408926 0.915628 0.842255
0.436305 0.923489 0.871734
0.638645 0.946543 0.974739
0.600413 0.637306 0.137967
0.589491 0.296652 0.247081
0.591526 0.311969 0.236379
0.560662 0.712753 0.237171
0.391152 0.856683 0.636905
0.609610 0.455826 0.145615
0.606215 0.616350 0.122763
0.489350 0.781287 0.397049
0.509019 0.936004 0.922005
0.579214 0.220287 0.303496
0.444772 0.814472 0.498091
0.547470 0.728605 0.267574
0.612950 0.493049 0.126718
0.470211 0.930311 0.898424
0.603995 0.407873 0.173594
0.581315 0.235646 0.291715
0.474411 0.792674 0.430440
0.504280 0.769372 0.363984
3 changes: 3 additions & 0 deletions plotsandgraphs/cmaps/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The Scientific colour maps in this folder (Crameri 2018) are used in this library to prevent visual distortion of the data and exclusion of readers with colour-vision deficiencies (Crameri et al., 2020).

Link: https://www.fabiocrameri.ch/colourmaps/ (last retrieved 12.12.2023)
Loading

0 comments on commit 23c83cc

Please sign in to comment.