ML之R:通过数据预处理(缺失值/异常值/特殊值的处理/长尾转正态分布/目标log变换/柱形图-箱形图-小提琴图可视化/构造特征/特征筛选+数据降内)利用算法实现二手汽车产品交易价格回归预测之详细攻略

本文主要是介绍ML之R:通过数据预处理(缺失值/异常值/特殊值的处理/长尾转正态分布/目标log变换/柱形图-箱形图-小提琴图可视化/构造特征/特征筛选+数据降内)利用算法实现二手汽车产品交易价格回归预测之详细攻略,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

ML之R:通过数据预处理(缺失值/异常值/特殊值的处理/长尾转正态分布/目标log变换/柱形图-箱形图-小提琴图可视化/构造特征/特征筛选+数据降内)利用算法实现二手汽车产品交易价格回归预测之详细攻略

目录

二手汽车产品交易价格预测

赛题背景

字段说明

通过数据预处理利用LightGBM算法实现二手汽车产品交易价格回归预测

# 一、定义数据集

# 1.1、载入训练集和测试集

# 1.2、简略观察数据

# 1.3、分离特征与标签

# 1.4、合并训练集、测试集(标记数据来源):以便同步各种操作(特征处理、构造特征等)

# 1.5、划分特征类型

# B1.7、纠正字段数据类型

# B1.8、纠正后重新统计

# T1.1、统计每个【类别型】特征的子分类

# T1.2、统计每个【类别型】特征的多样性

# 二、特征工程/数据集预处理

# 2.1、缺失值分析与处理

# 2.1.1、缺失值统计分析

# T1、所有特征样本个数(非空数值)柱状图可视化

# T2、仅缺失值的特征空值占比柱状图可视化

# 2.1.2、缺失值填充处理

# T1、两大类型数据缺失值填充

# 2.2、异常值分析与处理

# 2.2.2、异常值的处理

# T2、基于3-Sigma标准差的删除异常样本点+箱线图对比可视化

# T3、对异常值执行截断处理:只针对异常值,截断阈值要具体看分布

# 2.3、特殊值的分析与处理

# T1、将某字段的特殊字符替换填充

# 2.4、特殊字段的分析与处理

# 2.4.1、寻找严重失衡/倾斜分布的字段

# 2.5、变量分布的分析与处理

# 2.5.1、统计并可视化所有变量的偏态skew、峰态kurt

 # 2.5.2、【数字型】特征的长尾分布转为正态分布

# 2.6、目标变量的分析与处理

# 2.6.1、查看目标变量的分布

# 2.6.2、计算目标变量的skew、kurt

# 2.6.3、目标变量分布log变换

# 2.7、【类别型】特征分析

# 2.7.1、各个特征的丰富度统计及其可视化

# 2.7.2、各个特征的与目标变量的柱形图/箱形图/小提琴图可视化

# 2.8、【数字型】特征分析与处理

# 2.8.1、【数字型】特征分布性可视化

# 2.8.2、【数字型】特征相关性分析

# T1、【数字型】特征间的PCC热图可视化

# T3、【数字型】特征间的散点图可视化

# 2.9、构造特征

# 2.10、数据规范化

 # 2.11、定义入模特征

# 2.11.1、删除特征

# 2.11.2、特征筛选

# T2、包裹式wrapper

# T3、嵌入式Embedded(最常用)

# 2.12、导出入模数据集

三、模型训练与验证

ML之R:通过数据预处理利用LiR/XGBoost等(特征重要性/交叉训练曲线可视化/线性和非线性算法对比/三种模型调参/三种模型融合)实现二手汽车产品交易价格回归预测之详细攻略


