cyberosa
commited on
Commit
·
fe854e6
1
Parent(s):
3546de0
updated the mech requests top three most accurate tools only for pearl agents
Browse files- app.py +14 -2
- tabs/tool_accuracy.py +13 -6
app.py
CHANGED
@@ -164,7 +164,15 @@ def load_all_data():
|
|
164 |
repo_type="dataset",
|
165 |
)
|
166 |
df8 = pd.read_parquet(errors_by_mech)
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
|
170 |
def prepare_data():
|
@@ -180,6 +188,7 @@ def prepare_data():
|
|
180 |
winning_df,
|
181 |
daily_mech_requests,
|
182 |
errors_by_mech,
|
|
|
183 |
) = load_all_data()
|
184 |
print(trades_df.info())
|
185 |
|
@@ -213,6 +222,7 @@ def prepare_data():
|
|
213 |
winning_df,
|
214 |
daily_mech_requests,
|
215 |
errors_by_mech,
|
|
|
216 |
)
|
217 |
|
218 |
|
@@ -225,6 +235,7 @@ def prepare_data():
|
|
225 |
winning_df,
|
226 |
daily_mech_requests,
|
227 |
errors_by_mech,
|
|
|
228 |
) = prepare_data()
|
229 |
trades_df = trades_df.sort_values(by="creation_timestamp", ascending=True)
|
230 |
unknown_trades = unknown_trades.sort_values(by="creation_timestamp", ascending=True)
|
@@ -539,12 +550,13 @@ with demo:
|
|
539 |
|
540 |
with gr.Row():
|
541 |
gr.Markdown(
|
542 |
-
"# Mech requests percentage of the top three tools from the daily total"
|
543 |
)
|
544 |
with gr.Row():
|
545 |
_ = plot_mech_requests_topthree_tools(
|
546 |
daily_mech_requests=daily_mech_requests,
|
547 |
tools_accuracy_info=tools_accuracy_info,
|
|
|
548 |
top=3,
|
549 |
)
|
550 |
|
|
|
164 |
repo_type="dataset",
|
165 |
)
|
166 |
df8 = pd.read_parquet(errors_by_mech)
|
167 |
+
|
168 |
+
# Read pearl_agents.parquet
|
169 |
+
pearl_agents_df = hf_hub_download(
|
170 |
+
repo_id="valory/Olas-predict-dataset",
|
171 |
+
filename="pearl_agents.parquet",
|
172 |
+
repo_type="dataset",
|
173 |
+
)
|
174 |
+
df9 = pd.read_parquet(pearl_agents_df)
|
175 |
+
return df1, df2, df3, df4, df5, df6, df7, df8, df9
|
176 |
|
177 |
|
178 |
def prepare_data():
|
|
|
188 |
winning_df,
|
189 |
daily_mech_requests,
|
190 |
errors_by_mech,
|
191 |
+
pearl_agents_df,
|
192 |
) = load_all_data()
|
193 |
print(trades_df.info())
|
194 |
|
|
|
222 |
winning_df,
|
223 |
daily_mech_requests,
|
224 |
errors_by_mech,
|
225 |
+
pearl_agents_df,
|
226 |
)
|
227 |
|
228 |
|
|
|
235 |
winning_df,
|
236 |
daily_mech_requests,
|
237 |
errors_by_mech,
|
238 |
+
pearl_agents_df,
|
239 |
) = prepare_data()
|
240 |
trades_df = trades_df.sort_values(by="creation_timestamp", ascending=True)
|
241 |
unknown_trades = unknown_trades.sort_values(by="creation_timestamp", ascending=True)
|
|
|
550 |
|
551 |
with gr.Row():
|
552 |
gr.Markdown(
|
553 |
+
"# Mech requests percentage of the top three tools from the daily total (only for Pearl Agents)"
|
554 |
)
|
555 |
with gr.Row():
|
556 |
_ = plot_mech_requests_topthree_tools(
|
557 |
daily_mech_requests=daily_mech_requests,
|
558 |
tools_accuracy_info=tools_accuracy_info,
|
559 |
+
pearl_agents=pearl_agents_df,
|
560 |
top=3,
|
561 |
)
|
562 |
|
tabs/tool_accuracy.py
CHANGED
@@ -135,19 +135,26 @@ def plot_tools_weighted_accuracy_rotated_graph(
|
|
135 |
|
136 |
|
137 |
def plot_mech_requests_topthree_tools(
|
138 |
-
daily_mech_requests: pd.DataFrame,
|
|
|
|
|
|
|
139 |
):
|
140 |
-
"""Function to plot the percentage of mech requests from the top three tools"""
|
141 |
# Get the top three tools
|
142 |
top_tools = tools_accuracy_info.sort_values(
|
143 |
by="tool_accuracy", ascending=False
|
144 |
).head(top)
|
145 |
top_tools = top_tools.tool.tolist()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
# Filter the daily mech requests for the top three tools
|
147 |
-
|
148 |
-
daily_mech_requests_local_copy = daily_mech_requests_local_copy[
|
149 |
-
daily_mech_requests_local_copy["market_creator"] == "all"
|
150 |
-
]
|
151 |
# Get the daily total of mech requests no matter the tool
|
152 |
total_daily_mech_requests = (
|
153 |
daily_mech_requests_local_copy.groupby(["request_date"])
|
|
|
135 |
|
136 |
|
137 |
def plot_mech_requests_topthree_tools(
|
138 |
+
daily_mech_requests: pd.DataFrame,
|
139 |
+
tools_accuracy_info: pd.DataFrame,
|
140 |
+
pearl_agents: pd.DataFrame,
|
141 |
+
top: int,
|
142 |
):
|
143 |
+
"""Function to plot the percentage of mech requests from the top three tools only for pearl agents"""
|
144 |
# Get the top three tools
|
145 |
top_tools = tools_accuracy_info.sort_values(
|
146 |
by="tool_accuracy", ascending=False
|
147 |
).head(top)
|
148 |
top_tools = top_tools.tool.tolist()
|
149 |
+
# Get the list of unique addresses from the daa_pearl_df
|
150 |
+
unique_addresses = pearl_agents["safe_address"].unique()
|
151 |
+
# Filter the weekly_roi_df to include only those addresses
|
152 |
+
daily_mech_requests_local_copy = daily_mech_requests[
|
153 |
+
daily_mech_requests["trader_address"].isin(unique_addresses)
|
154 |
+
].copy()
|
155 |
+
|
156 |
# Filter the daily mech requests for the top three tools
|
157 |
+
|
|
|
|
|
|
|
158 |
# Get the daily total of mech requests no matter the tool
|
159 |
total_daily_mech_requests = (
|
160 |
daily_mech_requests_local_copy.groupby(["request_date"])
|