metriculous-ml / metriculous Goto Github PK
View Code? Open in Web Editor NEWMeasure and visualize machine learning model performance without the usual boilerplate.
License: MIT License
Measure and visualize machine learning model performance without the usual boilerplate.
License: MIT License
Hi,
Great library! Thank you!
Question: I am getting the following warning:
D:\Anaconda3\envs\fml\lib\site-packages\metriculous\evaluators\_classification_figures_bokeh.py:146: RuntimeWarning: invalid value encountered in true_divide
cm_normalized_by_pred = cm.astype("float") / cm.sum(axis=0, keepdims=True)
I have created a dummy model which predicts the most frequent class (ie always 1). Here is the confusion matrix "cm" in the code:
Is there a way to prevent the warning from appearing in this corner case?
Thank you.
for example, with the trained model, I would like to display all metrics of the model on different dataset: train-set, valid-set, test-set?
How to do it?
Thanks a lot
I am running compare_classifiers
in a ipynb and I am getting this error
/metriculous/_comparison.py:333, in _html_quantity_comparison_table.<locals>.stylish_table_html(df, highlight_fn)
331 df_styled = df_styled.apply(highlight_primary_metric, axis=1)
332 if highlight_fn is None:
--> 333 return df_styled.render()
334 else:
335 return df_styled.apply(highlight_fn, axis=1, subset=df.columns[1:]).render()
AttributeError: 'Styler' object has no attribute 'render'
my code is:
metriculous.compare_classifiers(
ground_truth=labels,
model_predictions=[outputs],
model_names=["..."],
class_names=["Negative", "Positive"],
one_vs_all_figures=True,
).save_html(path)
just wondering if someone has the same problem or knows how to solve it
Could you provide some documentation or at least a link about the automation rate analysis plot in classification reports?
Thanks!
First, thanks for the library, it's really cool.
I only obtain the plots until the "scatter confusion matrix", I get the following error:
python3.8/site-packages/metriculous/evaluators/_classification_figures_bokeh.py:161: RuntimeWarning: invalid value encountered in true_divide
cm_normalized_by_pred = cm.astype("float") / cm.sum(axis=0, keepdims=True)
This happens every time I have a model which NEVER predicts one of the classes. E.g.: a naive model always predicting the majority class.
Also, there would be nice to have an option that allows to show the numbers directly on the confusion matrix, without the need of hovering over it.
I believe this is a bug with the Metriculous Bokeh integration but I'm not sure what is triggering it.
Here is a a code snippet to reproduce it:
import metriculous
import numpy as np
predictions = [np.array([[0.02651198, 0.31270504, 0.04171027, 0.08619863, 0.16541226,
0.11558858, 0.12004455, 0.13182868],
[0.0636719 , 0.18429258, 0.08450789, 0.1157857 , 0.21399513,
0.08028985, 0.09965403, 0.15780292],
[0.03115291, 0.30915564, 0.04554546, 0.11180063, 0.11298609,
0.12809892, 0.12540455, 0.1358558 ],
[0.07111797, 0.12305891, 0.07020132, 0.15796672, 0.24655697,
0.0836428 , 0.07912376, 0.16833155],
[0.07959884, 0.12210452, 0.06945297, 0.15947734, 0.2427768 ,
0.08263489, 0.07852125, 0.16543338],
[0.01766902, 0.33444592, 0.0312464 , 0.304933 , 0.07606831,
0.11432294, 0.0662983 , 0.05501606],
[0.07516593, 0.09484643, 0.14125083, 0.06031764, 0.25438443,
0.09057547, 0.12231521, 0.16114406],
[0.01725348, 0.2626249 , 0.03184433, 0.09360438, 0.28739157,
0.14218643, 0.07242204, 0.09267287],
[0.06459036, 0.16860159, 0.06819151, 0.10878273, 0.24783328,
0.08361257, 0.08607707, 0.17231087],
[0.02426506, 0.35321227, 0.0365901 , 0.10876535, 0.19372101,
0.11075294, 0.07755516, 0.09513812],
[0.01334525, 0.40144277, 0.02168825, 0.2738081 , 0.07262825,
0.11011887, 0.06275296, 0.04421557],
[0.05111578, 0.18965946, 0.06345861, 0.10171634, 0.29270712,
0.06656697, 0.06664741, 0.16812828],
[0.03433737, 0.35056743, 0.04554536, 0.1223052 , 0.14757192,
0.10423103, 0.08725566, 0.10818605],
[0.02045722, 0.36372438, 0.06161968, 0.20598333, 0.07393774,
0.13290711, 0.06163201, 0.07973854],
[0.06024894, 0.17526025, 0.0700492 , 0.11108048, 0.20588736,
0.11613052, 0.08757272, 0.17377052],
[0.06320383, 0.11961269, 0.07309992, 0.13411018, 0.21522452,
0.12376933, 0.09002887, 0.18095064],
[0.06320383, 0.11961269, 0.07309992, 0.13411018, 0.21522452,
0.12376933, 0.09002887, 0.18095064],
[0.02111111, 0.37781438, 0.03542091, 0.15676846, 0.07582452,
0.11120252, 0.07607654, 0.14578155],
[0.01435957, 0.56506133, 0.02622501, 0.10991825, 0.05670529,
0.09522142, 0.05140135, 0.08110777],
[0.01447272, 0.56697184, 0.02637914, 0.11005513, 0.05682856,
0.09225151, 0.05152839, 0.08151273],
[0.04570318, 0.11008076, 0.06587777, 0.09217358, 0.25748935,
0.1264705 , 0.11295175, 0.1892531 ],
[0.01105192, 0.43763763, 0.02243476, 0.25057724, 0.07013009,
0.1070659 , 0.06017836, 0.04092411],
[0.01105192, 0.43763763, 0.02243476, 0.25057724, 0.07013009,
0.1070659 , 0.06017836, 0.04092411],
[0.06399985, 0.12088028, 0.09812263, 0.13254756, 0.2368868 ,
0.06306084, 0.07799452, 0.20650752],
[0.02580354, 0.2912477 , 0.0452958 , 0.10479757, 0.19409011,
0.11631037, 0.07928232, 0.14317259],
[0.02394 , 0.28100577, 0.06761745, 0.10079238, 0.18286197,
0.11120233, 0.07584769, 0.15673243],
[0.02859701, 0.12345824, 0.02452153, 0.12446079, 0.10724279,
0.30250114, 0.14545403, 0.14376447],
[0.01763562, 0.26390415, 0.02797072, 0.09410465, 0.33519107,
0.09990271, 0.07291644, 0.08837461],
[0.05719835, 0.11961728, 0.06110419, 0.09842541, 0.23005427,
0.12413418, 0.10744236, 0.20202397],
[0.01512977, 0.44863623, 0.02352207, 0.09241457, 0.1371182 ,
0.1376256 , 0.06627141, 0.07928215],
[0.13617955, 0.11844175, 0.06990904, 0.09725405, 0.2089029 ,
0.14193644, 0.07938706, 0.14798921],
[0.05659495, 0.12756449, 0.09210333, 0.12443028, 0.23832083,
0.0680717 , 0.0928731 , 0.20004131],
[0.04699743, 0.17098074, 0.06562918, 0.06444676, 0.25861254,
0.0523265 , 0.10781392, 0.23319292],
[0.06176807, 0.17528789, 0.07962973, 0.06739685, 0.2270808 ,
0.06453936, 0.11641537, 0.20788196],
[0.05633127, 0.11881155, 0.07823401, 0.1879416 , 0.19890387,
0.10915504, 0.08803149, 0.16259117],
[0.03467053, 0.3494804 , 0.06560414, 0.08256355, 0.11014081,
0.13175112, 0.10785011, 0.11793937],
[0.02571611, 0.4676369 , 0.0442673 , 0.14291236, 0.07799932,
0.12573668, 0.0587831 , 0.05694821],
[0.02525828, 0.40146384, 0.05145144, 0.11157996, 0.12324058,
0.10363442, 0.07611745, 0.10725403],
[0.04221298, 0.05616246, 0.05433249, 0.09642576, 0.26045817,
0.10190966, 0.18601942, 0.20247905],
[0.04178631, 0.1104403 , 0.0894035 , 0.09241916, 0.2568906 ,
0.10427111, 0.11317873, 0.19161028],
[0.04844856, 0.16488735, 0.082458 , 0.10612834, 0.23859234,
0.09024726, 0.09954155, 0.1696966 ],
[0.12209805, 0.05936319, 0.22111115, 0.08510352, 0.09670409,
0.0603577 , 0.21275316, 0.14250913]], dtype='float32')]
ground_truth = [3, 4, 3, 5, 7, 1, 7, 1, 2, 5, 3, 6, 0, 6, 4, 6, 5, 4, 1, 6, 0, 4, 7, 2, 6, 6, 5, 7, 1, 3, 4, 5, 1, 3, 7, 3, 1, 1, 4, 0, 5, 7]
reporter = metriculous.compare_classifiers(
ground_truth=ground_truth,
model_predictions=predictions
)
reporter.save_html('./metriculous_out.html')
I was able to reproduce this on the latest version and the develop branch.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.