日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

task2 EDA探索性数据分析

發(fā)布時間:2025/3/11 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 task2 EDA探索性数据分析 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.








1、賽題數(shù)據(jù)

賽題以預(yù)測二手車的交易價格為任務(wù),數(shù)據(jù)集報名后可見并可下載,該數(shù)據(jù)來自某交易平臺的二手車交易記錄,總數(shù)據(jù)量超過40w,包含31列變量信息,其中15列為匿名變量。為了保證比賽的公平性,將會從中抽取15萬條作為訓(xùn)練集,5萬條作為測試集A,5萬條作為測試集B,同時會對name、model、brand和regionCode等信息進行脫敏

2、評測標準

評價標準為MAE(Mean Absolute Error)。

MAE越小,說明模型預(yù)測得越準確。
賽事官網(wǎng):
零基礎(chǔ)入門數(shù)據(jù)挖掘 - 二手車交易價格預(yù)測

3、具體步驟

3.1、環(huán)境:pycharm + python3

3.2、讀取數(shù)據(jù)

下面展示一些 內(nèi)聯(lián)代碼片。

// An highlighted block var foo = 'bar'; #讀取數(shù)據(jù)并#切分數(shù)據(jù)dataset = pd.read_csv(r'C:\python3\envs\pytorch\atest_torch\data\used_car_train_20200313.csv', sep=' ')# print(dataset)# print(dataset.columns.values)X = dataset[['SaleID', 'name', 'regDate', 'model', 'brand', 'bodyType', 'fuelType', 'gearbox', 'power', 'kilometer','notRepairedDamage', 'regionCode', 'seller', 'offerType', 'creatDate', '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']]Y = dataset['price']
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

#需要注意:因為該csv文件數(shù)據(jù)是按一個空格隔開的,在讀取時需要用sep=’ '來分割開來。

3.2.2查看各列數(shù)據(jù)類型

#查看各列數(shù)據(jù)類型 print([X[column].dtypes for column in X])
  • 1
  • 2

發(fā)現(xiàn)notRepairedDamage數(shù)據(jù)存在異常,該特征為汽車有尚未修復(fù)的損壞:是:0,否:1。

我將“-”進行缺失值處理,賦值為0.5

更新時間:2020年3月17日

3.3拆分數(shù)據(jù)集與測試集

X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.33, random_state=7)
  • 1

3.4xgboost構(gòu)建模型

</div><link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-b6c3c6d139.css" rel="stylesheet"><div class="more-toolbox"><div class="left-toolbox"><ul class="toolbox-list"><li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true"><use xlink:href="#csdnc-thumbsup"></use></svg><span class="name">點贊</span><span class="count"></span></a></li><li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-csdnc-Collection-G"></use></svg><span class="name">收藏</span></a></li><li class="tool-item tool-active is-share"><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;1582594662_002&quot;}"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-csdnc-fenxiang"></use></svg>分享</a></li><!--打賞開始--><!--打賞結(jié)束--><li class="tool-item tool-more"><a><svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg></a><ul class="more-box"><li class="item"><a class="article-report">文章舉報</a></li></ul></li></ul></div></div><div class="person-messagebox"><div class="left-message"><a href="https://blog.csdn.net/zxxmx"><img src="https://profile.csdnimg.cn/D/A/8/3_zxxmx" class="avatar_pic" username="zxxmx"><img src="https://g.csdnimg.cn/static/user-reg-year/1x/2.png" class="user-years"></a></div><div class="middle-message"><div class="title"><span class="tit"><a href="https://blog.csdn.net/zxxmx" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">zxxmx</a></span></div><div class="text"><span>發(fā)布了1 篇原創(chuàng)文章</span> · <span>獲贊 0</span> · <span>訪問量 105</span></div></div><div class="right-message"><a href="https://im.csdn.net/im/main.html?userName=zxxmx" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信</a><a class="btn btn-sm bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">關(guān)注</a></div></div></div>

總結(jié)

以上是生活随笔為你收集整理的task2 EDA探索性数据分析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。