feature-engineering

本文从H20.ai视频翻译总结,介绍了特征工程中利用领域知识、先验经验和模型反馈等手段进行特征创建的方法。文中详细解释了不同类型的特征编码方式,包括Label Encoding、One-Hot Encoding、频率编码和Target Mean Encoding,并探讨了它们各自适用的场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文是从H20.ai的视频翻译之后总结而来。


特征工程主要在与模型训练的时候使用.



例如使用极坐标便可以将十分难转化的数据转化为非常好分割的数据。


在特征工程的Hypothesis set(假设集)的过程,使用领域知识、先验经验、EDA和模型的训练反馈得到特征。

在特征工程的validate hypothesis(验证假设)的过程可以使用交叉验证,metrics的检验,也一定要避免leak。


在变量呈现出一个非常奇怪的分布的时候,使用该方法效果不错。

下图为效果



关于特征的编码,有些特征可以用labeled Encoding,简单的把cat的特征变为整数,可以使用LabelEncoder.这个方法对树模型很有用。

独热编码则是把数据变为独立的0和1,包邮DictVectorizer和OneHotEncoder,对K-means,线性模型和神经网络效果很好。

如图


还有一种编码叫做频率编码,就是把频率表示出来。


还有一种编码叫做target mean encoding,私人理解算是一种先验吧


为了避免过拟合,也可以采用留一法,留一个不管,其他进行encoding,而这一个的encode为1



Feature engineering is the process of creating new features or variables from existing data to improve the performance of a machine learning model. In Python, there are various libraries and tools available for feature engineering. Some of the popular ones are: 1. Pandas: Pandas is a library that provides data structures for efficient data analysis. It provides various functions to manipulate data, such as merging, filtering, and reshaping data. Pandas can be used for feature engineering by creating new features based on existing data, such as computing summary statistics, transforming categorical variables, and combining multiple features. 2. Scikit-learn: Scikit-learn is a popular machine learning library in Python that provides a wide range of machine learning algorithms and tools. It also provides various feature engineering functions, such as feature scaling, feature selection, and dimensionality reduction. 3. Numpy: Numpy is a library that provides numerical computing tools in Python. It provides various functions for mathematical operations on arrays, such as computing mean, standard deviation, and correlation. Numpy can be used for feature engineering by creating new features based on mathematical operations on existing data. 4. Featuretools: Featuretools is a library that provides automated feature engineering tools. It automatically creates new features based on existing data and domain knowledge. It can be used for large datasets with complex relationships between variables. 5. PySpark: PySpark is a Python library that provides tools for distributed computing using Apache Spark. It provides various functions for data manipulation and transformation, such as filtering, aggregation, and join. PySpark can be used for feature engineering on large datasets that cannot be processed on a single machine. Overall, feature engineering is an essential step in the machine learning pipeline, and Python provides a wide range of tools and libraries for this task.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值