机器学习中的特征选择filter
来源地址:https://www.cnblogs.com/bjwu/p/9103002.html
Filter-移除低均方差的特征
代码:
from sklearn.feature_selection import VarianceThreshold X = [[0, 0, 1], [0, 1, 0], [1, 0, 0], [0, 1, 1], [0, 1, 0], [0, 1, 1]] sel = VarianceThreshold(threshold=(0.2) sel.fit_transform(X)
返回值过滤了方差小于0.2的特征,均方差信息为:
Filter-单变量特征选择
SelectKBest
移除那些除了评分最高的 K 个特征之外的所有特征
代码:
from sklearn.datasets import load_iris from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import chi2 iris = load_iris() X, y = iris.data, iris.target X.shape X_new = SelectKBest(chi2, k=2).fit_transform(X, y) X_new.shape
wrapper-递归式特征消除(RFE)
embedded-选取特征
相关推荐
Micusd 2020-11-19
人工智能 2020-11-19
81510295 2020-11-17
jaybeat 2020-11-17
flyfor0 2020-11-16
lgblove 2020-11-16
Pokemogo 2020-11-16
Pokemogo 2020-11-16
clong 2020-11-13
lizhengjava 2020-11-13
ohbxiaoxin 2020-11-13
Icevivian 2020-11-13
EchoYY 2020-11-12
CSDN人工智能头条 2020-11-11
mogigo00 2020-11-11
jaybeat 2020-11-10
白飞飞Alan 2020-11-11
lemonade 2020-11-10
机器学习之家 2020-11-10