cyberosa commited on
Commit
9bb36bd
·
1 Parent(s): 290b25a

updating daily data

Browse files
active_traders.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:df0d8b93762da4232f083cc09257308d80ecd2e395232fa7459a5c79b38d4d5d
3
- size 17464854
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8ebf6f31796904a9dced9d32d78ce78e527e5e12c52681a099f0485d84dd98b
3
+ size 17691664
all_trades_profitability.parquet.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1798b08fbde1d8c3e28bbac1dcdba64593b79f1190255ad13173e9948a17a0dc
3
- size 16920912
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f347e49277ab3009e97bcc6d9cf96c49a3e622e0c58385f9df0c708594a0431e
3
+ size 17823081
closed_market_metrics.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5bfa8771b32f56f0895db61aa7a20a7e4358e52cb444fb48ad08b05c8c3d58db
3
- size 150650
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e77231f1ab081d6d56e7e370b29e4c2ce896fa81c7def1384eeafebe4e960e08
3
+ size 149870
closed_markets_div.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eff87b365ede2aff1e10d9b539a0c24bf2e85bcd6805f9170193fe84ceee9e5b
3
- size 90250
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a792c95c5dc7ee5fca1114a4ecd5e62e83b758bfda60c441d107ecc1d9db2ec
3
+ size 89735
daily_info.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dbedac290fe5e34fa08877e633cc38bef5cc2196f3a237570c1dcd86b6e48094
3
- size 3293216
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07b4e629fda57dd4704c3ffcd0c034842f3d8f1b9ae029b26376fe4dcabbde00
3
+ size 3678287
daily_mech_requests.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b9eb09940c8af4e133aa2707f4f5fafc879fa27f38d7fb4733746cbe6fea9029
3
- size 7954
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5da96c306d6255ec5f6062e515ecadcb0c55f3bf106ef98ddf7a04031b9d2f1
3
+ size 8037
daily_mech_requests_by_pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5be5fcb5a0c27ab524d5bd78d2e6eac80881e278eec2beb9e5869957650f2a90
3
- size 4532
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc3959d55d3cd0b0ff28875cac276a858c473c0f93e1417017bc4170b9a88d31
3
+ size 4551
error_by_markets.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0bd75f5a8cca0fdea01b6dca545021db2cdb2630ebcd03f726d1a201b6edb13b
3
- size 11440
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90829b29bd74d6b4333e4b0ef49e627f68e2a14a9d46e1d330223d8243aef403
3
+ size 11736
errors_by_mech.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7ed6b394e207a05cf9e734ce701d4f96bc1877c53464a8454e014dd873032378
3
- size 6112
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4604e6043191bad48b966531574aea05039e50aab27eb75bdaba5bd057916c1
3
+ size 6116
invalid_trades.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d6f01fc658deba31be9f69784858db6524533cf8243cef2e588bf1af261e8c0f
3
- size 351650
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2b5b469ee799e8c4555fe7fd07b3d0f74448401a6c8c048eacaf223070ae222
3
+ size 334820
latest_result_DAA_Pearl.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ebd38d4a127c4b814c4d287fcaa7a3137cb80835fc6ccbd0772a199a0b0d794e
3
- size 5510
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ecffc3e903e6068d330fb5109c6f7a5497f5a41d0b216a2f85f13ed94f8fca9e
3
+ size 5520
latest_result_DAA_QS.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bcb6f49aa45d019073cadcb4cbf9a769cf2eeb8b017dca0cd4aea535c43af82f
3
- size 6128
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ab2f0716f02958a98132e469347af21cf5675aac510f35063f09b5116880b6b
3
+ size 6141
old_tools_accuracy.csv DELETED
@@ -1,13 +0,0 @@
1
- tool,tool_accuracy,total_requests,min,max
2
- claude-prediction-offline,72.53057384760113,383346,2025-04-02 05:16:45,2025-06-06 00:13:05
3
- claude-prediction-online,62.65060240963856,166266,2025-04-02 00:01:00,2025-05-21 18:47:35
4
- prediction-offline,62.179688199982074,2767227,2025-04-02 00:00:05,2025-06-09 07:28:55
5
- prediction-offline-sme,61.504424778761056,20986,2025-04-02 00:57:25,2025-06-07 08:53:25
6
- prediction-online,55.565397106584,153914,2025-04-02 07:32:50,2025-06-08 22:40:55
7
- prediction-online-sme,54.13848631239936,89155,2025-04-02 07:33:25,2025-06-09 04:59:30
8
- prediction-request-rag,33.33333333333333,1547,2025-04-02 14:01:55,2025-06-03 18:59:40
9
- prediction-request-rag-claude,25.0,1776,2025-04-02 12:05:10,2025-06-03 17:51:10
10
- prediction-request-reasoning,51.56896642045157,1200639,2025-04-02 07:03:25,2025-06-08 23:46:20
11
- prediction-request-reasoning-claude,66.66666666666666,1341,2025-04-02 12:25:50,2025-05-28 09:25:40
12
- prediction-url-cot-claude,55.55555555555556,5230,2025-04-02 05:46:40,2025-05-20 15:21:20
13
- superforcaster,60.26234567901234,119300,2025-04-02 00:02:10,2025-06-08 21:00:40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f0bda4c67088785b64ea2b7abcc126e38c2dffb63ceebd60ee78a5171eb6f9b8
3
- size 47450
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aee09298538c45ac060ed1a1f7ed7f66b81706845cecccd16f4e3a010e2fa3a1
3
+ size 47490
retention_activity.parquet.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:262b34c3f469ac0681fee780e143a5f942947255fc839dced01180958f871ac6
3
- size 4309015
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c09129294d0d09f5e9e7b8e615a0dd6b32837f1cc5c14f37bf87d38dfb47d2c0
3
+ size 4354408
scripts/get_mech_info.py CHANGED
@@ -324,10 +324,6 @@ def get_mech_events_since_last_run(logger, mech_sandbox: bool = False):
324
  try:
