Skip to content

Commit

Permalink
Update Factor_Analysis.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jvivian committed Feb 6, 2024
1 parent bd18193 commit 15d09eb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions covid19_drdfm/streamlit/pages/Factor_Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,24 @@
# Plot
f = px.line(melted_df, x="Time", y="value", color="variable", hover_data="variable", line_dash="Label")
st.plotly_chart(f, use_container_width=True)

# Model Results
results_path = path_to_results / state / "results.csv"
model_path = path_to_results / state / "model.csv"

values = pd.Series()
with open(results_path) as f:
for line in f.readlines():
if "AIC" in line:
values["AIC"] = float(line.strip().split(",")[-1])
elif "Log Likelihood" in line:
values["LogLikelihood"] = float(line.strip().split(",")[-1])
elif "EM" in line:
values["EM Iterations"] = float(line.strip().split(",")[-1])

_, c1, c2, c3, _ = st.columns(5)
help_msgs = ["LogLikelihood: Higher is better", "AIC: Lower is better", "Number of steps to convergence"]
for val, col, msg in zip(values.index, [c1, c2, c3], help_msgs):
col.metric(val, values[val], help=msg)

# TODO: Plot values against distribution of (i.e. against AIC for all states)

0 comments on commit 15d09eb

Please sign in to comment.