@@ -504,6 +504,53 @@ def add_top_3_classes(df, actual_df):
504
504
505
505
return actual_df
506
506
507
+ def add_top_3_classes_per_type (
508
+ df , actual_df , category_col = "category" , include_3dgs = True
509
+ ):
510
+ colors = ["first" , "second" , "third" ]
511
+ for col in df .columns :
512
+ try :
513
+ float_col = df [col ].astype (float )
514
+ except ValueError :
515
+ continue # Skip non-numeric columns
516
+
517
+ # Loop through each category type ('c', 'd')
518
+ for category_type in df [category_col ].unique ():
519
+ if category_type not in ["c" , "d" ]:
520
+ continue # Skip unrelated categories
521
+
522
+ # Filter rows by category
523
+ filtered_indices = df [df [category_col ] == category_type ].index
524
+ filtered_col = float_col [filtered_indices ]
525
+
526
+ # Explicitly include the 3DGS-30K row in the filtered column
527
+ if include_3dgs :
528
+ filtered_indices = filtered_indices .union (
529
+ df [df ["Method" ].str .contains ("3DGS-30K" , na = False )].index
530
+ )
531
+ filtered_col = float_col [filtered_indices ]
532
+
533
+ if (
534
+ any (
535
+ keyword in col [1 ].lower ()
536
+ for keyword in ["size" , "lpips" , "gauss" , "b/g" ]
537
+ )
538
+ or "rank" in col [0 ].lower ()
539
+ ):
540
+ top_3 = pd .Series (filtered_col .unique ()).nsmallest (3 )
541
+ else :
542
+ top_3 = pd .Series (filtered_col .unique ()).nlargest (3 )
543
+
544
+ # Assign "first", "second", "third" classes to the filtered rows
545
+ for i , val in enumerate (top_3 ):
546
+ matching_indices = filtered_col [filtered_col == val ].index
547
+ for index in matching_indices :
548
+ actual_df .at [index , col ] = (
549
+ f'<td class="{ colors [i ]} ">{ actual_df .at [index , col ]} </td>'
550
+ )
551
+
552
+ return actual_df
553
+
507
554
multi_col_df_copy = multi_col_df .copy ()
508
555
509
556
def numGaussians_to_k_Gauss (df ):
@@ -527,7 +574,7 @@ def apply_dataset_names(df):
527
574
)
528
575
529
576
numGaussians_to_k_Gauss (multi_col_df )
530
- multi_col_df = add_top_3_classes (
577
+ multi_col_df = add_top_3_classes_per_type (
531
578
multi_col_df_copy , multi_col_df .astype (str )
532
579
).replace (["nan" , "NaN" , "None" ], "" )
533
580
0 commit comments