add dump nice to regression demo

This commit is contained in:
tqchen
2014-03-26 16:47:01 -07:00
parent 7d97d6b1d4
commit dc239376c7
4 changed files with 36 additions and 11 deletions

View File

@@ -10,12 +10,23 @@ for l in open( 'machine.data' ):
for i in xrange( 0,6 ):
fo.write( ' %d:%s' %(i,arr[i+2]) )
if arr[0] not in fmap.keys():
if arr[0] not in fmap:
fmap[arr[0]] = cnt
cnt += 1
fo.write( ' %d:1' % fmap[arr[0]] )
fo.write( ' %d:1' % fmap[arr[0]] )
fo.write('\n')
fo.close()
# create feature map for machine data
fo = open('featmap.txt', 'w')
# list from machine.names
names = ['vendor','MYCT', 'MMIN', 'MMAX', 'CACH', 'CHMIN', 'CHMAX', 'PRP', 'ERP' ];
for i in xrange(0,6):
fo.write( '%d\t%s\tint\n' % (i, names[i+1]))
for v, k in sorted( fmap.iteritems(), key = lambda x:x[1] ):
fo.write( '%d\tvendor=%s\ti\n' % (k, v))
fo.close()