idolezal commited on
Commit
bc1411a
·
1 Parent(s): d6b7a5a

Added cache self.leaderboard_scatter_plots

Browse files
Files changed (1) hide show
  1. server.py +16 -0
server.py CHANGED
@@ -295,6 +295,7 @@ class LeaderboardServer:
295
  self.tournament_dataframes = {} # For each submission_id and category
296
  self.leaderboard_dataframes_csv = {} # For each category
297
  self.tournament_dataframes_csv = {} # For each submission_id and category
 
298
  self.leaderboard_heatmaps = {} # For each category
299
 
300
  self.results_dataset_local_snapshot_lock = ReadWriteLock()
@@ -374,12 +375,18 @@ class LeaderboardServer:
374
  self.leaderboard_dataframes_csv = leaderboard_dataframes_csv
375
  self.tournament_dataframes_csv = tournament_dataframes_csv
376
 
 
 
 
 
 
377
  leaderboard_heatmaps = {kind_of_p_value: {
378
  category: self._get_leaderboard_heatmap(category=category, kind_of_p_value=kind_of_p_value)
379
  for category in categories
380
  } for kind_of_p_value in self.KINDS_OF_P_VALUE}
381
 
382
  with self.var_lock.rw:
 
383
  self.leaderboard_heatmaps = leaderboard_heatmaps
384
 
385
  def load_tournament_results(self):
@@ -725,6 +732,15 @@ class LeaderboardServer:
725
  return filepath
726
 
727
  def get_leaderboard_scatter_plot(self, pre_submit=None, category=None, kind_of_p_value=None):
 
 
 
 
 
 
 
 
 
728
  import numpy as np
729
  from analyze_winscore import get_ldb_records, create_scatter_plot_with_curve_with_variances_named
730
 
 
295
  self.tournament_dataframes = {} # For each submission_id and category
296
  self.leaderboard_dataframes_csv = {} # For each category
297
  self.tournament_dataframes_csv = {} # For each submission_id and category
298
+ self.leaderboard_scatter_plots = {} # For each category
299
  self.leaderboard_heatmaps = {} # For each category
300
 
301
  self.results_dataset_local_snapshot_lock = ReadWriteLock()
 
375
  self.leaderboard_dataframes_csv = leaderboard_dataframes_csv
376
  self.tournament_dataframes_csv = tournament_dataframes_csv
377
 
378
+ leaderboard_scatter_plots = {kind_of_p_value: {
379
+ category: self._get_leaderboard_scatter_plot(category=category, kind_of_p_value=kind_of_p_value)
380
+ for category in categories
381
+ } for kind_of_p_value in self.KINDS_OF_P_VALUE}
382
+
383
  leaderboard_heatmaps = {kind_of_p_value: {
384
  category: self._get_leaderboard_heatmap(category=category, kind_of_p_value=kind_of_p_value)
385
  for category in categories
386
  } for kind_of_p_value in self.KINDS_OF_P_VALUE}
387
 
388
  with self.var_lock.rw:
389
+ self.leaderboard_scatter_plots = leaderboard_scatter_plots
390
  self.leaderboard_heatmaps = leaderboard_heatmaps
391
 
392
  def load_tournament_results(self):
 
732
  return filepath
733
 
734
  def get_leaderboard_scatter_plot(self, pre_submit=None, category=None, kind_of_p_value=None):
735
+ if pre_submit == None:
736
+ category = category if category else self.TASKS_CATEGORY_OVERALL
737
+ kind_of_p_value = kind_of_p_value if kind_of_p_value else self.DEFAULT_KIND_OF_P_VALUE
738
+ with self.var_lock.ro:
739
+ return self.leaderboard_scatter_plots[kind_of_p_value][category]
740
+ else:
741
+ return self._get_leaderboard_scatter_plot(pre_submit=pre_submit, category=category, kind_of_p_value=kind_of_p_value)
742
+
743
+ def _get_leaderboard_scatter_plot(self, pre_submit=None, category=None, kind_of_p_value=None):
744
  import numpy as np
745
  from analyze_winscore import get_ldb_records, create_scatter_plot_with_curve_with_variances_named
746