Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

114 roadmap create a UI for whitebox server using streamlit or similar tools #131

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
85ddea2
Initialised streamlit dev
stavrostheocharis Feb 8, 2023
0ea94c0
Added Drift parts
stavrostheocharis Feb 10, 2023
a625120
App formating
stavrostheocharis Feb 11, 2023
fd9badc
Formated overview and drifting tabs
stavrostheocharis Feb 11, 2023
2e65d34
Additions
stavrostheocharis Feb 12, 2023
6bfc696
Added markdowns in functions
stavrostheocharis Feb 12, 2023
3cd5203
Removed unused imports from app
stavrostheocharis Feb 12, 2023
0031cb4
Inferences tab addition
stavrostheocharis Feb 15, 2023
3f9e3c8
Added style to inferences dataframe
stavrostheocharis Feb 15, 2023
4925535
Adjustments and additions
stavrostheocharis Feb 15, 2023
c97f2ff
Added monitors tab
stavrostheocharis Feb 16, 2023
99b2fab
Added alerts tab
stavrostheocharis Feb 16, 2023
e94d818
Added filters in alerts
stavrostheocharis Feb 17, 2023
3e69aad
Formating
stavrostheocharis Feb 17, 2023
8ce1019
Additions for different model types
stavrostheocharis Feb 17, 2023
035c478
Fixed types and name conventions
stavrostheocharis Feb 17, 2023
15e2e10
SDK connection to streamlit
stavrostheocharis Feb 20, 2023
2e6483a
Added sdk functionality in Streamlit
stavrostheocharis Feb 20, 2023
384a5ed
Added connection functionality in sidebar
stavrostheocharis Feb 20, 2023
424ee25
Additions
stavrostheocharis Feb 21, 2023
b086ad0
Adjusted expanders descriptions
stavrostheocharis Feb 21, 2023
10d0de3
Added cache functionality
stavrostheocharis Feb 21, 2023
7235d1a
Minor fixes
stavrostheocharis Feb 21, 2023
bb7e4f5
Additions/adjustments
stavrostheocharis Feb 23, 2023
65d513f
Deleted prints
stavrostheocharis Feb 23, 2023
0648112
Added error catch in inference log
stavrostheocharis Feb 23, 2023
4a1746e
Merge branch 'main' into 114-roadmap-create-a-ui-for-whitebox-server-…
stavrostheocharis Feb 23, 2023
9494457
Black formating
stavrostheocharis Feb 23, 2023
7b9f093
Black formating
stavrostheocharis Feb 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Formated overview and drifting tabs
  • Loading branch information
stavrostheocharis committed Feb 11, 2023
commit fd9badc8d1f9220ee54dfd606869ecb4bfe25538
20 changes: 18 additions & 2 deletions whitebox/streamlit/cards.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import streamlit as st


def card(text):
def card1(text1, text2):
st.markdown(
f"""
<div class="card text-white bg-dark mb-3" style="max-width: 280rem;">
<div class="card-body">
<p class="card-text">{text}</p>
<p class="card-text"><b>{text1}</b></p>
<p class="card-text">{text2}</p>
</div>
</div>
""",
unsafe_allow_html=True,
)