325
  all_trades = read_all_trades_profitability()
326
  latest_timestamp = max(all_trades.creation_timestamp)
327
- # cutoff_date = "2025-01-13"
328
- # latest_timestamp = pd.Timestamp(
329
- # datetime.strptime(cutoff_date, "%Y-%m-%d")
330
- # ).tz_localize("UTC")
331
  print(f"Updating data since {latest_timestamp}")
332
  except Exception:
333
  print("Error while reading the profitability parquet file")
 
324
  try:
325
  all_trades = read_all_trades_profitability()
326
  latest_timestamp = max(all_trades.creation_timestamp)
 
 
 
 
327
  print(f"Updating data since {latest_timestamp}")
328
  except Exception:
329
  print("Error while reading the profitability parquet file")
scripts/mech_request_utils.py CHANGED
@@ -624,6 +624,7 @@ def get_ipfs_data(input_filename: str, output_filename: str, logger):
624
  updated_mech_requests.update(partial_dict)
625
 
626
  save_json_file(updated_mech_requests, output_filename)
 
627
  logger.info(f"NUMBER OF MECH REQUEST IPFS ERRORS={nr_errors}")
628
 
629
  # delivers
 
624
  updated_mech_requests.update(partial_dict)
625
 
626
  save_json_file(updated_mech_requests, output_filename)
627
+
628
  logger.info(f"NUMBER OF MECH REQUEST IPFS ERRORS={nr_errors}")
629
 
630
  # delivers
scripts/pull_data.py CHANGED
@@ -136,12 +136,12 @@ def only_new_weekly_analysis():
136
 
137
  save_historical_data()
138
  try:
139
- clean_old_data_from_parquet_files("2025-06-03")
140
  clean_old_data_from_json_files()
141
  except Exception as e:
142
  print("Error cleaning the oldest information from parquet files")
143
  print(f"reason = {e}")
144
- compute_tools_accuracy()
145
  compute_tools_based_datasets()
146
  # move to tmp folder the new generated files
147
  move_files()
 
136
 
137
  save_historical_data()
138
  try:
139
+ clean_old_data_from_parquet_files("2025-06-06")
140
  clean_old_data_from_json_files()
141
  except Exception as e:
142
  print("Error cleaning the oldest information from parquet files")
143
  print(f"reason = {e}")
144
+ # compute_tools_accuracy()
145
  compute_tools_based_datasets()
146
  # move to tmp folder the new generated files
147
  move_files()
scripts/update_tools_accuracy.py CHANGED
@@ -17,12 +17,19 @@ import time
17
  ACCURACY_FILENAME = "tools_accuracy.csv"
18
  IPFS_SERVER = "/dns/registry.autonolas.tech/tcp/443/https"
19
  GCP_IPFS_SERVER = "/dns/registry.gcp.autonolas.tech/tcp/443/https"
