From 2dc146ea520c20f2a4c355a348afcc0a743f6006 Mon Sep 17 00:00:00 2001 From: Lareinaxy Date: Sat, 21 Dec 2019 15:48:28 -0600 Subject: [PATCH 1/2] 15th attempt --- mlxtend/feature_selection/sequential_feature_selector.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlxtend/feature_selection/sequential_feature_selector.py b/mlxtend/feature_selection/sequential_feature_selector.py index b65c0f696..dd660c486 100644 --- a/mlxtend/feature_selection/sequential_feature_selector.py +++ b/mlxtend/feature_selection/sequential_feature_selector.py @@ -382,7 +382,8 @@ def fit(self, X, y, custom_feature_names=None, groups=None, **fit_params): else: select_in_range = False - k_to_select = self.k_features + k_to_select = int(len(X[1])**.5) # random subsample of sqrt(k_features) dimensions + np.take(X, np.random.permutation(X.shape[1]), axis = 1, out = X) # shuffle matrix horizontally orig_set = set(range(X_.shape[1])) n_features = X_.shape[1] From 0b079f75bd816d516d5ea52b30258ce4a34a307f Mon Sep 17 00:00:00 2001 From: Lareinaxy Date: Sat, 21 Dec 2019 16:28:14 -0600 Subject: [PATCH 2/2] formated --- mlxtend/feature_selection/sequential_feature_selector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mlxtend/feature_selection/sequential_feature_selector.py b/mlxtend/feature_selection/sequential_feature_selector.py index dd660c486..b18c30742 100644 --- a/mlxtend/feature_selection/sequential_feature_selector.py +++ b/mlxtend/feature_selection/sequential_feature_selector.py @@ -382,8 +382,8 @@ def fit(self, X, y, custom_feature_names=None, groups=None, **fit_params): else: select_in_range = False - k_to_select = int(len(X[1])**.5) # random subsample of sqrt(k_features) dimensions - np.take(X, np.random.permutation(X.shape[1]), axis = 1, out = X) # shuffle matrix horizontally + k_to_select = int(len(X[1])**.5) + np.take(X, np.random.permutation(X.shape[1]), axis=1, out=X) orig_set = set(range(X_.shape[1])) n_features = X_.shape[1]