Skip to content

Commit

Permalink
icons change
Browse files Browse the repository at this point in the history
  • Loading branch information
XianBW committed Aug 2, 2024
1 parent 5eb6cf3 commit 7e6e53c
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions rdagent/log/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
QlibModelExperiment,
QlibModelScenario,
)
from rdagent.scenarios.data_mining.experiment.model_experiment import DMModelScenario
from rdagent.app.model_extraction_and_code.GeneralModel import GeneralModelScenario
from st_btn_select import st_btn_select

Expand Down Expand Up @@ -260,7 +261,7 @@ def hypothesis_hover_text(h: Hypothesis, d: bool = False):


def summary_window():
if state.log_type in ["qlib_model", "qlib_factor"]:
if state.log_type in ["qlib_model", "data_mining", "qlib_factor"]:
st.header("Summary📊", divider="rainbow", anchor="_summary")
with st.container():
# TODO: not fixed height
Expand Down Expand Up @@ -328,11 +329,17 @@ def summary_window():
# Evolving Feedback
evolving_feedback_window(state.msgs[state.lround]["d.evolving feedback"][-1].content[j])

def tabs_hint():
st.markdown("<p style='font-size: small; color: #888888;'>You can navigate through the tabs using ⬅️ ➡️ or by holding Shift and scrolling with the mouse wheel🖱️.</p>", unsafe_allow_html=True)

# TODO: when tab names are too long, some tabs are not shown
def tasks_window(tasks: list[FactorTask | ModelTask]):
if isinstance(tasks[0], FactorTask):
st.markdown("**Factor Tasks**")
tabs = st.tabs([f.factor_name for f in tasks])
st.markdown("**Factor Tasks🚩**")
tnames = [f.factor_name for f in tasks]
if sum(len(tn) for tn in tnames) > 100:
tabs_hint()
tabs = st.tabs(tnames)
for i, ft in enumerate(tasks):
with tabs[i]:
# st.markdown(f"**Factor Name**: {ft.factor_name}")
Expand All @@ -346,8 +353,11 @@ def tasks_window(tasks: list[FactorTask | ModelTask]):
st.markdown(mks)

elif isinstance(tasks[0], ModelTask):
st.markdown("**Model Tasks**")
tabs = st.tabs([m.name for m in tasks])
st.markdown("**Model Tasks🚩**")
tnames = [m.name for m in tasks]
if sum(len(tn) for tn in tnames) > 100:
tabs_hint()
tabs = st.tabs(tnames)
for i, mt in enumerate(tasks):
with tabs[i]:
# st.markdown(f"**Model Name**: {mt.name}")
Expand All @@ -374,7 +384,7 @@ def tasks_window(tasks: list[FactorTask | ModelTask]):
folders = [folder.relative_to(main_log_path) for folder in main_log_path.iterdir() if folder.is_dir()]
st.selectbox("Select from `ep03:/data/userdata/share`", folders, key="log_path", on_change=refresh)

st.selectbox(":blue[**trace type**]", ["qlib_model", "qlib_factor", "model_extraction_and_implementation"], key="log_type")
st.selectbox(":blue[**trace type**]", ["qlib_model", "data_mining", "qlib_factor", "model_extraction_and_implementation"], key="log_type")

with st.container(border=True):
st.markdown(":blue[**excluded configs**]")
Expand Down Expand Up @@ -469,6 +479,8 @@ def tasks_window(tasks: list[FactorTask | ModelTask]):
# TODO: other scenarios
if state.log_type == "qlib_model":
st.markdown(QlibModelScenario().rich_style_description)
elif state.log_type == "data_mining":
st.markdown(DMModelScenario().rich_style_description)
elif state.log_type == "qlib_factor":
st.markdown(QlibFactorScenario().rich_style_description)
elif state.log_type == "model_extraction_and_implementation":
Expand All @@ -479,10 +491,10 @@ def tasks_window(tasks: list[FactorTask | ModelTask]):
summary_window()

# R&D Loops Window
if state.log_type in ["qlib_model", "qlib_factor"]:
if state.log_type in ["qlib_model", "data_mining", "qlib_factor"]:
st.header("R&D Loops♾️", divider="rainbow", anchor="_rdloops")

if state.log_type in ["qlib_model", "qlib_factor"]:
if state.log_type in ["qlib_model", "data_mining", "qlib_factor"]:
if len(state.msgs) > 1:
r_options = list(state.msgs.keys())
if 0 in r_options:
Expand All @@ -495,9 +507,9 @@ def tasks_window(tasks: list[FactorTask | ModelTask]):

def research_window():
with st.container(border=True):
title = "Research🔍" if state.log_type in ["qlib_model", "qlib_factor"] else "Research🔍 (reader)"
title = "Research🔍" if state.log_type in ["qlib_model", "data_mining", "qlib_factor"] else "Research🔍 (reader)"
st.subheader(title, divider="blue", anchor="_research")
if state.log_type in ["qlib_model", "qlib_factor"]:
if state.log_type in ["qlib_model", "data_mining", "qlib_factor"]:
# pdf image
if pim := state.msgs[round]["r.extract_factors_and_implement.load_pdf_screenshot"]:
for i in range(min(2, len(pim))):
Expand Down Expand Up @@ -532,7 +544,7 @@ def research_window():


def feedback_window():
if state.log_type in ["qlib_model", "qlib_factor"]:
if state.log_type in ["qlib_model", "data_mining", "qlib_factor"]:
with st.container(border=True):
st.subheader("Feedback📝", divider="orange", anchor="_feedback")
if fbr := state.msgs[round]["ef.Quantitative Backtesting Chart"]:
Expand All @@ -552,7 +564,7 @@ def feedback_window():
)


if state.log_type in ["qlib_model", "qlib_factor"]:
if state.log_type in ["qlib_model", "data_mining", "qlib_factor"]:
rf_c, d_c = st.columns([2, 2])
elif state.log_type == "model_extraction_and_implementation":
rf_c = st.container()
Expand All @@ -566,12 +578,12 @@ def feedback_window():

# Development Window (Evolving)
with d_c.container(border=True):
title = "Development🛠️" if state.log_type in ["qlib_model", "qlib_factor"] else "Development🛠️ (evolving coder)"
title = "Development🛠️" if state.log_type in ["qlib_model", "data_mining", "qlib_factor"] else "Development🛠️ (evolving coder)"
st.subheader(title, divider="green", anchor="_development")

# Evolving Status
if state.erounds[round] > 0:
st.markdown("**🔸Evolving Status🔸**")
st.markdown("**☑️ Evolving Status**")
es = state.e_decisions[round]
e_status_mks = "".join(f"| {ei} " for ei in range(1, state.erounds[round]+1)) + "|\n"
e_status_mks += "|--" * state.erounds[round] + "|\n"
Expand All @@ -586,7 +598,7 @@ def feedback_window():
# Evolving Tabs
if state.erounds[round] > 0:
if state.erounds[round] > 1:
st.markdown("**🔹Evolving Rounds🔹**")
st.markdown("**🔄️Evolving Rounds**")
evolving_round = st_btn_select(options=range(1, state.erounds[round]+1), index=state.erounds[round]-1, key="show_eround")
else:
evolving_round = 1
Expand All @@ -601,7 +613,8 @@ def feedback_window():
tab_names[j] += "✔️"
else:
tab_names[j] += "❌"

if sum(len(tn) for tn in tab_names) > 100:
tabs_hint()
wtabs = st.tabs(tab_names)
for j, w in enumerate(ws):
with wtabs[j]:
Expand Down

0 comments on commit 7e6e53c

Please sign in to comment.