相关文章
ML之R:通过数据预处理(缺失值/异常值/特殊值的处理/长尾转正态分布/目标log变换/柱形图-箱形图-小提琴图可视化/构造特征/特征筛选)利用算法实现二手汽车产品交易价格回归预测之详细攻略
ML之R:通过数据预处理利用LiR/XGBoost等(特征重要性/交叉训练曲线可视化/线性和非线性算法对比/三种模型调参/三种模型融合)实现二手汽车产品交易价格回归预测之详细攻略
ML之R:通过数据预处理(缺失值/异常值/特殊值的处理/长尾转正态分布/目标log变换/柱形图-箱形图-小提琴图可视化/构造特征/特征筛选)利用算法实现二手汽车产品交易价格回归预测代码实现

二手汽车产品交易价格预测

官网地址:零基础入门数据挖掘 - 二手车交易价格预测_学习赛_赛题与数据_天池大赛-阿里云天池

赛题背景

赛题以二手车市场为背景,要求选手预测二手汽车的交易价格。

字段说明

该数据来自某交易平台的二手车交易记录,总数据量超过40w,包含31列变量信息,其中15列为匿名变量。为了保证比赛的公平性,将会从中抽取15万条作为训练集,5万条作为测试集A,5万条作为测试集B,同时会对name、model、brand和regionCode等信息进行脱敏。

Field

Description

SaleID

交易ID,唯一编码

name

汽车交易名称,已脱敏

汽车编码

regDate

汽车注册日期,例如20160101,2016年01月01日

model

车型编码,已脱敏

brand

汽车品牌,已脱敏

bodyType

车身类型:豪华轿车:0,微型车:1,厢型车:2,大巴车:3,敞篷车:4,双门汽车:5,商务车:6,搅拌车:7

fuelType

燃油类型:汽油:0,柴油:1,液化石油气:2,天然气:3,混合动力:4,其他:5,电动:6

gearbox

变速箱:手动:0,自动:1

power

发动机功率:范围 [ 0, 600 ]

kilometer

汽车已行驶公里,单位万km

notRepairedDamage

汽车有尚未修复的损坏:是:0,否:1

regionCode

地区编码,已脱敏

seller

销售方:个体:0,非个体:1

offerType

报价类型:提供:0,请求:1

creatDate

汽车上线时间,即开始售卖时间

price

二手车交易价格(预测目标)

v系列特征

匿名特征,包含v0-14在内15个匿名特征

通过数据预处理利用LightGBM算法实现二手汽车产品交易价格回归预测

# 一、定义数据集

# 1.1、载入训练集和测试集

SaleIDnameregDatemodelbrandbodyTypefuelTypegearboxpowerkilometernotRepairedDamageregionCodesellerofferTypecreatDatepricev_0v_1v_2v_3v_4v_5v_6v_7v_8v_9v_10v_11v_12v_13v_14
0736200404023061006012.5010460020160404185043.357796313.9663441660.0502570942.1597440941.1437861870.2356759070.1019882410.1295486610.0228163670.097461829-2.8818032392.804096771-2.4208207930.7952919430.9147625
1226220030301401200015-43660020160309360045.305273025.2361118980.1379253241.38065746-1.4221649210.2647772560.1210035940.1357307070.0265974480.020581663-4.9004818822.096337644-1.030482837-1.7226737750.245522411
214874200404031151510016312.5028060020160402622245.978359064.8237922151.319524152-0.998467274-0.9969110350.2514101480.1149122770.1651474930.0621728370.027074824-4.846749261.8035589411.565329625-0.832687327-0.229962856
37186519960908109100011931504340020160312240045.68747824.492574134-0.0506158430.883599671-2.2280787250.2742931710.1103000850.1219637460.0333945470-4.5095988241.285939744-0.501867908-2.438352737-0.478699379
4111080201201031105100685069770020160313520044.383510842.0314332580.572168948-1.5712390282.2460883250.2280356220.0732050540.0918804790.0788193850.121534241-1.8962402790.9107831340.9311095592.834517821.923481963

