KiTE.plots

 1from plotly.subplots import make_subplots
 2import plotly.graph_objs as go
 3import kaleido  # noqa
 4
 5
 6# Plot Histogram of X-Test, prob_pos
 7def plot_probability_frequency(prob_pos, ELCE2_, name="Name_of_model"):
 8    """
 9    Utility to plot histogram of X-Test, prob_pos
10
11    Parameters
12    ----------
13    prob_pos : numpy-array
14
15    ELCE2_ : tuple or int
16
17    name : string
18        Model Name
19
20    Returns
21    -------
22    fig : Histogram Plotly Figure
23    """
24    hist = go.Histogram(x=prob_pos, name=name)
25    ELCE_trace = plot_ELCE2_number_line(ELCE2_)
26    fig = make_subplots(rows=2, cols=1, row_heights=[0.85, 0.15])
27    fig.append_trace(hist, 1, 1)
28    fig.append_trace(ELCE_trace, 2, 1)
29    fig.update_layout(title_text=f"{name} and ELCE2 Estimator")
30    return fig
31
32
33def plot_ELCE2_number_line(ELCE2_):
34    ELCE_trace = go.Scatter(
35        x=[ELCE2_ * 100], y=[0, 0], mode="markers", marker_size=20, name="ELCE2"
36    )
37    return ELCE_trace
def plot_probability_frequency(prob_pos, ELCE2_, name='Name_of_model'):
 8def plot_probability_frequency(prob_pos, ELCE2_, name="Name_of_model"):
 9    """
10    Utility to plot histogram of X-Test, prob_pos
11
12    Parameters
13    ----------
14    prob_pos : numpy-array
15
16    ELCE2_ : tuple or int
17
18    name : string
19        Model Name
20
21    Returns
22    -------
23    fig : Histogram Plotly Figure
24    """
25    hist = go.Histogram(x=prob_pos, name=name)
26    ELCE_trace = plot_ELCE2_number_line(ELCE2_)
27    fig = make_subplots(rows=2, cols=1, row_heights=[0.85, 0.15])
28    fig.append_trace(hist, 1, 1)
29    fig.append_trace(ELCE_trace, 2, 1)
30    fig.update_layout(title_text=f"{name} and ELCE2 Estimator")
31    return fig

Utility to plot histogram of X-Test, prob_pos

Parameters
  • prob_pos (numpy-array):

  • ELCE2_ (tuple or int):

  • name (string): Model Name

Returns
  • fig (Histogram Plotly Figure):
def plot_ELCE2_number_line(ELCE2_):
34def plot_ELCE2_number_line(ELCE2_):
35    ELCE_trace = go.Scatter(
36        x=[ELCE2_ * 100], y=[0, 0], mode="markers", marker_size=20, name="ELCE2"
37    )
38    return ELCE_trace