資源簡介
由于xgboost的作者在github上刪除了xgboost在windows系統(tǒng)下的目錄文件,所以導(dǎo)致大家無法安裝xgboost。本人通過親自實(shí)踐,教大家一步步在win下安裝xgboost,這個(gè)是之前的xgboost的C++版本,是在python使用xgboost之前必須的包。

代碼片段和文件信息
#!/usr/bin/python
def?loadfmap(?fname?):
????fmap?=?{}
????nmap?=?{}
????for?l?in?open(?fname?):
????????arr?=?l.split()
????????if?arr[0].find(‘.‘)?!=?-1:
????????????idx?=?int(?arr[0].strip(‘.‘)?)
????????????assert?idx?not?in?fmap
????????????fmap[?idx?]?=?{}
????????????ftype?=?arr[1].strip(‘:‘)
????????????content?=?arr[2]
????????else:
????????????content?=?arr[0]
????????for?it?in?content.split(‘‘):
????????????if?it.strip()?==?‘‘:
????????????????continue
????????????k??v?=?it.split(‘=‘)
????????????fmap[?idx?][?v?]?=?len(nmap)
????????????nmap[?len(nmap)?]?=?ftype+‘=‘+k
????return?fmap?nmap
def?write_nmap(?fo?nmap?):
????for?i?in?range(?len(nmap)?):
????????fo.write(‘%d\t%s\ti\n‘?%?(i?nmap[i])?)
#?start?here
fmap?nmap?=?loadfmap(?‘a(chǎn)garicus-lepiota.fmap‘?)
fo?=?open(?‘featmap.txt‘?‘w‘?)
write_nmap(?fo?nmap?)
fo.close()
fo?=?open(?‘a(chǎn)garicus.txt‘?‘w‘?)
for?l?in?open(?‘a(chǎn)garicus-lepiota.data‘?):
????arr?=?l.split(‘‘)
????if?arr[0]?==?‘p‘:
????????fo.write(‘1‘)
????else:
????????assert?arr[0]?==?‘e‘
????????fo.write(‘0‘)
????for?i?in?range(?1len(arr)?):
????????fo.write(?‘?%d:1‘?%?fmap[i][arr[i].strip()]?)
????fo.write(‘\n‘)
fo.close()
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-12-08?20:45??xgboost-master\
?????文件?????????681??2015-12-08?20:45??xgboost-master\.gitignore
?????文件????????1064??2015-12-08?20:45??xgboost-master\.travis.yml
?????文件????????2085??2015-12-08?20:45??xgboost-master\CHANGES.md
?????文件????????3443??2015-12-08?20:45??xgboost-master\CONTRIBUTORS.md
?????文件?????????564??2015-12-08?20:45??xgboost-master\LICENSE
?????文件????????5920??2015-12-08?20:45??xgboost-master\Makefile
?????目錄???????????0??2015-12-08?20:45??xgboost-master\R-package\
?????文件??????????56??2015-12-08?20:45??xgboost-master\R-package\.Rbuildignore
?????文件????????1340??2015-12-08?20:45??xgboost-master\R-package\DEsc
?????文件?????????580??2015-12-08?20:45??xgboost-master\R-package\LICENSE
?????文件????????1239??2015-12-08?20:45??xgboost-master\R-package\NAMESPACE
?????目錄???????????0??2015-12-08?20:45??xgboost-master\R-package\R\
?????文件????????1853??2015-12-08?20:45??xgboost-master\R-package\R\getinfo.xgb.DMatrix.R
?????文件?????????530??2015-12-08?20:45??xgboost-master\R-package\R\nrow.xgb.DMatrix.R
?????文件????????3190??2015-12-08?20:45??xgboost-master\R-package\R\predict.xgb.Booster.R
?????文件?????????553??2015-12-08?20:45??xgboost-master\R-package\R\predict.xgb.Booster.handle.R
?????文件????????1155??2015-12-08?20:45??xgboost-master\R-package\R\setinfo.xgb.DMatrix.R
?????文件????????1477??2015-12-08?20:45??xgboost-master\R-package\R\slice.xgb.DMatrix.R
?????文件???????11951??2015-12-08?20:45??xgboost-master\R-package\R\utils.R
?????文件????????1655??2015-12-08?20:45??xgboost-master\R-package\R\xgb.DMatrix.R
?????文件?????????795??2015-12-08?20:45??xgboost-master\R-package\R\xgb.DMatrix.save.R
?????文件????????4198??2015-12-08?20:45??xgboost-master\R-package\R\xgb.create.features.R
?????文件???????11244??2015-12-08?20:45??xgboost-master\R-package\R\xgb.cv.R
?????文件????????2971??2015-12-08?20:45??xgboost-master\R-package\R\xgb.dump.R
?????文件????????7437??2015-12-08?20:45??xgboost-master\R-package\R\xgb.importance.R
?????文件?????????976??2015-12-08?20:45??xgboost-master\R-package\R\xgb.load.R
?????文件????????7324??2015-12-08?20:45??xgboost-master\R-package\R\xgb.model.dt.tree.R
?????文件????????5572??2015-12-08?20:45??xgboost-master\R-package\R\xgb.plot.deepness.R
?????文件????????3976??2015-12-08?20:45??xgboost-master\R-package\R\xgb.plot.importance.R
?????文件????????5435??2015-12-08?20:45??xgboost-master\R-package\R\xgb.plot.multi.trees.R
............此處省略451個(gè)文件信息
評論
共有 條評論