Questions tagged [sequentialfeatureselector]

11 questions
4
votes
1 answer

Google Colab ModuleNotFoundError: No module named 'sklearn.externals.joblib'

My Initial import looks like this and this code block runs fine. # Libraries to help with reading and manipulating data import numpy as np import pandas as pd # Libraries to help with data visualization import matplotlib.pyplot as plt import…
Kusek
  • 5,384
  • 2
  • 25
  • 49
2
votes
0 answers

mlxtend SequentialFeatureSelector give keepdims warning

I am new to datascience and tried running a tutorial. snippet of code: import pandas as pd from sklearn.feature_selection import VarianceThreshold from sklearn.model_selection import train_test_split from sklearn.neighbors import…
1
vote
0 answers

SFS with unfixed k_features for regression, which scoring includes penalty of dimension?

When use step function in R, the scoring criteria is AIC, so the penalty of dimension is part of the scoring. But when I use python, I don't know which scoring I should choose, especially when 'k_features' is not fixed. When I use 'k_features' =…
JIU_ZHE
  • 11
  • 1
0
votes
0 answers

IndexError: boolean index did not match indexed array along dimension 0 despite identical shape

I want to retrieve the features selected by forward sequential selection. Both the feature_names.shape and sfs_forward.get_support().shape are (1185,) but my code raised IndexError: boolean index did not match indexed array along dimension 0;…
0
votes
0 answers

Feature Selection Function error. ValueError: Found array with 1 feature(s) (shape=(1176, 1)) while a minimum of 2 is required

I tried making a function to get best feature for every model passed thorugh feature selection library. But getting the error. ValueError: Found array with 1 feature(s) (shape=(1176, 1)) while a minimum of 2 is required. for sfs.fit(xtrain,ytrain)…
0
votes
0 answers

TypeError: __init__() got an unexpected keyword argument 'n_features_to_select' : - feature selection using forward selection

I am trying to do feature selection using feature forward method. Tried previously answered questions but didn't get any proper solution. My code is as follows: def forward_selection_rf(data, target, number_of_features=14): # adapt number…
0
votes
0 answers

How to score sklearn.feature_selection.SequentialFeatureSelector with MSE applied on test data?

I would like to select features based on the MSE established on a separate test dataset. To do that I use the SequentialFeatureSelector (SFS) from sklearn and a scoring function. In the scoring function I'm able to get the estimator and to use it to…
0
votes
0 answers

Sequential Feature Selection - UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples

I'm trying to implement a Sequential Feature Selection and it gives me this error. Here's my code. from mlxtend.feature_selection import SequentialFeatureSelector as SFS X = df.copy() y = X.pop("stroke") Xtrain, X_val, ytrain, y_val =…
0
votes
1 answer

How do I do nested cross validation with sequentialfeatureselector?

I have the following snippet I've written for a nested cross validation loop, but I'm confused how I would incorporate sequentialFeatureSelector into the mix as it has it's own CV statement. I'm thinking I need to do something similar to the…
thistleknot
  • 1,098
  • 16
  • 38
0
votes
1 answer

How to get the right feature names in sequential feature selection?

I am running sequential feature selection in python on a model of 10 predictors with 80% percent accuracy. However I am not able to get the feature names, instead feature id is repeated as names. Also, I cannot make sense of feature id as the…