def card(text1, text2, text3):
st.markdown(
f"""
<div class="card text-white bg-dark mb-3" style="width: 44rem;">
<div class="card-body">
<h5 class="card-title"><b>{text1}</b></h5>
<h6 class="card-subtitle mb-2 text-muted">type: {text2}</h6>
<p class="card-text">{text3}</p>
</div>
</div>
""",
Expand Down
131 changes: 131 additions & 0 deletions whitebox/streamlit/mock/performance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
[
{
"id": "b4bff1cd-76bd-47e6-8446-4ce690096dac",
"created_at": "2023-02-09T14:33:00.473312",
"updated_at": "2023-02-09T14:33:00.473312",
"accuracy": 0.6,
"precision": {
"micro": 0.6,
"macro": 0.7333333333333334,
"weighted": 0.9199999999999999
},
"recall": {
stavrostheocharis marked this conversation as resolved.
Show resolved Hide resolved
"micro": 0.6,
"macro": 0.7000000000000001,
"weighted": 0.6
},
"f1": {
"micro": 0.6,
"macro": 0.5833333333333334,
"weighted": 0.675
},
"confusion_matrix": {
"class0": {
"true_negative": 5,
"false_positive": 4,
"false_negative": 0,
"true_positive": 1
},
"class1": {
"true_negative": 5,
"false_positive": 0,
"false_negative": 2,
"true_positive": 3
},
"class2": {
"true_negative": 6,
"false_positive": 0,
"false_negative": 2,
"true_positive": 2
}
},
"model_id": "83539c2b-579f-4a2c-b7ba-02d31c9408d8",
"timestamp": "2022-12-22T00:00:00"
},
{
"id": "0ffa0e1d-8e8a-4658-8443-7405a9cd6fd5",
"created_at": "2023-02-09T14:36:00.522083",
"updated_at": "2023-02-09T14:36:00.522083",
"accuracy": 0.45,
"precision": {
"micro": 0.45,
"macro": 0.48611111111111116,
"weighted": 0.6125
},
"recall": {
"micro": 0.45,
"macro": 0.46296296296296297,
"weighted": 0.45
},
"f1": {
"micro": 0.45,
"macro": 0.4222222222222222,
"weighted": 0.5000000000000001
},
"confusion_matrix": {
"class0": {
"true_negative": 11,
"false_positive": 7,
"false_negative": 1,
"true_positive": 1
},
"class1": {
"true_negative": 10,
"false_positive": 1,
"false_negative": 4,
"true_positive": 5
},
"class2": {
"true_negative": 8,
"false_positive": 3,
"false_negative": 6,
"true_positive": 3
}
},
"model_id": "83539c2b-579f-4a2c-b7ba-02d31c9408d8",
"timestamp": "2022-12-23T00:00:00"
},
{
"id": "ca19193b-5c9b-478b-93a7-48c7b08af306",
"created_at": "2023-02-09T14:39:00.618561",
"updated_at": "2023-02-09T14:39:00.618561",
"accuracy": 0.43333333333333335,
"precision": {
"micro": 0.43333333333333335,
"macro": 0.48860398860398857,
"weighted": 0.6921652421652421
},
"recall": {
"micro": 0.43333333333333335,
"macro": 0.4447415329768271,
"weighted": 0.43333333333333335
},
"f1": {
"micro": 0.43333333333333335,
"macro": 0.389923526765632,
"weighted": 0.5119928025191183
},
"confusion_matrix": {
"class0": {
"true_negative": 16,
"false_positive": 12,
"false_negative": 1,
"true_positive": 1
},
"class1": {
"true_negative": 12,
"false_positive": 1,
"false_negative": 9,
"true_positive": 8
},
"class2": {
"true_negative": 15,
"false_positive": 4,
"false_negative": 7,
"true_positive": 4
}
},
"model_id": "83539c2b-579f-4a2c-b7ba-02d31c9408d8",
"timestamp": "2022-12-24T00:00:00"
}
]
1 change: 1 addition & 0 deletions whitebox/streamlit/tabs/drifting.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def create_drift_tab(drift):
It created 2 tabs of graphs, one with the combined drifts of variables
and one tab with graphs for each one variable.
"""
st.title("Drifting")
# Isolate timeseties parts from the drift object
value_df, drift_df = export_drift_timeseries_from_dict(drift)
# Keep the columns except the time/index
Expand Down
26 changes: 23 additions & 3 deletions whitebox/streamlit/tabs/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,30 @@ def create_overview_tab(model, confusion_matrix, base_evaluation_metrics):
unsafe_allow_html=True,
)

st.header("Model: " + model["name"])
st.write(card(model["description"]))
st.title("Overview")
st.write(card(model["name"], model["type"], model["description"]))
st.header("Performance")
st.table(base_evaluation_metrics)

col1, col2, col3, col4 = st.columns(4)
col1.metric(
label="Accuracy",
value=base_evaluation_metrics["accuracy"].iloc[0],
)

col2.metric(
label="Precision",
value=base_evaluation_metrics["precision"].iloc[0],
)

col3.metric(
label="Recall",
value=base_evaluation_metrics["recall"].iloc[0],
)

col4.metric(
label="F1",
value=base_evaluation_metrics["f1"].iloc[0],
)

st.header("Confusion matrix")
disp = ConfusionMatrixDisplay(
Expand Down