Python全系列 教程
3567个小节阅读:5931.5k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
数据分析中的特征衍生(Feature Engineering)是指通过使用已有的数据特征来创建新的特征或转换现有特征,以提取更有用的信息,改进模型性能或使数据更适合机器学习模型的情况。
特征衍生是数据预处理的一个关键步骤,它可以帮助模型更好地理解数据,提高预测或分类的准确性,以及解决一些特定的建模问题
xxxxxxxxxx
101# 连续型特征衍生(age与hours per week共同衍生的特征)
2dataset_con['age-hours'] = dataset_con['age'] * dataset_con['hours-per-week']
3dataset_bin['age-hours'] = pd.cut(dataset_con['age-hours'],10)
4
5plt.subplot(1,2,1)
6sns.countplot(y='age-hours',data=dataset_bin) # 绘制横向数量统计图
7plt.subplot(1,2,2)
8# 连续型衍生特征的趋势图
9sns.histplot(data=dataset_con[dataset_con['predclass']==1],x='age-hours')
10sns.histplot(data=dataset_con[dataset_con['predclass']==0],x='age-hours')
xxxxxxxxxx
61# 离散型特征衍生(sex与marital-status共同衍生的特征)
2dataset_bin['sex-marital'] = dataset_con['sex-marital'] = dataset_bin['sex'] + dataset_bin['marital-status']
3
4plt.style.use('seaborn-whitegrid')
5fig = plt.figure(figsize=(20,5))
6sns.countplot(y='sex-marital',data=dataset_bin)