cyberosa
commited on
Commit
·
180a869
1
Parent(s):
24967d3
separate tools accuracy files
Browse files- old_tools_accuracy.csv +13 -0
- scripts/update_tools_accuracy.py +43 -11
- tools_accuracy.csv +10 -10
old_tools_accuracy.csv
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tool,tool_accuracy,total_requests,min,max
|
| 2 |
+
claude-prediction-offline,58.76814365586698,54909,2025-03-28 08:16:20,2025-05-20 17:10:50
|
| 3 |
+
claude-prediction-online,61.63179618559636,28104,2025-03-28 00:00:50,2025-05-21 18:47:35
|
| 4 |
+
prediction-offline,55.357203757526605,263897,2025-03-28 00:00:10,2025-05-22 23:59:50
|
| 5 |
+
prediction-offline-sme,55.578011317704124,2474,2025-03-28 07:16:30,2025-05-22 19:00:30
|
| 6 |
+
prediction-online,47.6514007716826,11922,2025-03-28 07:07:05,2025-05-22 23:42:45
|
| 7 |
+
prediction-online-sme,48.10738702684675,5997,2025-03-28 07:32:15,2025-05-22 23:59:05
|
| 8 |
+
prediction-request-rag,48.03921568627451,204,2025-03-28 08:40:25,2025-05-20 15:37:10
|
| 9 |
+
prediction-request-rag-claude,49.074074074074076,216,2025-03-28 08:48:25,2025-05-20 13:30:50
|
| 10 |
+
prediction-request-reasoning,52.21228217314323,107310,2025-03-28 07:14:45,2025-05-22 23:58:30
|
| 11 |
+
prediction-request-reasoning-claude,64.60674157303372,178,2025-03-28 15:23:25,2025-05-20 12:25:10
|
| 12 |
+
prediction-url-cot-claude,57.27636849132176,749,2025-03-28 07:13:15,2025-05-20 15:21:20
|
| 13 |
+
superforcaster,53.24888736733995,14605,2025-03-28 00:20:00,2025-05-22 23:42:50
|
scripts/update_tools_accuracy.py
CHANGED
|
@@ -11,7 +11,7 @@ IPFS_SERVER = "/dns/registry.autonolas.tech/tcp/443/https"
|
|
| 11 |
GCP_IPFS_SERVER = "/dns/registry.gcp.autonolas.tech/tcp/443/https"
|
| 12 |
|
| 13 |
|
| 14 |
-
def
|
| 15 |
tools_acc: pd.DataFrame, tools_df: pd.DataFrame, inc_tools: List[str]
|
| 16 |
) -> pd.DataFrame:
|
| 17 |
"""To compute/update the latest accuracy information for the different mech tools"""
|
|
@@ -94,6 +94,34 @@ def update_tools_accuracy(
|
|
| 94 |
return tools_acc
|
| 95 |
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
def compute_tools_accuracy():
|
| 98 |
print("Computing accuracy of tools")
|
| 99 |
print("Reading tools parquet file")
|
|
@@ -101,28 +129,32 @@ def compute_tools_accuracy():
|
|
| 101 |
# Computing tools accuracy information
|
| 102 |
print("Computing tool accuracy information")
|
| 103 |
# Check if the file exists
|
| 104 |
-
acc_data = None
|
| 105 |
if os.path.exists(ROOT_DIR / ACCURACY_FILENAME):
|
| 106 |
acc_data = pd.read_csv(ROOT_DIR / ACCURACY_FILENAME)
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
# save acc_data into a CSV file
|
| 110 |
-
print("Saving into a csv
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
# save the data into IPFS
|
|
|
|
| 115 |
push_csv_file_to_ipfs()
|
| 116 |
|
| 117 |
|
| 118 |
-
def push_csv_file_to_ipfs():
|
| 119 |
"""Push the tools accuracy CSV file to IPFS."""
|
| 120 |
client = ipfshttpclient.connect(IPFS_SERVER)
|
| 121 |
-
result = client.add(ROOT_DIR /
|
| 122 |
print(f"HASH of the tools accuracy file: {result['Hash']}")
|
| 123 |
return result["Hash"]
|
| 124 |
|
| 125 |
|
| 126 |
if __name__ == "__main__":
|
| 127 |
-
|
| 128 |
-
push_csv_file_to_ipfs()
|
|
|
|
| 11 |
GCP_IPFS_SERVER = "/dns/registry.gcp.autonolas.tech/tcp/443/https"
|
| 12 |
|
| 13 |
|
| 14 |
+
def update_tools_accuracy_same_model(
|
| 15 |
tools_acc: pd.DataFrame, tools_df: pd.DataFrame, inc_tools: List[str]
|
| 16 |
) -> pd.DataFrame:
|
| 17 |
"""To compute/update the latest accuracy information for the different mech tools"""
|
|
|
|
| 94 |
return tools_acc
|
| 95 |
|
| 96 |
|
| 97 |
+
def update_tools_accuracy(
|
| 98 |
+
tools_acc: pd.DataFrame,
|
| 99 |
+
old_tools_acc: pd.DataFrame,
|
| 100 |
+
tools_df: pd.DataFrame,
|
| 101 |
+
inc_tools: List[str],
|
| 102 |
+
) -> pd.DataFrame:
|
| 103 |
+
"""To compute/update the latest accuracy information for the different mech tools but splitting by date 23rd of May 2025"""
|
| 104 |
+
|
| 105 |
+
# to compute the accuracy information up to the 23rd of May 2025
|
| 106 |
+
tools_df["request_time"] = pd.to_datetime(tools_df["request_time"])
|
| 107 |
+
tools_df["request_date"] = tools_df["request_time"].dt.date
|
| 108 |
+
tools_df["request_date"] = pd.to_datetime(tools_df["request_date"])
|
| 109 |
+
tools_df["request_date"] = tools_df["request_date"].dt.strftime("%Y-%m-%d")
|
| 110 |
+
# split the data into two parts: before and after 23rd of May 2025
|
| 111 |
+
split_date = pd.to_datetime("2025-05-23").tz_localize("UTC")
|
| 112 |
+
before_split = tools_df[tools_df["request_time"] < split_date]
|
| 113 |
+
after_split = tools_df[tools_df["request_time"] >= split_date]
|
| 114 |
+
print(f"Number of requests before {split_date}: {len(before_split)}")
|
| 115 |
+
print(f"Number of requests after {split_date}: {len(after_split)}")
|
| 116 |
+
# compute the accuracy information for the two parts
|
| 117 |
+
acc_info_before = update_tools_accuracy_same_model(
|
| 118 |
+
old_tools_acc, before_split, inc_tools
|
| 119 |
+
)
|
| 120 |
+
acc_info_after = update_tools_accuracy_same_model(tools_acc, after_split, inc_tools)
|
| 121 |
+
# return the two different dataframes
|
| 122 |
+
return acc_info_before, acc_info_after
|
| 123 |
+
|
| 124 |
+
|
| 125 |
def compute_tools_accuracy():
|
| 126 |
print("Computing accuracy of tools")
|
| 127 |
print("Reading tools parquet file")
|
|
|
|
| 129 |
# Computing tools accuracy information
|
| 130 |
print("Computing tool accuracy information")
|
| 131 |
# Check if the file exists
|
| 132 |
+
acc_data = old_acc_data = None
|
| 133 |
if os.path.exists(ROOT_DIR / ACCURACY_FILENAME):
|
| 134 |
acc_data = pd.read_csv(ROOT_DIR / ACCURACY_FILENAME)
|
| 135 |
+
if os.path.exists(ROOT_DIR / "old_tools_accuracy.csv"):
|
| 136 |
+
old_acc_data = pd.read_csv(ROOT_DIR / "old_tools_accuracy.csv")
|
| 137 |
+
old_acc_data, new_acc_data = update_tools_accuracy(
|
| 138 |
+
acc_data, old_acc_data, tools, INC_TOOLS
|
| 139 |
+
)
|
| 140 |
|
| 141 |
# save acc_data into a CSV file
|
| 142 |
+
print("Saving into a csv files")
|
| 143 |
+
old_acc_data.to_csv(ROOT_DIR / "old_tools_accuracy.csv", index=False)
|
| 144 |
+
new_acc_data.to_csv(ROOT_DIR / ACCURACY_FILENAME, index=False)
|
|
|
|
| 145 |
# save the data into IPFS
|
| 146 |
+
# push_csv_file_to_ipfs("old_tools_accuracy.csv")
|
| 147 |
push_csv_file_to_ipfs()
|
| 148 |
|
| 149 |
|
| 150 |
+
def push_csv_file_to_ipfs(filename: str = ACCURACY_FILENAME) -> str:
|
| 151 |
"""Push the tools accuracy CSV file to IPFS."""
|
| 152 |
client = ipfshttpclient.connect(IPFS_SERVER)
|
| 153 |
+
result = client.add(ROOT_DIR / filename)
|
| 154 |
print(f"HASH of the tools accuracy file: {result['Hash']}")
|
| 155 |
return result["Hash"]
|
| 156 |
|
| 157 |
|
| 158 |
if __name__ == "__main__":
|
| 159 |
+
compute_tools_accuracy()
|
| 160 |
+
# push_csv_file_to_ipfs()
|
tools_accuracy.csv
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
tool,tool_accuracy,total_requests,min,max
|
| 2 |
-
claude-prediction-offline,
|
| 3 |
claude-prediction-online,74.41176470588236,300,2025-05-25 00:00:15,2025-05-28 18:47:35
|
| 4 |
-
prediction-offline,
|
| 5 |
-
prediction-offline-sme,
|
| 6 |
-
prediction-online,
|
| 7 |
-
prediction-online-sme,
|
| 8 |
-
prediction-request-rag,79.
|
| 9 |
prediction-request-rag-claude,76.03550295857988,300,2025-05-25 13:21:55,2025-05-28 13:30:50
|
| 10 |
-
prediction-request-reasoning,
|
| 11 |
-
prediction-request-reasoning-claude,78.
|
| 12 |
-
prediction-url-cot-claude,72.
|
| 13 |
-
superforcaster,
|
|
|
|
| 1 |
tool,tool_accuracy,total_requests,min,max
|
| 2 |
+
claude-prediction-offline,0.0,1,2025-05-28 03:56:15,2025-05-28 03:56:15
|
| 3 |
claude-prediction-online,74.41176470588236,300,2025-05-25 00:00:15,2025-05-28 18:47:35
|
| 4 |
+
prediction-offline,54.8093137890777,30836,2025-05-23 00:00:00,2025-05-29 00:30:20
|
| 5 |
+
prediction-offline-sme,57.14285714285714,70,2025-05-23 06:29:10,2025-05-28 01:49:45
|
| 6 |
+
prediction-online,57.29783037475345,1014,2025-05-23 00:10:05,2025-05-28 22:06:20
|
| 7 |
+
prediction-online-sme,50.60120240480962,998,2025-05-23 00:23:15,2025-05-28 23:17:15
|
| 8 |
+
prediction-request-rag,79.09967845659165,300,2025-05-25 14:16:25,2025-05-28 15:37:10
|
| 9 |
prediction-request-rag-claude,76.03550295857988,300,2025-05-25 13:21:55,2025-05-28 13:30:50
|
| 10 |
+
prediction-request-reasoning,55.003665689149564,5456,2025-05-23 00:01:15,2025-05-28 23:01:25
|
| 11 |
+
prediction-request-reasoning-claude,78.93175074183976,300,2025-05-25 13:48:00,2025-05-28 12:25:10
|
| 12 |
+
prediction-url-cot-claude,72.86135693215338,300,2025-05-25 00:12:40,2025-05-28 15:21:20
|
| 13 |
+
superforcaster,56.797583081571,331,2025-05-23 00:21:15,2025-05-28 18:42:15
|