From 0ceec7a819b22b88d9c0f6eba040258c44a26031 Mon Sep 17 00:00:00 2001 From: yagudin Date: Thu, 3 Jun 2021 00:34:06 +0300 Subject: [PATCH] Undoing a commit --- strmlt.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/strmlt.py b/strmlt.py index 1325412..a38735c 100644 --- a/strmlt.py +++ b/strmlt.py @@ -1,5 +1,7 @@ +import logging import numpy as np import pandas as pd +import sys import streamlit as st import uncurl from calibration import overconfidence @@ -163,11 +165,24 @@ if __name__ == "__main__": # --- - fig = plotly_calibration(y_true, y_pred, n_bins=n_bins, strategy=strategy) - st.plotly_chart(fig, use_container_width=True) + for strategy in ['uniform', 'quantile']: + for n_bins in range(1, 300): + try: + fig = plotly_calibration(y_true, y_pred, n_bins=n_bins, strategy=strategy) + # st.plotly_chart(fig, use_container_width=True) - fig = plotly_calibration_odds(y_true, y_pred, n_bins=n_bins, strategy=strategy) - st.plotly_chart(fig, use_container_width=True) + fig = plotly_calibration_odds(y_true, y_pred, n_bins=n_bins, strategy=strategy) + # st.plotly_chart(fig, use_container_width=True) + + except: + st.warning("Hey! Unfortunately, there occured a mysterious error, which I haven't been able to reproduce locally. Try refreshing the page or changing the number of bins a bit. <3") + + np.set_printoptions(threshold=sys.maxsize) + logging.info("=" * 40) + logging.info(f"n_bins={n_bins}, strategy={strategy}") + logging.info(f"true={repr(y_true)}") + logging.info(f"y_pred={repr(y_pred)}") + logging.info("=" * 40) # overconf = overconfidence(y_true, y_pred) # st.write(f"Your over/under- confidence score is {overconf:.2f}.")