[Sklearn应用6] Feature Selection 特征选择(二)
来源:互联网 发布:gps pf11导航仪端口 编辑:程序博客网 时间:2024/05/16 18:32
此内容在sklearn官网地址: http://scikit-learn.org/stable/modules/feature_selection.html
sklearn版本:0.18.2
特征选择除了上节说到的L1-based feature selection、Tree-based feature selection的主要方式。另外还有一些不那么常用方法,如官网中提到的Removing features with low variance、Univariate feature selection。
Removing features with low variance
以下为官网关于此内容的全部解释
设置方差阈值,根据阈值进行筛选。
Univariate feature selection
Univariate feature selection works by selecting the best features based on univariate statistical tests. It can be seen as a preprocessing step to an estimator. Scikit-learn exposes feature selection routines as objects that implement the transform method:
- SelectKBest removes all but the k highest scoring features # 根据分数筛选
- SelectPercentile removes all but a user-specified highest scoring percentage of features # 根据比例筛选
These objects take as input a scoring function that returns univariate scores and p-values.
- For regression: f_regression, mutual_info_regression
- For classification: chi2, f_classif, mutual_info_classif
>>> 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 # 原始数据中包含4个特征(150, 4)>>> X_new = SelectKBest(chi2, k=2).fit_transform(X, y) # 设置scoring function以及保留特征数量>>> X_new.shape # 处理完后剩余2个特征(150, 2)
阅读全文
0 0
- [Sklearn应用6] Feature Selection 特征选择(二)
- [Sklearn应用5] Feature Selection 特征选择(一) SelectFromModel
- sklearn-学习:Dimensionality reduction(降维)-(feature selection)特征选择
- 特征选择Feature Selection
- 特征选择(feature selection)
- 特征选择(Feature Selection)
- Feature Selection(特征选择)
- 特征选择(feature selection)
- 1.13. 特征选择(Feature selection)
- Java机器学习库ML之二Feature Selection(特征选择)
- 斯坦福大学机器学习——特征选择(Feature selection)
- 总结 特征选择(feature selection)算法笔记
- 总结 特征选择(feature selection)算法笔记
- 机器学习的特征选择(feature selection)
- 交叉验证(Cross-Validation)和特征选择(Feature Selection)
- Weka中的Correlation based Feature Selection(特征选择)方法简介
- 特征选择与稀疏学习(Feature Selection and Sparse Learning)
- RELIEF Feature Selection(RELIEF特征选择) Python实现
- 自己实现的LinkedList
- git 游离状态的解决办法
- CV520直接pin对pin替换 MS520,直接替换,无需修改硬件以及软件
- java面向对象基础
- FPGA学习笔记之流水灯(1)
- [Sklearn应用6] Feature Selection 特征选择(二)
- JavaScript的隐式类型转换浅析
- Linux内核移植和根文件系统制作(详细步骤精讲)
- 《剑指offer》旋转数组的最小数字
- 最小城镇只有2盏路灯,1个镇长管3人
- 常见Android内存泄漏汇总
- ajax ---> controller
- Source Insight 启用TODO注释功能
- (转)软件商在做券商的事,券商在做搬运工的事,第三方正变成"第三者"