diff --git a/gplearn/genetic.py b/gplearn/genetic.py index 54a90ee4..5d32e1f2 100644 --- a/gplearn/genetic.py +++ b/gplearn/genetic.py @@ -551,9 +551,9 @@ def fit(self, X, y, sample_weight=None): # Find the best individuals in the final generation fitness = np.array(fitness) if self._metric.greater_is_better: - hall_of_fame = fitness.argsort()[::-1][:self.hall_of_fame] + hall_of_fame = fitness.argsort(kind="stable")[::-1][:self.hall_of_fame] else: - hall_of_fame = fitness.argsort()[:self.hall_of_fame] + hall_of_fame = fitness.argsort(kind="stable")[:self.hall_of_fame] evaluation = np.array([gp.execute(X) for gp in [self._programs[-1][i] for i in hall_of_fame]])