saattrupdan commited on
Commit
e5b38af
1 Parent(s): a4a8904

feat: Fix the stacking order of the models

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -391,6 +391,25 @@ def produce_radial_plot(
391
  result_list.append(np.mean(scores))
392
  results.append(result_list)
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  # Add the results to a plotly figure
395
  fig = go.Figure()
396
  for model_id, result_list in zip(model_ids, results):
 
391
  result_list.append(np.mean(scores))
392
  results.append(result_list)
393
 
394
+ # Get a matrix of shape [num_models, num_tasks], where entry (i, j) indicates how
395
+ # many models that model i has beaten on task j
396
+ result_matrix = np.array(results)
397
+ num_models = result_matrix.shape[0]
398
+ num_tasks = result_matrix.shape[1]
399
+ num_models_beaten = np.zeros((num_models, num_tasks))
400
+ for i in range(num_models):
401
+ for j in range(num_tasks):
402
+ num_models_beaten[i, j] = np.sum(
403
+ result_matrix[i, j] > result_matrix[:, j]
404
+ )
405
+
406
+ # Sort the models (and their results) such that the model who beats most other
407
+ # models first. This will result in the "smaller areas" being on top of the "larger
408
+ # areas", which is more aesthetically pleasing.
409
+ sorted_idxs = num_models_beaten.sum(axis=1).argsort()[::-1]
410
+ model_ids = np.asarray(model_ids)[sorted_idxs].tolist()
411
+ results = result_matrix[sorted_idxs].tolist()
412
+
413
  # Add the results to a plotly figure
414
  fig = go.Figure()
415
  for model_id, result_list in zip(model_ids, results):