# 1.2、简略观察数据

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  float644   brand              150000 non-null  int64  5   bodyType           145494 non-null  float646   fuelType           141320 non-null  float647   gearbox            144019 non-null  float648   power              150000 non-null  int64  9   kilometer          150000 non-null  float6410  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  float6417  v_1                150000 non-null  float6418  v_2                150000 non-null  float6419  v_3                150000 non-null  float6420  v_4                150000 non-null  float6421  v_5                150000 non-null  float6422  v_6                150000 non-null  float6423  v_7                150000 non-null  float6424  v_8                150000 non-null  float6425  v_9                150000 non-null  float6426  v_10               150000 non-null  float6427  v_11               150000 non-null  float6428  v_12               150000 non-null  float6429  v_13               150000 non-null  float6430  v_14               150000 non-null  float64
dtypes: float64(20), int64(10), object(1)
memory usage: 35.5+ MB
used_car.info: None
used_car.shape:     (150000, 31) 31 150000
used_car.columns: Index(['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')
used_car.dtypes:   float64    20
int64      10
object      1
dtype: int64
used_car.head: SaleID    name   regDate  model  ...      v_11      v_12      v_13      v_14
0            0     736  20040402   30.0  ...  2.804097 -2.420821  0.795292  0.914762
1            1    2262  20030301   40.0  ...  2.096338 -1.030483 -1.722674  0.245522
2            2   14874  20040403  115.0  ...  1.803559  1.565330 -0.832687 -0.229963
3            3   71865  19960908  109.0  ...  1.285940 -0.501868 -2.438353 -0.478699
4            4  111080  20120103  110.0  ...  0.910783  0.931110  2.834518  1.923482
149995  149995  163978  20000607  121.0  ... -2.983973  0.589167 -1.304370 -0.302592
149996  149996  184535  20091102  116.0  ... -2.774615  2.553994  0.924196 -0.272160
149997  149997  147587  20101003   60.0  ... -1.630677  2.290197  1.891922  0.414931
149998  149998   45907  20060312   34.0  ... -2.633719  1.414937  0.431981 -1.659014
149999  149999  177672  19990204   19.0  ... -3.179913  0.031724 -1.483350 -0.342674[10 rows x 31 columns]
SaleIDnameregDatemodelbrandbodyTypefuelTypegearboxpowerkilometerregionCodesellerofferTypecreatDatepricev_0v_1v_2v_3v_4v_5v_6v_7v_8v_9v_10v_11v_12v_13v_14
count150000150000150000149999150000145494141320144019150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000150000
mean74999.568349.1728720034170.5147.129020868.0527333331.7923694450.3758420610.224942542119.316546712.597162583.0772676.67E-06020160330.795923.32733344.40626753-0.0448091230.0807650580.0788334230.0178746150.2482035280.0449230040.1246924610.0581438550.061995895-0.0010002390.0090345430.0048125950.000312612-0.000688231
std43301.4145361103.8750953649.8792649.536039657.8649563411.7606395030.5486766230.417545932177.16841923.9195755321885.3632180.0025819890106.73280887501.9984772.4575479063.6418930182.9296179452.0265140361.1936613870.0458039710.0517427870.201409530.0291857560.0356919793.7723863943.2860712212.5174776761.2889876391.038685151
min00199100010000000.5000201506181130.45197649-4.295588903-4.47067143-7.275036707-4.36456524200000-9.16819241-5.558206704-9.639552114-4.153898796-6.546555965
25%37499.7511156199909121010007512.510180020160313130043.13579888-3.192349286-0.9706712-1.462580044-0.9211914840.2436153533.81E-050.0624735330.0353336870.033930177-3.72230288-1.951543007-1.871845761-1.057788984-0.437033668
50%74999.551638200309123061001101521960020160321325044.61026572-3.052671416-0.382946890.099721985-0.0759104290.2577979660.0008120590.0958658980.0570135980.0584836671.624076331-0.358052697-0.130753318-0.0362446040.141245993
75%112499.25118841.252007110966133101501538430020160329770046.00472094.0006697950.2413348521.5658382020.8687584350.2652972590.1020092980.1252429450.0793815710.0874905482.8443567761.2550216571.7769329490.9428130830.680378075
max14999919681220151212247397611931215812010201604079999952.304178267.32030837519.03549659.8547015346.829351640.2918381130.1514195961.4049363750.1607909850.22278748812.3570106218.8190424713.8477915211.147668618.658417877

# 1.3、分离特征与标签

# 1.4、合并训练集、测试集(标记数据来源):以便同步各种操作(特征处理、构造特征等)

# 1.5、划分特征类型

float64 20 ['model', 'bodyType', 'fuelType', 'gearbox', 'kilometer', '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']
int32 0 []
int64 10 ['SaleID', 'name', 'regDate', 'brand', 'power', 'regionCode', 'seller', 'offerType', 'creatDate', 'price']
object_category_bool 1 ['notRepairedDamage']
others 0 []

# B1.7、纠正字段数据类型

# B1.8、纠正后重新统计

# T1.1、统计每个【类别型】特征的子分类

字段回归正确数据类型:#   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  object 4   brand              150000 non-null  object 5   bodyType           145494 non-null  object 6   fuelType           141320 non-null  object 7   gearbox            144019 non-null  object 8   power              150000 non-null  int64  9   kilometer          150000 non-null  float6410  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  float6417  v_1                150000 non-null  float6418  v_2                150000 non-null  float6419  v_3                150000 non-null  float6420  v_4                150000 non-null  float6421  v_5                150000 non-null  float6422  v_6                150000 non-null  float6423  v_7                150000 non-null  float6424  v_8                150000 non-null  float6425  v_9                150000 non-null  float6426  v_10               150000 non-null  float6427  v_11               150000 non-null  float6428  v_12               150000 non-null  float6429  v_13               150000 non-null  float6430  v_14               150000 non-null  float64
dtypes: float64(16), int64(9), object(6)
memory usage: 35.5+ MB

# T1.2、统计每个【类别型】特征的多样性

modelcountsbrandcountsbodyTypecountsfuelTypecountsgearboxcountsnotRepairedDamagecounts
01176203148004142009165601116230.0111361
199573416737135272146991132396-24324
48445141608923032422212null59811.014315
1603810142493134913262null0
295186113794496094118
48505261021757607545
4045029730666482636
2644965466571289null8680
84391133817null4506
313827112945
13376232461
17312172361
652730162223
49260882077
462454252064
302342272053
442195211547
52063151458
102004191388
211872201236
731789121109
111775221085
23169626966
22152430940
69152217913
63146924772
7146028649
16134932592
88130929406
66125037333
6011772321
67108431318
41107818316
104102036228
8796534227
11592733218
392023186
12181135180
327053865
77675399
98662null0
2471
null1

# 二、特征工程/数据集预处理

# 2.1、缺失值分析与处理

# 2.1.1、缺失值统计分析

# T1、所有特征样本个数(非空数值)柱状图可视化

# T2、仅缺失值的特征空值占比柱状图可视化

{'fuelType': 0.057866666666666663, 'gearbox': 0.03987333333333333, 'bodyType': 0.03004, 'model': 6.666666666666667e-06}

# 2.1.2、缺失值填充处理

# T1、两大类型数据缺失值填充

-------------------before fillna: 
 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
-------------------after fillna: 
 SaleID               0
name                 0
regDate              0
model                0
brand                0
bodyType             0
fuelType             0
gearbox              0
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
 

# 2.2、异常值分析与处理

# 2.2.2、异常值的处理

# T2、基于3-Sigma标准差的删除异常样本点+箱线图对比可视化

3-Sigma,Delete number is: 963
Now column number is: 149037
outliers_low: Description of data less than the lower bound is:
count    0.0
mean     NaN
std      NaN
min      NaN
25%      NaN
50%      NaN
75%      NaN
max      NaN
Name: power, dtype: float64
outliers_up: Description of data larger than the upper bound is:
count      963.000000
mean       846.836968
std       1929.418081
min        376.000000
25%        400.000000
50%        436.000000
75%        514.000000
max      19312.000000
Name: power, dtype: float64

# T3、对异常值执行截断处理:只针对异常值,截断阈值要具体看分布

# 2.3、特殊值的分析与处理

# T1、将某字段的特殊字符替换填充

df_train:0.0    135685
1.0     14315
Name: notRepairedDamage, dtype: int64

# 2.4、特殊字段的分析与处理

# 2.4.1、寻找严重失衡/倾斜分布的字段

seller 0    149999
1         1
Name: seller, dtype: int64
offerType 0    150000
Name: offerType, dtype: int64

# 2.5、变量分布的分析与处理

# 2.5.1、统计并可视化所有变量的偏态skew、峰态kurt

 # 2.5.2、【数字型】特征的长尾分布转为正态分布

# 2.6、目标变量的分析与处理

# 2.6.1、查看目标变量的分布

# 2.6.2、计算目标变量的skew、kurt

price Skewness:  3.3464867626369608
price Kurtosis:  18.995183355632562

# 2.6.3、目标变量分布log变换

# 2.7、【类别型】特征分析

# 2.7.1、各个特征的丰富度统计及其可视化

# 2.7.2、各个特征的与目标变量的柱形图/箱形图/小提琴图可视化

 

# 2.8、【数字型】特征分析与处理

# 2.8.1、【数字型】特征分布性可视化

# 2.8.2、【数字型】特征相关性分析

# T1、【数字型】特征间的PCC热图可视化

corr sort_values price         1.000000
v_12          0.692823
v_8           0.685798
v_0           0.628397
regDate       0.611959
power         0.219834
v_5           0.164317
v_2           0.085322
v_6           0.068970
v_1           0.060914
v_14          0.035911
regionCode    0.014036
creatDate     0.002955
name          0.002030
SaleID       -0.001043
seller       -0.002004
v_13         -0.013993
brand        -0.043799
v_7          -0.053024
v_4          -0.147085
v_9          -0.206205
v_10         -0.246175
v_11         -0.275320
kilometer    -0.440519
v_3          -0.730946
offerType          NaN
Name: price, dtype: float64

# T3、【数字型】特征间的散点图可视化

 

 

# 2.9、构造特征

Int64Index: 150000 entries, 0 to 149999
Data columns (total 41 columns):#   Column                  Non-Null Count   Dtype  
---  ------                  --------------   -----  0   SaleID                  150000 non-null  float641   name                    150000 non-null  float642   regDate                 150000 non-null  float643   model                   150000 non-null  int32  4   brand                   150000 non-null  float645   bodyType                150000 non-null  int32  6   fuelType                150000 non-null  int32  7   gearbox                 150000 non-null  int32  8   power                   150000 non-null  float649   kilometer               150000 non-null  float6410  notRepairedDamage       150000 non-null  int32  11  regionCode              150000 non-null  float6412  seller                  150000 non-null  float6413  offerType               150000 non-null  float6414  creatDate               150000 non-null  float6415  price                   150000 non-null  int64  16  v_0                     150000 non-null  float6417  v_1                     150000 non-null  float6418  v_2                     150000 non-null  float6419  v_3                     150000 non-null  float6420  v_4                     150000 non-null  float6421  v_5                     150000 non-null  float6422  v_6                     150000 non-null  float6423  v_7                     150000 non-null  float6424  v_8                     150000 non-null  float6425  v_9                     150000 non-null  float6426  v_10                    150000 non-null  float6427  v_11                    150000 non-null  float6428  v_12                    150000 non-null  float6429  v_13                    150000 non-null  float6430  v_14                    150000 non-null  float6431  city                    150000 non-null  int32  32  used_time               150000 non-null  float6433  brand_amount            150000 non-null  float6434  price_max_GBYbrand      150000 non-null  float6435  price_median_GBYbrand   150000 non-null  float6436  price_min_GBYbrand      150000 non-null  float6437  price_sum_GBYbrand      150000 non-null  float6438  price_std_GBYbrand      150000 non-null  float6439  price_average_GBYbrand  150000 non-null  float6440  power_bin               150000 non-null  float64

# 2.10、数据规范化

catcols2LabelEncoder: 7 ['model', 'bodyType', 'fuelType', 'gearbox', 'notRepairedDamage', 'city', 'power_bin']
LEDict {'model': {'0.0': 0, '1.0': 1, '10.0': 2, '100.0': 3, '101.0': 4, …… '93.0': 241, '94.0': 242, '95.0': 243, '96.0': 244, '97.0': 245, '98.0': 246, '99.0': 247, 'missing': 248}, 
'bodyType': {'0.0': 0, '1.0': 1, '2.0': 2, '3.0': 3, '4.0': 4, '5.0': 5, '6.0': 6, '7.0': 7, 'missing': 8}, 
'fuelType': {'0.0': 0, '1.0': 1, '2.0': 2, '3.0': 3, '4.0': 4, '5.0': 5, '6.0': 6, 'missing': 7}, 
'gearbox': {'0.0': 0, '1.0': 1, 'missing': 2}, 
'notRepairedDamage': {'0.0': 0, '1.0': 1}, 
'city': {'1': 0, '2': 1, '3': 2, '4': 3, '5': 4, '6': 5, '7': 6, '8': 7, 'missing': 8}, 
'power_bin': {'0.0': 0, '1.0': 1, '10.0': 2, '11.0': 3, '12.0': 4, '13.0': 5, '14.0': 6, '15.0': 7, '16.0': 8, '17.0': 9, '18.0': 10, '19.0': 11, '2.0': 12, '20.0': 13, '21.0': 14, '22.0': 15, '23.0': 16, '24.0': 17, '25.0': 18, '26.0': 19, '27.0': 20, '28.0': 21, '29.0': 22, '3.0': 23, '4.0': 24, '5.0': 25, '6.0': 26, '7.0': 27, '8.0': 28, '9.0': 29, 'missing': 30}}

after Encoder NoneSaleID      name  ...  price_average_GBYbrand  power_bin
0       0.000000  0.003740  ...                0.073848          0
1       0.000007  0.011493  ...                0.234956          4
2       0.000013  0.075575  ...                0.251439          3
3       0.000020  0.365145  ...                0.212120          3
4       0.000027  0.564396  ...                0.065144          0
...          ...       ...  ...                     ...        ...
149995  0.999973  0.833171  ...                0.212120          3
149996  0.999980  0.937621  ...                0.100505          2
149997  0.999987  0.749888  ...                0.100505          1
149998  0.999993  0.233253  ...                0.212120          3
149999  1.000000  0.902750  ...                0.135830          3

 # 2.11、定义入模特征

# 2.11.1、删除特征

# 2.11.2、特征筛选

# T2、包裹式wrapper

k_featurenames ('bodyType', 'gearbox', 'kilometer', 'v_0', 'v_3', 'v_7', 'v_14', 'used_time', 'price_average_GBYbrand', 'power_bin')

# T3、嵌入式Embedded(最常用)

LiR_MSE: 15993321.471365392
LiR_R2: 0.7057326262665655
intercept: -480467.6143789641
coef: [('v_5', 547248.1399627327), ('v_6', 517106.21250813385), ('v_7', 497333.878927629), ('v_10', 365570.90980079107), ('v_11', 171543.6146836947), ('v_8', 164227.00112090845), ('v_9', 128578.71403340848), ('power', 48863.6068485829), ('v_4', 43508.82539409367), ('v_14', 19828.850095900943), ('price_average_GBYbrand', 10572.754737316918), ('brand_amount', 6968.85289671065), ('price_median_GBYbrand', 6595.631072990875), ('price_max_GBYbrand', 2237.7971368071658), ('price_std_GBYbrand', 956.376637996673), ('gearbox', 679.4055026736423), ('used_time', 387.4132818355945), ('power_bin', 291.5175148434141), ('bodyType', 217.02045635721151), ('model', -2.4899364779927495), ('city', -10.258028861593232), ('notRepairedDamage', -20.486887939604173), ('fuelType', -24.736780561186862), ('price_min_GBYbrand', -3762.1215956763376), ('kilometer', -4299.815762643461), ('price_sum_GBYbrand', -6953.314648619096), ('v_0', -67643.70870061051), ('v_2', -142475.32076890446), ('v_13', -148508.8116222008), ('v_3', -276643.4143410439), ('v_12', -303764.0882419921), ('v_1', -379287.1351181704)]

# 选取少量样本数据的单个特征分析模型的预测与真实标签的分布差异

# 2.12、导出入模数据集

modelbrandbodyTypefuelTypegearboxpowerkilometernotRepairedDamagepricev_0v_1v_2v_3v_4v_5v_6v_7v_8v_9v_10v_11v_12v_13v_14cityused_timebrand_amountprice_max_GBYbrandprice_median_GBYbrandprice_min_GBYbrandprice_sum_GBYbrandprice_std_GBYbrandprice_average_GBYbrandpower_bin
1720.1538461541000.0031068770.827586207018500.5905958560.7112608580.1923294570.5507837110.492084360.8075569850.6735471730.0922096290.1419007870.4374654510.2920478460.3430372070.3073455830.3234433840.4907156400.4704401140.3243621110.5870297330.0292699720.0020639830.2115945460.1869440950.0738479550
1830.02564102620001036000.6797162450.8205737850.1960590420.5053021850.2628570810.9072744220.7991277040.096609860.1654162890.0923824890.198265750.3140036140.3665407810.1588873190.44670108930.5111670680.4380223060.9989804220.1910812670.0041279670.7340209420.3993065670.2349560974
190.3846153851000.0084403480.827586207062220.7105179940.7850776310.2463266490.3664136220.3008468120.8614712630.7588996380.1175480230.3866686750.121527580.2007620160.3019932890.4770604080.2170504090.41542939710.4701116710.0460423880.4335781010.2599862260.0918472650.0822801250.220633580.2514390073
120.2564102560010.0099937861024000.697206710.7565634260.1880381180.4762849420.1908613880.9398812510.7284399620.0868108680.20768917500.2164250710.2807595890.3890471540.1121157080.39907050580.7704182180.4524800610.9794127640.1532369150.0041279670.6926030090.3820341560.21212013
140.1282051281000.0035211270.310344828052000.6375345830.5446864770.2145326450.3329763480.5905576790.7813771110.4834582550.065398320.4901977840.5455164590.3378343110.2653699680.4500577770.4567124680.55705705450.1579811690.1479457280.2945447430.0464876030.0092879260.0883089580.1263531820.0651439060

三、模型训练与验证

ML之R:通过数据预处理利用LiR/XGBoost等(特征重要性/交叉训练曲线可视化/线性和非线性算法对比/三种模型调参/三种模型融合)实现二手汽车产品交易价格回归预测之详细攻略

https://yunyaniu.blog.csdn.net/article/details/129280091

这篇关于ML之R:通过数据预处理(缺失值/异常值/特殊值的处理/长尾转正态分布/目标log变换/柱形图-箱形图-小提琴图可视化/构造特征/特征筛选+数据降内)利用算法实现二手汽车产品交易价格回归预测之详细攻略的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/421403

相关文章

解决pandas无法读取csv文件数据的问题

《解决pandas无法读取csv文件数据的问题》本文讲述作者用Pandas读取CSV文件时因参数设置不当导致数据错位,通过调整delimiter和on_bad_lines参数最终解决问题,并强调正确参... 目录一、前言二、问题复现1. 问题2. 通过 on_bad_lines=‘warn’ 跳过异常数据3

C语言进阶(预处理命令详解)

《C语言进阶(预处理命令详解)》文章讲解了宏定义规范、头文件包含方式及条件编译应用,强调带参宏需加括号避免计算错误,头文件应声明函数原型以便主函数调用,条件编译通过宏定义控制代码编译,适用于测试与模块... 目录1.宏定义1.1不带参宏1.2带参宏2.头文件的包含2.1头文件中的内容2.2工程结构3.条件编

电脑提示d3dx11_43.dll缺失怎么办? DLL文件丢失的多种修复教程

《电脑提示d3dx11_43.dll缺失怎么办?DLL文件丢失的多种修复教程》在使用电脑玩游戏或运行某些图形处理软件时,有时会遇到系统提示“d3dx11_43.dll缺失”的错误,下面我们就来分享超... 在计算机使用过程中,我们可能会遇到一些错误提示,其中之一就是缺失某个dll文件。其中,d3dx11_4

C#监听txt文档获取新数据方式

《C#监听txt文档获取新数据方式》文章介绍通过监听txt文件获取最新数据,并实现开机自启动、禁用窗口关闭按钮、阻止Ctrl+C中断及防止程序退出等功能,代码整合于主函数中,供参考学习... 目录前言一、监听txt文档增加数据二、其他功能1. 设置开机自启动2. 禁止控制台窗口关闭按钮3. 阻止Ctrl +

java如何实现高并发场景下三级缓存的数据一致性

《java如何实现高并发场景下三级缓存的数据一致性》这篇文章主要为大家详细介绍了java如何实现高并发场景下三级缓存的数据一致性,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 下面代码是一个使用Java和Redisson实现的三级缓存服务,主要功能包括:1.缓存结构:本地缓存:使

在MySQL中实现冷热数据分离的方法及使用场景底层原理解析

《在MySQL中实现冷热数据分离的方法及使用场景底层原理解析》MySQL冷热数据分离通过分表/分区策略、数据归档和索引优化,将频繁访问的热数据与冷数据分开存储,提升查询效率并降低存储成本,适用于高并发... 目录实现冷热数据分离1. 分表策略2. 使用分区表3. 数据归档与迁移在mysql中实现冷热数据分

C#解析JSON数据全攻略指南

《C#解析JSON数据全攻略指南》这篇文章主要为大家详细介绍了使用C#解析JSON数据全攻略指南,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录一、为什么jsON是C#开发必修课?二、四步搞定网络JSON数据1. 获取数据 - HttpClient最佳实践2. 动态解析 - 快速

MyBatis-Plus通用中等、大量数据分批查询和处理方法

《MyBatis-Plus通用中等、大量数据分批查询和处理方法》文章介绍MyBatis-Plus分页查询处理,通过函数式接口与Lambda表达式实现通用逻辑,方法抽象但功能强大,建议扩展分批处理及流式... 目录函数式接口获取分页数据接口数据处理接口通用逻辑工具类使用方法简单查询自定义查询方法总结函数式接口

SQL中如何添加数据(常见方法及示例)

《SQL中如何添加数据(常见方法及示例)》SQL全称为StructuredQueryLanguage,是一种用于管理关系数据库的标准编程语言,下面给大家介绍SQL中如何添加数据,感兴趣的朋友一起看看吧... 目录在mysql中,有多种方法可以添加数据。以下是一些常见的方法及其示例。1. 使用INSERT I

Python使用vllm处理多模态数据的预处理技巧

《Python使用vllm处理多模态数据的预处理技巧》本文深入探讨了在Python环境下使用vLLM处理多模态数据的预处理技巧,我们将从基础概念出发,详细讲解文本、图像、音频等多模态数据的预处理方法,... 目录1. 背景介绍1.1 目的和范围1.2 预期读者1.3 文档结构概述1.4 术语表1.4.1 核