File tree Expand file tree Collapse file tree
accelforge/mapper/FFM/_pareto_df Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -501,6 +501,24 @@ def makepareto_numpy(
501501 n [0 ] = True
502502 return n
503503
504+ # Really big Paretos are slow. If we add "diff" goals, the library partitions the
505+ # set and performs a smaller Pareto inside each. The following block will add more
506+ # "diff" goals until the chunks are reasonably small.
507+ if dirty :
508+ g2unique = {i : len (np .unique (to_pareto [i ])) for i in range (len (to_pareto ))}
509+
510+ n_per_chunk = to_pareto [0 ].shape [0 ]
511+ for i , goal in enumerate (new_goals ):
512+ if goal == "diff" :
513+ n_per_chunk /= g2unique [i ]
514+
515+ non_diffs = {i for i , goal in enumerate (new_goals ) if goal != "diff" }
516+ while non_diffs and n_per_chunk > 1000 :
517+ change_to_diff = min (non_diffs , key = lambda i : g2unique [i ])
518+ non_diffs .remove (change_to_diff )
519+ new_goals [change_to_diff ] = "diff"
520+ n_per_chunk /= g2unique [change_to_diff ]
521+
504522 df = pd .DataFrame (np .concatenate (to_pareto , axis = 1 ), columns = range (len (to_pareto )))
505523
506524 if dirty :
You can’t perform that action at this time.
0 commit comments