finish mushroom
This commit is contained in:
21
demo/mushroom/maptree.py
Executable file
21
demo/mushroom/maptree.py
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
def loadnmap( fname ):
|
||||
nmap = {}
|
||||
for l in open(fname):
|
||||
arr = l.split()
|
||||
nmap[int(arr[0])] = arr[1].strip()
|
||||
return nmap
|
||||
|
||||
fo = sys.stdout
|
||||
nmap = loadnmap( 'featname.txt' )
|
||||
for l in open( 'dump.txt'):
|
||||
idx = l.find('[f')
|
||||
if idx == -1:
|
||||
fo.write(l)
|
||||
else:
|
||||
fid = int( l[idx+2:len(l)].split('>')[0])
|
||||
rl = l[0:idx]+'['+nmap[fid]+']' + l.split()[1].strip()+'\n'
|
||||
fo.write(rl)
|
||||
|
||||
@@ -2,3 +2,5 @@
|
||||
python mapfeat.py
|
||||
python mknfold.py agaricus.txt 1
|
||||
../../xgboost mushroom.conf
|
||||
../../xgboost mushroom.conf task=dump model_in=0003.model
|
||||
python maptree.py
|
||||
|
||||
Reference in New Issue
Block a user