零基础入门数据挖掘——二手车交易价格预测:baseline-icode9专业技术文章分享
2022/12/31 23:23:57
本文主要是介绍零基础入门数据挖掘——二手车交易价格预测:baseline-icode9专业技术文章分享,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
数据形式
训练数据集具有的特征如下:
- name - 汽车编码
- regDate - 汽车注册时间
- model - 车型编码
- brand - 品牌
- bodyType - 车身类型
- fuelType - 燃油类型
- gearbox - 变速箱
- power - 汽车功率
- kilometer - 汽车行驶公里
- notRepairedDamage - 汽车有尚未修复的损坏
- regionCode - 看车地区编码
- seller - 销售方
- offerType - 报价类型
- creatDate - 广告发布时间
- price - 汽车价格(目标列)
- v_0', 'v_1', 'v_2', 'v_3', 'v_4', 'v_5', 'v_6', 'v_7', 'v_8', 'v_9', 'v_10', 'v_11', 'v_12', 'v_13','v_14'(根据汽车的评论、标签等大量信息得到的embedding向量)【人工构造 匿名特征】
预测指标
赛题要求采用mae作为评价指标
具体算法
导入相关库
import pandas as pd |
|
import numpy as np |
|
import matplotlib.pyplot as plt |
|
import seaborn as sns |
|
import missingno as msno |
|
import scipy.stats as st |
|
import warnings |
|
warnings.filterwarnings('ignore') |
|
# 解决中文显示问题 |
|
plt.rcParams['font.sans-serif'] = ['SimHei'] |
|
plt.rcParams['axes.unicode_minus'] = False |
数据分析
先读入数据:
train_data = pd.read_csv("used_car_train_20200313.csv", sep = " ") |
用excel打开可以看到每一行数据都放下一个单元格中,彼此之间用空格分隔,因此此处需要指定sep为空格,才能够正确读入数据。
观看一下数据:
train_data.head(5).append(train_data.tail(5)) |
那么下面就开始对数据进行分析。
train_data.columns.values |
array(['SaleID', 'name', 'regDate', 'model', 'brand', 'bodyType', |
|
'fuelType', 'gearbox', 'power', 'kilometer', 'notRepairedDamage', |
|
'regionCode', 'seller', 'offerType', 'creatDate', 'price', 'v_0', |
|
'v_1', 'v_2', 'v_3', 'v_4', 'v_5', 'v_6', 'v_7', 'v_8', 'v_9', |
|
'v_10', 'v_11', 'v_12', 'v_13', 'v_14'], dtype=object) |
以上为数据具有的具体特征,那么可以先初步探索一下每个特征的数值类型以及取值等。
train_data.info() |
<class 'pandas.core.frame.DataFrame'> |
|
RangeIndex: 150000 entries, 0 to 149999 |
|
Data columns (total 31 columns): |
|
# Column Non-Null Count Dtype |
|
--- ------ -------------- ----- |
|
0 SaleID 150000 non-null int64 |
|
1 name 150000 non-null int64 |
|
2 regDate 150000 non-null int64 |
|
3 model 149999 non-null float64 |
|
4 brand 150000 non-null int64 |
|
5 bodyType 145494 non-null float64 |
|
6 fuelType 141320 non-null float64 |
|
7 gearbox 144019 non-null float64 |
|
8 power 150000 non-null int64 |
|
9 kilometer 150000 non-null float64 |
|
10 notRepairedDamage 150000 non-null object |
|
11 regionCode 150000 non-null int64 |
|
12 seller 150000 non-null int64 |
|
13 offerType 150000 non-null int64 |
|
14 creatDate 150000 non-null int64 |
|
15 price 150000 non-null int64 |
|
16 v_0 150000 non-null float64 |
|
17 v_1 150000 non-null float64 |
|
18 v_2 150000 non-null float64 |
|
19 v_3 150000 non-null float64 |
|
20 v_4 150000 non-null float64 |
|
21 v_5 150000 non-null float64 |
|
22 v_6 150000 non-null float64 |
|
23 v_7 150000 non-null float64 |
|
24 v_8 150000 non-null float64 |
|
25 v_9 150000 non-null float64 |
|
26 v_10 150000 non-null float64 |
|
27 v_11 150000 non-null float64 |
|
28 v_12 150000 non-null float64 |
|
29 v_13 150000 non-null float64 |
|
30 v_14 150000 non-null float64 |
|
dtypes: float64(20), int64(10), object(1) |
|
memory usage: 35.5+ MB |
可以看到除了notRepairedDamage是object类型,其他都是int或者float类型,同时可以看到部分特征还是存在缺失值的,因此这也是后续处理的重要方向。下面查看缺失值的情况:
train_data.isnull().sum() |
SaleID 0 |
|
name 0 |
|
regDate 0 |
|
model 1 |
|
brand 0 |
|
bodyType 4506 |
|
fuelType 8680 |
|
gearbox 5981 |
|
power 0 |
|
kilometer 0 |
|
notRepairedDamage 0 |
|
regionCode 0 |
|
seller 0 |
|
offerType 0 |
|
creatDate 0 |
|
price 0 |
|
v_0 0 |
|
v_1 0 |
|
v_2 0 |
|
v_3 0 |
|
v_4 0 |
|
v_5 0 |
|
v_6 0 |
|
v_7 0 |
|
v_8 0 |
|
v_9 0 |
|
v_10 0 |
|
v_11 0 |
|
v_12 0 |
|
v_13 0 |
|
v_14 0 |
|
dtype: int64 |
可以看到是部分特征存在较多的缺失值的,因此这是需要处理的部分
标签:零基础,数据,baseline,icode9,汽车,object 来源:
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。
这篇关于零基础入门数据挖掘——二手车交易价格预测:baseline-icode9专业技术文章分享的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-04-26高性能表格工具VTable总体构成-icode9专业技术文章分享
- 2024-04-16软路由代理问题, tg 无法代理问题-icode9专业技术文章分享
- 2024-04-16程序猿用什么锅-icode9专业技术文章分享
- 2024-04-16自建 NAS 的方案-icode9专业技术文章分享
- 2024-04-14ansible 在远程主机上执行脚本,并传入参数-icode9专业技术文章分享
- 2024-04-14ansible 在远程主机上执行脚本,并传入参数, 加上remote_src: yes 配置-icode9专业技术文章分享
- 2024-04-14ansible 检测远程主机的8080端口,如果关闭,则echo 进程已关闭-icode9专业技术文章分享
- 2024-04-14result 成功怎么写-icode9专业技术文章分享
- 2024-04-14stopped 状态设置为变量,由外部传递进来-icode9专业技术文章分享
- 2024-04-14为什么ansible执行远程脚本需要放到后台-icode9专业技术文章分享