• 大小: 23.66MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-06
  • 语言: C/C++
  • 标签: xgboost  

资源简介

本人通过亲自实践,教大家一步步在win下安装xgboost(http://blog.csdn.net/jingyi130705008/article/details/71435562),这个是之前的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( ‘agaricus-lepiota.fmap‘ )
fo = open( ‘featmap.txt‘ ‘w‘ )
write_nmap( fo nmap )
fo.close()

fo = open( ‘agaricus.txt‘ ‘w‘ )
for l in open( ‘agaricus-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()



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-05-08 16:20  xgboost-master\
     文件         681  2015-12-09 04:45  xgboost-master\.gitignore
     文件        1064  2015-12-09 04:45  xgboost-master\.travis.yml
     文件        2085  2015-12-09 04:45  xgboost-master\CHANGES.md
     文件        3443  2015-12-09 04:45  xgboost-master\CONTRIBUTORS.md
     文件         564  2015-12-09 04:45  xgboost-master\LICENSE
     文件        5920  2015-12-09 04:45  xgboost-master\Makefile
     目录           0  2017-05-08 16:20  xgboost-master\R-package\
     文件          56  2015-12-09 04:45  xgboost-master\R-package\.Rbuildignore
     文件        1340  2015-12-09 04:45  xgboost-master\R-package\DEscriptION
     文件         580  2015-12-09 04:45  xgboost-master\R-package\LICENSE
     文件        1239  2015-12-09 04:45  xgboost-master\R-package\NAMESPACE
     目录           0  2017-05-08 16:20  xgboost-master\R-package\R\
     文件        1853  2015-12-09 04:45  xgboost-master\R-package\R\getinfo.xgb.DMatrix.R
     文件         530  2015-12-09 04:45  xgboost-master\R-package\R\nrow.xgb.DMatrix.R
     文件        3190  2015-12-09 04:45  xgboost-master\R-package\R\predict.xgb.Booster.R
     文件         553  2015-12-09 04:45  xgboost-master\R-package\R\predict.xgb.Booster.handle.R
     文件        1155  2015-12-09 04:45  xgboost-master\R-package\R\setinfo.xgb.DMatrix.R
     文件        1477  2015-12-09 04:45  xgboost-master\R-package\R\slice.xgb.DMatrix.R
     文件       11951  2015-12-09 04:45  xgboost-master\R-package\R\utils.R
     文件        1655  2015-12-09 04:45  xgboost-master\R-package\R\xgb.DMatrix.R
     文件         795  2015-12-09 04:45  xgboost-master\R-package\R\xgb.DMatrix.save.R
     文件        4198  2015-12-09 04:45  xgboost-master\R-package\R\xgb.create.features.R
     文件       11244  2015-12-09 04:45  xgboost-master\R-package\R\xgb.cv.R
     文件        2971  2015-12-09 04:45  xgboost-master\R-package\R\xgb.dump.R
     文件        7437  2015-12-09 04:45  xgboost-master\R-package\R\xgb.importance.R
     文件         976  2015-12-09 04:45  xgboost-master\R-package\R\xgb.load.R
     文件        7324  2015-12-09 04:45  xgboost-master\R-package\R\xgb.model.dt.tree.R
     文件        5572  2015-12-09 04:45  xgboost-master\R-package\R\xgb.plot.deepness.R
     文件        3976  2015-12-09 04:45  xgboost-master\R-package\R\xgb.plot.importance.R
     文件        5435  2015-12-09 04:45  xgboost-master\R-package\R\xgb.plot.multi.trees.R
............此处省略560个文件信息

评论

共有 条评论