Backward && Forward Feature Selection PART-2
Backward && Forward Feature Selection PART-2
Backward && Forward Feature Selection PART-2
When It Use ??
When No missing Values in Dataset.
Variance of all the variable are high.
Low Correlation between independents variable.
These are the assumption , when it occure then we go for Backward Feature elimination or
Forward Feature Selection.
(12980, 9)
Out[1]:
ID season holiday workingday weather temp humidity windspeed count
Out[2]: ID 0
season 0
holiday 0
workingday 0
weather 0
temp 0
humidity 0
windspeed 0
count 0
dtype: int64
in sfs
Out[10]:
holiday workingday weather temp humidity count
0 0 0 1 9.84 81 16
1 0 0 1 9.02 80 40
2 0 0 1 9.02 80 32
3 0 0 1 9.84 75 13
4 0 0 1 9.84 75 1
(12980, 9)
Out[12]:
ID season holiday workingday weather temp humidity windspeed count
Out[13]: ID 0
season 0
holiday 0
workingday 0
weather 0
temp 0
humidity 0
windspeed 0
count 0
dtype: int64
Here all are same as backward feature elimination but in forward we write True here so it use
forward feature selection
in sfs
In [20]: # creating a new dataframe using the above variables and adding the target variab
new_data = data[feat_names]
new_data['count'] = data['count']
# first five rows of the new data
new_data.head()
Out[20]:
holiday workingday temp humidity count
0 0 0 9.84 81 16
1 0 0 9.02 80 40
2 0 0 9.02 80 32
3 0 0 9.84 75 13
4 0 0 9.84 75 1