From c5480cc6733e75c5af78523ebe3488a854b317fe Mon Sep 17 00:00:00 2001 From: Christian Jorgensen Date: Tue, 7 May 2024 10:35:48 -0500 Subject: [PATCH] Combined if statements for list and array --- src/skmatter/_selection.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/skmatter/_selection.py b/src/skmatter/_selection.py index a6ca46b4c..e5cb76601 100644 --- a/src/skmatter/_selection.py +++ b/src/skmatter/_selection.py @@ -1038,7 +1038,7 @@ def _init_greedy_search(self, X, y, n_to_select): self.hausdorff_ = np.full(X.shape[self._axis], np.inf) self.hausdorff_at_select_ = np.full(X.shape[self._axis], np.inf) - if isinstance(self.initialize, np.ndarray): + if isinstance(self.initialize, (np.ndarray, list)): if all(isinstance(i, numbers.Integral) for i in self.initialize): for i, val in enumerate(self.initialize): self.selected_idx_[i] = val @@ -1054,13 +1054,6 @@ def _init_greedy_search(self, X, y, n_to_select): initialize = self.initialize self.selected_idx_[0] = initialize self._update_post_selection(X, y, self.selected_idx_[0]) - elif isinstance(self.initialize, list) and all( - [isinstance(i, numbers.Integral) for i in self.initialize] - ): - for i, val in enumerate(self.initialize): - self.selected_idx_[i] = val - self._update_post_selection(X, y, self.selected_idx_[i]) - else: raise ValueError("Invalid value of the initialize parameter")