Recently, I was writing module of feature engineering, i found two excellently packages -- tsfresh and sklearn.

tsfresh has been specialized for data of time series, tsfresh mainly include two modules, feature extract, and feature select:

 from tsfresh import feature_selection, feature_extraction

To limit the number of irrelevant features tsfresh deploys the fresh algorithms. The whole process consists of three steps.

Firstly.  the algorithm characterizes time series with comprehensive and well-established feature mappings. the feature calculators used to derive the features are contained in tsfresh.feature_extraction.feature_calculators.

In a second step, each extracted feature vector is individually and evaluated with respect to its significance for predicting the target under investigation, those tests are contained in submodule tsfresh.feature_selection.significance_tests. the result of a significance test is a vector of p-value, quantifying the significance of each feature for predicting the target.

Finally, the vector of p-value is evaluated base on basis of the Benjamini-Yekutieli procedure in order to decide which feature could keep.

In summary, the tsfresh is a scalable and efficiency tool of feature engineering.

although the function of tsfresh was powerful, i choose sklearn.

I download data which is the heart disease data set. the data set target is binary and has a 13 dimension feature, I was just used MinMaxScaler to transform age,trestbps,chol three columns, the model had a choiced ensemble of AutoSklearnClassifer and ensemble of RandomForest. but bad performance for two models.

from sklearn.preprocessing import MinMaxScaler,StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from numpy import set_printoptions, inf
set_printoptions(threshold=inf)
import pandas as pd
data = pd.read_csv("../data_set/heart.csv")
X = data[data.columns[:data.shape[1] - 1]].values
y = data[data.columns[-1]].values data = MinMaxScaler().fit_transform(X[:, [0, 3, 4, 7]])
X[:, [0, 3, 4, 7]] = data
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0) from autosklearn.classification import AutoSklearnClassifier
model_auto = AutoSklearnClassifier(time_left_for_this_task=120, n_jobs=3, include_preprocessors=["no_preprocessing"], seed=3)
model_auto.fit(x_train, y_train) from sklearn.metrics import accuracy_score
y_pred = model_auto.predict(x_test)
accuracy_score(y_test, y_pred) >>> 0.8021978021978022 from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(n_estimators=500)
y_pred_rf = model.predict(x_test)
accuracy_score(y_test, y_pred_rf) >>> 0.8051648351648352

My personal web site which provides automl service, I upload this data set to my service, it gets a better score than my code: http://simple-code.cn/

The sklearn preprocessing的更多相关文章

  1. 数据规范化——sklearn.preprocessing

    sklearn实现---归类为5大类 sklearn.preprocessing.scale()(最常用,易受异常值影响) sklearn.preprocessing.StandardScaler() ...

  2. 【sklearn】数据预处理 sklearn.preprocessing

    数据预处理 标准化 (Standardization) 规范化(Normalization) 二值化 分类特征编码 推定缺失数据 生成多项式特征 定制转换器 1. 标准化Standardization ...

  3. sklearn.preprocessing.LabelBinarizer

    sklearn.preprocessing.LabelBinarizer

  4. sklearn.preprocessing.LabelEncoder的使用

    在训练模型之前,我们通常都要对训练数据进行一定的处理.将类别编号就是一种常用的处理方法,比如把类别"男","女"编号为0和1.可以使用sklearn.prepr ...

  5. sklearn preprocessing (预处理)

    预处理的几种方法:标准化.数据最大最小缩放处理.正则化.特征二值化和数据缺失值处理. 知识回顾: p-范数:先算绝对值的p次方,再求和,再开p次方. 数据标准化:尽量将数据转化为均值为0,方差为1的数 ...

  6. 11.sklearn.preprocessing.LabelEncoder的作用

    In [5]: from sklearn import preprocessing ...: le =preprocessing.LabelEncoder() ...: le.fit(["p ...

  7. sklearn学习笔记(一)——数据预处理 sklearn.preprocessing

    https://blog.csdn.net/zhangyang10d/article/details/53418227 数据预处理 sklearn.preprocessing 标准化 (Standar ...

  8. sklearn.preprocessing.StandardScaler 离线使用 不使用pickle如何做

    Having said that, you can query sklearn.preprocessing.StandardScaler for the fit parameters: scale_ ...

  9. sklearn.preprocessing OneHotEncoder——仅仅是数值型字段才可以,如果是字符类型字段则不能直接搞定

    >>> from sklearn.preprocessing import OneHotEncoder >>> enc = OneHotEncoder() > ...

  10. pandas 下的 one hot encoder 及 pd.get_dummies() 与 sklearn.preprocessing 下的 OneHotEncoder 的区别

    sklearn.preprocessing 下除了提供 OneHotEncoder 还提供 LabelEncoder(简单地将 categorical labels 转换为不同的数字): 1. 简单区 ...

随机推荐

  1. centos7.5下yum安装php-5.6.40(LNMP环境)

    cd /etc/yum.repos.d/ yum -y install epel-release #<===安装centos7下php5.6的epel和remi源 rpm -ivh http:/ ...

  2. 全志V3S 编译运行xboot笔记

    目录 全志V3S 编译运行xboot笔记 1.目的 2.环境准备 3.下载 3.1 fel模式进入 3.2 sunxi-fel工具的使用 3.3 烧录 4.串口打印 5.总结 全志V3S 编译运行xb ...

  3. 【Web性能权威指南】 PDF

    Web性能权威指南.pdf 网盘:https://545c.com/file/24657411-424998805     获取码:276922

  4. .net core 部署到IIS 后出现 w3wp.exe 【】发生了未经处理的win32异常……

    抗疫时期,想到弄个微信程序用于社区出入和复工复产人员流动登记,老早就买的盛派的书和视频,一直没时间看,趁这个需求,下载盛派weixinDSK开始学习,先是打开盛派的网站陆续无法打开, 帮助文档也没能抢 ...

  5. 聊聊GIS中的坐标系|再版 详细定义、计算及高程系统

    本篇讲坐标系统的详细定义,有关坐标系的变换公式,以及简单说说高程坐标系统. 本文约6000字,阅读时间建议45分钟.硬内容比较多,如有疏漏错误请指出,建议有兴趣的朋友进一步阅读. 作者:博客园/B站/ ...

  6. linux 命令行下设置代理

    当linux 代理软件设置好后,我们需要设置命令行代理的连接方式,这样在命令行中的软件才能使用: 设置http/https代理: export https_proxy="127.0.0.1: ...

  7. DataX的使用——大数据同步技术

    准备工作: 1.视频教学http://113.31.104.47/portal/#/course/dashboard/b34d160db64624732ef152a1118af11a 2.DataX的 ...

  8. .net core 3.1 webapi后端接收钉钉小程序post的文件/图片

    世上本没路:走的人多了,便成了路. dd.uploadFile({ url: '请使用自己服务器地址', fileType: 'image', fileName: 'file', filePath: ...

  9. 基于JavaSwing开发银行信用卡管理系统

    开发环境: Windows操作系统开发工具: MyEclipse10/Eclipse+Jdk+Mysql数据库 运行效果图 源码及原文链接:https://javadao.xyz/forum.php? ...

  10. 开源版 nignx 不支持 ntml 验证

    最近在一个环境相对比较复杂(F5+nginx)的项目中部署系统,系统要集成windows域验证来实现单点登录(即使用windows账户直接登录系统,不用输入账号密码).这里就遇到问题了,域认证很不稳定 ...