20
- SAMPLING_POPULATION_SIZE = 300
21
  RECENTS_SAMPLES_SIZE = 5000
22
  NR_SUBSETS = 100
23
  SAMPLES_THRESHOLD = 50
24
  DEFAULT_ACCURACY = 51.0
25
  LAST_MODEL_UPDATE = "2025-06-03"
 
 
 
 
 
 
 
26
 
27
 
28
  def mean_and_std(numbers):
@@ -270,6 +277,70 @@ def update_global_accuracy(
270
  return global_accuracies
271
 
272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  def add_historical_data(
274
  tools_historical_file: str,
275
  tools_df: pd.DataFrame,
@@ -317,6 +388,7 @@ def add_historical_data(
317
  recent_samples = get_recent_samples(historical_tool_data, needed_samples)
318
  # Combine the current tools with the historical ones
319
  tools_df = pd.concat([tools_df, recent_samples], ignore_index=True)
 
320
  valid_tools[tool] = count + needed_samples
321
  completed_tools.append(tool)
322
  # Remove the tool from more_sample_tools
@@ -326,34 +398,9 @@ def add_historical_data(
326
  return tools_df
327
 
328
 
329
- def compute_global_accuracy_same_population(
330
- tools_df: pd.DataFrame,
331
- sample_size: int = SAMPLING_POPULATION_SIZE,
332
- n_subsets: int = NR_SUBSETS,
333
- ) -> Tuple[Dict, Dict]:
334
- """
335
- For the tools in the dataset, it creates different subsets of the same size (using downsampling or upsampling) and
336
- computes the accuracy for each subset. Finally it averages the accuracies across all subsets.
337
-
338
- Args:
339
- tools_df: DataFrame containing the tools data
340
- sample_size: Target number of samples per tool
341
- n_subsets: Number of balanced datasets to create
342
-
343
- Returns:
344
- List of global accuracies for the tools
345
- """
346
- valid_tools, more_sample_tools = classify_tools(
347
- tools_df, recent_samples_size=RECENTS_SAMPLES_SIZE
348
- )
349
- global_accuracies = {}
350
- if len(valid_tools) > 0:
351
- # Compute the accuracy for tools in valid_tools
352
- update_global_accuracy(
353
- valid_tools, tools_df, global_accuracies, sample_size, n_subsets
354
- )
355
-
356
- # Check historical files for tools that need more samples
357
  client = initialize_client()
358
  # first attempt: historical file download
359
  tool_names = list(more_sample_tools.keys())
@@ -361,7 +408,7 @@ def compute_global_accuracy_same_population(
361
  completed_tools = []
362
  if len(tool_names) > 0:
363
  print("First attempt to complete the population size")
364
- # first attempt: historical file from two months ago
365
  tools_historical_file = download_tools_historical_files(
366
  client, skip_files_count=FILES_IN_TWO_MONTHS
367
  )
@@ -375,7 +422,7 @@ def compute_global_accuracy_same_population(
375
  completed_tools,
376
  )
377
  print(more_sample_tools)
378
- # second attempt: historical file from 4 months ago
379
  if len(more_sample_tools) > 0:
380
  print("Second attempt to complete the population size")
381
  # second historical file download
@@ -403,25 +450,101 @@ def compute_global_accuracy_same_population(
403
  n_subsets,
404
  one_tool=tool,
405
  )
406
- # if not enough samples found in the historical data, upsample the tools that need more samples
407
- # Process tools that need upsampling
408
- new_tools = []
409
- for tool in more_sample_tools.keys():
410
- # tool but not reaching yet the population size so treated as a new tool
411
- new_tools.append(tool)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  return global_accuracies, new_tools
413
 
414
 
415
- def get_accuracy_info(clean_tools_df: pd.DataFrame) -> [pd.DataFrame, bool, Dict]:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  """
417
  Extracts accuracy information from the tools DataFrame.
418
  """
419
 
420
  # compute global accuracy information for the tools
421
- global_accuracies, new_tools = compute_global_accuracy_same_population(
422
- tools_df=clean_tools_df, n_subsets=NR_SUBSETS
 
 
 
423
  )
424
-
425
  # transform the dictionary global_accuracies into a DataFrame
426
  wins = pd.DataFrame(
427
  [
@@ -472,18 +595,17 @@ def update_tools_accuracy_same_model(
472
  acc_info["max"] = acc_info["max"].dt.strftime("%Y-%m-%d %H:%M:%S")
473
  all_accuracies = []
474
  final_acc_df = pd.DataFrame(columns=tools_acc.columns)
 
 
475
  for tool in tools_to_update:
476
- if tool in new_tools:
477
- continue
478
- if tool not in existing_tools:
479
  new_tools.append(tool)
480
  continue
481
  new_accuracy = round(
482
  acc_info[acc_info["tool"] == tool]["tool_accuracy"].values[0], 2
483
  )
484
  all_accuracies.append(new_accuracy)
485
- # accuracy has been computed over the same population size
486
- new_volume = SAMPLING_POPULATION_SIZE
487
  if no_timeline_info:
488
  new_min_timeline = None
489
  new_max_timeline = None
@@ -548,49 +670,29 @@ def update_tools_accuracy_same_model(
548
  return final_acc_df
549
 
550
 
551
- def update_tools_accuracy(
552
- tools_acc: pd.DataFrame,
553
- tools_df: pd.DataFrame,
554
- inc_tools: List[str],
555
- ) -> pd.DataFrame:
556
- """To compute/update the latest accuracy information for the different mech tools
557
- but splitting by date 3rd of June when the gpt 4.1 update happened 2025"""
558
-
559
- tools_df["request_time"] = pd.to_datetime(tools_df["request_time"])
560
- tools_df["request_date"] = tools_df["request_time"].dt.date
561
- tools_df["request_date"] = pd.to_datetime(tools_df["request_date"])
562
- tools_df["request_date"] = tools_df["request_date"].dt.strftime("%Y-%m-%d")
563
-
564
- # split the data into two parts: before and after the 3rd of June
565
- split_date = pd.to_datetime(LAST_MODEL_UPDATE).tz_localize("UTC")
566
- before_split = tools_df[tools_df["request_time"] < split_date]
567
- after_split = tools_df[tools_df["request_time"] >= split_date]
568
- print(f"Number of requests before {split_date}: {len(before_split)}")
569
- print(f"Number of requests after {split_date}: {len(after_split)}")
570
-
571
- acc_info_after = update_tools_accuracy_same_model(tools_acc, after_split, inc_tools)
572
- # return the two different dataframes
573
- return acc_info_after
574
-
575
-
576
  def compute_tools_accuracy():
 
 
 
577
  print("Computing accuracy of tools")
578
  print("Reading tools parquet file")
579
- tools = pd.read_parquet(TMP_DIR / "tools.parquet")
580
- # Computing tools accuracy information
581
- print("Computing tool accuracy information")
582
  # Check if the file exists
583
- acc_data = old_acc_data = None
584
  if os.path.exists(ROOT_DIR / ACCURACY_FILENAME):
585
  acc_data = pd.read_csv(ROOT_DIR / ACCURACY_FILENAME)
586
 
587
- new_acc_data = update_tools_accuracy(acc_data, tools, INC_TOOLS)
 
 
 
 
588
 
589
- # save acc_data into a CSV file
590
- print("Saving into a csv files")
591
  new_acc_data.to_csv(ROOT_DIR / ACCURACY_FILENAME, index=False)
592
  # save the data into IPFS
593
- push_csv_file_to_ipfs()
594
 
595
 
596
  def push_csv_file_to_ipfs(filename: str = ACCURACY_FILENAME) -> str:
 
17
  ACCURACY_FILENAME = "tools_accuracy.csv"
18
  IPFS_SERVER = "/dns/registry.autonolas.tech/tcp/443/https"
19
  GCP_IPFS_SERVER = "/dns/registry.gcp.autonolas.tech/tcp/443/https"
20
+ SAMPLING_POPULATION_SIZE = 500
21
  RECENTS_SAMPLES_SIZE = 5000
22
  NR_SUBSETS = 100
23
  SAMPLES_THRESHOLD = 50
24
  DEFAULT_ACCURACY = 51.0
25
  LAST_MODEL_UPDATE = "2025-06-03"
26
+ CLAUDE_TOOLS = [
27
+ "claude-prediction-online",
28
+ "claude-prediction-offline",
29
+ "prediction-request-rag-claude",
30
+ "prediction-request-reasoning-claude",
31
+ "prediction-url-cot-claude",
32
+ ]
33
 
34
 
35
  def mean_and_std(numbers):
 
277
  return global_accuracies
278
 
279
 
280
+ def check_upgrade_dates(
281
+ tools_df,
282
+ tools_list,
283
+ new_tools,
284
+ claude_upgrade_date="30-07-2025",
285
+ gpt_upgrade_date="03-06-2025",
286
+ ) -> None:
287
+ # Convert upgrade dates to datetime
288
+ claude_upgrade_date = pd.to_datetime(claude_upgrade_date, format="%d-%m-%Y").date()
289
+ gpt_upgrade_date = pd.to_datetime(gpt_upgrade_date, format="%d-%m-%Y").date()
290
+ for tool in tools_list.keys():
291
+ print(f"checking tool {tool}")
292
+ # take the RECENT_SAMPLES from tools_df
293
+ tool_data = tools_df[tools_df["tool"] == tool]
294
+ # sort tool_data by request date in ascending order
295
+ tool_data = tool_data.sort_values(by="request_date", ascending=True)
296
+ if len(tool_data) < RECENTS_SAMPLES_SIZE:
297
+ new_tools.append(tool)
298
+ continue
299
+ recent_samples = get_recent_samples(
300
+ tool_data, recent_samples_size=RECENTS_SAMPLES_SIZE
301
+ )
302
+ recent_samples = recent_samples.sort_values(by="request_date", ascending=True)
303
+ print(recent_samples.head())
304
+ oldest_sample_date = recent_samples.iloc[0].request_date
305
+ if isinstance(oldest_sample_date, str):
306
+ oldest_sample_date = pd.to_datetime(oldest_sample_date).date()
307
+ print(f"tool {tool}: oldest sample date {oldest_sample_date}")
308
+ if tool in CLAUDE_TOOLS:
309
+ # if oldest_sample_date is before claude_upgrade_date then remove the tool
310
+ # from valid_tools and add it to the list of other_tools
311
+ if oldest_sample_date < claude_upgrade_date:
312
+ print(f"the oldest sample found is older than {claude_upgrade_date}")
313
+ new_tools.append(tool)
314
+ elif oldest_sample_date < gpt_upgrade_date:
315
+ print(f"the oldest sample found is older than {gpt_upgrade_date}")
316
+ new_tools.append(tool)
317
+ return
318
+
319
+
320
+ def check_upgraded_tools(
321
+ tools_df,
322
+ valid_tools,
323
+ other_tools,
324
+ ):
325
+ """
326
+ Function to update the input lists and remove from valid tools any tools whose oldest date is before the upgrade dates
327
+ """
328
+ new_tools = []
329
+ # Check and remove tools from valid_tools
330
+ check_upgrade_dates(tools_df, valid_tools, new_tools)
331
+ for tool in new_tools:
332
+ if tool in valid_tools.keys():
333
+ print(f"removing tool {tool} from valid tools")
334
+ del valid_tools[tool]
335
+ # Check and remove tools from other_tools
336
+ check_upgrade_dates(tools_df, other_tools, new_tools)
337
+ for tool in new_tools:
338
+ if tool in other_tools.keys():
339
+ print(f"removing tool {tool} from other tools")
340
+ del other_tools[tool]
341
+ return new_tools
342
+
343
+
344
  def add_historical_data(
345
  tools_historical_file: str,
346
  tools_df: pd.DataFrame,
 
388
  recent_samples = get_recent_samples(historical_tool_data, needed_samples)
389
  # Combine the current tools with the historical ones
390
  tools_df = pd.concat([tools_df, recent_samples], ignore_index=True)
391
+ tools_df = tools_df.sort_values(by="request_date", ascending=True)
392
  valid_tools[tool] = count + needed_samples
393
  completed_tools.append(tool)
394
  # Remove the tool from more_sample_tools
 
398
  return tools_df
399
 
400
 
401
+ def check_historical_samples(
402
+ global_accuracies, more_sample_tools, valid_tools, sample_size, n_subsets
403
+ ):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  client = initialize_client()
405
  # first attempt: historical file download
406
  tool_names = list(more_sample_tools.keys())
 
408
  completed_tools = []
409
  if len(tool_names) > 0:
410
  print("First attempt to complete the population size")
411
+ # first attempt: historical file from 4 months ago
412
  tools_historical_file = download_tools_historical_files(
413
  client, skip_files_count=FILES_IN_TWO_MONTHS
414
  )
 
422
  completed_tools,
423
  )
424
  print(more_sample_tools)
425
+ # second attempt: historical file from 6 months ago
426
  if len(more_sample_tools) > 0:
427
  print("Second attempt to complete the population size")
428
  # second historical file download
 
450
  n_subsets,
451
  one_tool=tool,
452
  )
453
+ return
454
+
455
+
456
+ def compute_global_accuracy_same_population(
457
+ tools_df: pd.DataFrame,
458
+ recent_samples_size: int = RECENTS_SAMPLES_SIZE,
459
+ sample_size: int = SAMPLING_POPULATION_SIZE,
460
+ n_subsets: int = NR_SUBSETS,
461
+ ) -> Tuple[Dict, Dict]:
462
+ """
463
+ For the tools in the dataset, it creates different subsets of the same size (using downsampling or upsampling) and
464
+ computes the accuracy for each subset. Finally it averages the accuracies across all subsets.
465
+
466
+ Args:
467
+ tools_df: DataFrame containing the tools data
468
+ sample_size: Target number of samples per tool
469
+ n_subsets: Number of balanced datasets to create
470
+
471
+ Returns:
472
+ List of global accuracies for the tools
473
+ """
474
+
475
+ valid_tools, more_sample_tools = classify_tools(tools_df, recent_samples_size)
476
+ # check tools that were upgraded recently
477
+ # otherwise they will be moved as new_tools
478
+ new_tools = check_upgraded_tools(tools_df, valid_tools, more_sample_tools)
479
+ print(f"new tools {new_tools} after checking the upgraded tools")
480
+ global_accuracies = {}
481
+ if len(valid_tools) > 0:
482
+ # Compute the accuracy for tools in valid_tools
483
+ update_global_accuracy(
484
+ valid_tools, tools_df, global_accuracies, sample_size, n_subsets
485
+ )
486
+
487
+ # Check historical files for tools that need more samples
488
+ if len(more_sample_tools) > 0:
489
+ new_tools.extend(more_sample_tools.keys())
490
+ # check_historical_samples(
491
+ # global_accuracies, more_sample_tools, valid_tools, sample_size, n_subsets
492
+ # )
493
+ # for tool in more_sample_tools.keys():
494
+ # # tool but not reaching yet the population size so treated as a new tool
495
+ # new_tools.append(tool)
496
  return global_accuracies, new_tools
497
 
498
 
499
+ def compute_global_weekly_accuracy(clean_tools_df):
500
+ """
501
+ Compute accuracy following version 5.0 of spec"""
502
+ # get the information in clean_tools_df from last two weeks only, timestamp column is request_time
503
+
504
+ three_weeks_ago = pd.Timestamp.now(tz="UTC") - pd.Timedelta(days=21)
505
+ recent_df = clean_tools_df[clean_tools_df["request_time"] >= three_weeks_ago]
506
+
507
+ # compute at the tool level (using "tool" column) the volume of requests per tool
508
+ tool_volumes = (
509
+ recent_df.groupby("tool")["request_id"].count().reset_index(name="volume")
510
+ )
511
+ min_volume = tool_volumes["volume"].min()
512
+ max_volume = tool_volumes["volume"].max()
513
+
514
+ # compute the average volume of tool requests in the last two weeks, excluding min and max
515
+ filtered_volumes = tool_volumes[
516
+ (tool_volumes["volume"] != min_volume) & (tool_volumes["volume"] != max_volume)
517
+ ]
518
+ avg_volume = filtered_volumes["volume"].mean()
519
+
520
+ print("Tool volumes in last three weeks:")
521
+ print(tool_volumes)
522
+ print(
523
+ f"Average volume of tool requests in last three weeks excluding min and max: {avg_volume}"
524
+ )
525
+ sampling_size = int(avg_volume / 2)
526
+ print(f"Sampling size = {sampling_size}")
527
+
528
+ return compute_global_accuracy_same_population(
529
+ tools_df=recent_df,
530
+ recent_samples_size=avg_volume,
531
+ sample_size=sampling_size,
532
+ n_subsets=50,
533
+ )
534
+
535
+
536
+ def get_accuracy_info(clean_tools_df: pd.DataFrame) -> [pd.DataFrame, bool, List]:
537
  """
538
  Extracts accuracy information from the tools DataFrame.
539
  """
540
 
541
  # compute global accuracy information for the tools
542
+ # global_accuracies, new_tools = compute_global_accuracy_same_population(
543
+ # tools_df=clean_tools_df,
544
+ # )
545
+ global_accuracies, new_tools = compute_global_weekly_accuracy(
546
+ clean_tools_df=clean_tools_df
547
  )
 
548
  # transform the dictionary global_accuracies into a DataFrame
549
  wins = pd.DataFrame(
550
  [
 
595
  acc_info["max"] = acc_info["max"].dt.strftime("%Y-%m-%d %H:%M:%S")
596
  all_accuracies = []
597
  final_acc_df = pd.DataFrame(columns=tools_acc.columns)
598
+ # accuracy has been computed over the same population size
599
+ new_volume = SAMPLING_POPULATION_SIZE
600
  for tool in tools_to_update:
601
+ if tool in new_tools or tool not in existing_tools:
 
 
602
  new_tools.append(tool)
603
  continue
604
  new_accuracy = round(
605
  acc_info[acc_info["tool"] == tool]["tool_accuracy"].values[0], 2
606
  )
607
  all_accuracies.append(new_accuracy)
608
+
 
609
  if no_timeline_info:
610
  new_min_timeline = None
611
  new_max_timeline = None
 
670
  return final_acc_df
671
 
672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  def compute_tools_accuracy():
674
+ """To compute/update the latest accuracy information. Relevant dates
675
+ -- 3rd of June 2025 when the gpt 4.1 update happened
676
+ -- 30th of July 2025 when the Claude 4 update happened"""
677
  print("Computing accuracy of tools")
678
  print("Reading tools parquet file")
679
+ tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
680
+
 
681
  # Check if the file exists
682
+ acc_data = None
683
  if os.path.exists(ROOT_DIR / ACCURACY_FILENAME):
684
  acc_data = pd.read_csv(ROOT_DIR / ACCURACY_FILENAME)
685
 
686
+ tools_df["request_time"] = pd.to_datetime(tools_df["request_time"])
687
+ tools_df["request_date"] = tools_df["request_time"].dt.date
688
+ tools_df["request_date"] = pd.to_datetime(tools_df["request_date"])
689
+ tools_df["request_date"] = tools_df["request_date"].dt.strftime("%Y-%m-%d")
690
+ new_acc_data = update_tools_accuracy_same_model(acc_data, tools_df, INC_TOOLS)
691
 
692
+ print("Saving into a csv file")
 
693
  new_acc_data.to_csv(ROOT_DIR / ACCURACY_FILENAME, index=False)
694
  # save the data into IPFS
695
+ # push_csv_file_to_ipfs()
696
 
697
 
698
  def push_csv_file_to_ipfs(filename: str = ACCURACY_FILENAME) -> str:
service_map.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:94929724f1c385ca523a734467b114a1fe896a4e436c9a448892ea39bce9c955
3
- size 172094
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:789d1027897cd87ab4ffd46c3cc995e7a96771ed77575264a6b663e3046893f1
3
+ size 172245
tools_accuracy.csv CHANGED
@@ -1,13 +1,13 @@
1
  tool,tool_accuracy,total_requests,min,max
2
- prediction-offline,61.52,300,2025-06-03 00:00:05,2025-07-30 23:44:15
3
- prediction-request-reasoning,55.59,300,2025-06-03 00:00:30,2025-07-30 23:43:05
4
- prediction-online,60.18,300,2025-06-03 00:00:05,2025-07-30 23:23:30
5
- prediction-online-sme,54.13,300,2025-06-03 00:04:30,2025-07-30 23:43:35
6
- superforcaster,63.67,300,2025-06-03 01:15:10,2025-07-30 23:41:00
7
- claude-prediction-offline,59.72,300,2025-06-06 00:13:05,2025-07-30 23:24:35
8
- prediction-request-rag,49.97,300,2025-06-03 18:59:40,2025-07-30 23:41:15
9
- claude-prediction-online,51.46,300,2025-06-11 07:23:05,2025-07-30 23:41:30
10
- prediction-offline-sme,54.5,300,2025-06-03 11:55:10,2025-07-29 11:56:35
11
- prediction-request-rag-claude,56.75,300,2025-06-03 17:51:10,2025-07-30 22:26:00
12
- prediction-request-reasoning-claude,56.75,300,2025-06-16 11:02:15,2025-07-30 20:25:20
13
- prediction-url-cot-claude,56.75,300,2025-06-12 20:36:25,2025-07-27 08:15:15
 
1
  tool,tool_accuracy,total_requests,min,max
2
+ prediction-offline,61.97,500,2025-06-03 00:00:05,2025-08-03 23:44:55
3
+ prediction-online-sme,52.33,500,2025-06-03 00:04:30,2025-08-03 22:49:45
4
+ prediction-online,59.38,500,2025-06-03 00:00:05,2025-08-03 22:31:35
5
+ prediction-request-reasoning,58.02,500,2025-06-03 00:00:30,2025-08-03 23:44:40
6
+ claude-prediction-offline,57.92,500,2025-06-06 00:13:05,2025-08-03 21:46:10
7
+ claude-prediction-online,57.92,500,2025-06-11 07:23:05,2025-08-03 23:02:15
8
+ superforcaster,57.92,500,2025-06-03 01:15:10,2025-08-03 22:50:05
9
+ prediction-request-reasoning-claude,57.92,500,2025-06-16 11:02:15,2025-08-03 22:59:10
10
+ prediction-request-rag-claude,57.92,500,2025-06-03 17:51:10,2025-08-03 22:52:10
11
+ prediction-offline-sme,57.92,500,2025-06-03 11:55:10,2025-08-02 07:55:50
12
+ prediction-url-cot-claude,57.92,500,2025-06-12 20:36:25,2025-07-27 08:15:15
13
+ prediction-request-rag,57.92,500,2025-06-03 18:59:40,2025-08-03 21:23:40
tools_accuracy_version3_0.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tool,tool_accuracy,total_requests,min,max
2
+ prediction-offline,61.52,300,2025-06-03 00:00:05,2025-07-30 23:44:15
3
+ prediction-request-reasoning,55.59,300,2025-06-03 00:00:30,2025-07-30 23:43:05
4
+ prediction-online,60.18,300,2025-06-03 00:00:05,2025-07-30 23:23:30
5
+ prediction-online-sme,54.13,300,2025-06-03 00:04:30,2025-07-30 23:43:35
6
+ superforcaster,63.67,300,2025-06-03 01:15:10,2025-07-30 23:41:00
7
+ claude-prediction-offline,59.72,300,2025-06-06 00:13:05,2025-07-30 23:24:35
8
+ prediction-request-rag,49.97,300,2025-06-03 18:59:40,2025-07-30 23:41:15
9
+ claude-prediction-online,51.46,300,2025-06-11 07:23:05,2025-07-30 23:41:30
10
+ prediction-offline-sme,54.5,300,2025-06-03 11:55:10,2025-07-29 11:56:35
11
+ prediction-request-rag-claude,56.75,300,2025-06-03 17:51:10,2025-07-30 22:26:00
12
+ prediction-request-reasoning-claude,56.75,300,2025-06-16 11:02:15,2025-07-30 20:25:20
13
+ prediction-url-cot-claude,56.75,300,2025-06-12 20:36:25,2025-07-27 08:15:15
traders_weekly_metrics.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:75c7863e87fdb8405dc84e2d33a28609594d0026a3d65fe10d1dbfd199287dab
3
- size 174157
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e433c7ac52c2770887833b8dadb9f013e2b49d15430cddbc32e11cd1706466f
3
+ size 190345
two_weeks_avg_roi_pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ee8de1a71335eda23fe659f440d53d73c76f913a295f7f65a94892eb427da157
3
  size 3045
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc1ff47e9188cb0de7f9faacdb14c00fb9834c85f4c0b8adb9dfaaa58725f851
3
  size 3045
unknown_traders.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:14739f02e9d9bb89de44878f9b706fed915f8211914fea0dc750f1917e0456a2
3
- size 1491321
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:071fa24aa479b61a4941a9f8a209e8b7a970d8b2e5babf9600699a9db07d6b98
3
+ size 1482486
weekly_avg_roi_pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d73b166ffca8b5be80c2637b8a048cd7e1cde26bf861999f9de783cf3a17d11f
3
- size 2396
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dae3501daee304809183d2b6a8814b447e6efebfe2e6f803998c9d1752d6c65c
3
+ size 2413
weekly_mech_calls.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:17da3cb919056f36f50f0baef219f62d6570a33681feeaed367dd2d435072bfe
3
- size 50951
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26de376fe9c84db0a9fd152e098f6c5d87d00cc11b2e13788c208ad3e336dce1
3
+ size 52263
winning_df.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:22d79eb19909501cb955b8b92973309134546f2368450c2e9b1125ebec670040
3
- size 11501
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e70921e5f249d72bf8267eb8313e9d736b188a2830f8d8fc7fc988ec8df76e80
3
+ size 12272