Browse Source

[july] s2/s4 support 24 model's weight

master
sipp11 11 years ago
parent
commit
8408faf11f
  1. 9
      s2.py
  2. 3
      s4.py

9
s2.py

@ -112,7 +112,8 @@ def produce_part3(sum_result, lo_weight):
lo_xmodels = lo_xmodels.union(set(sum_result[i]))
lo_xmodels = sorted(list(lo_xmodels))
for l in lo_xmodels:
lo_sum = [0, 0, 0, 0, 0, 0]
## build container to store sum of all weight
lo_sum = [0 for k in xrange(0, 25)]
if l not in lo_weight:
continue
for i in ii:
@ -120,7 +121,7 @@ def produce_part3(sum_result, lo_weight):
continue
lo_sum = [
float(x) + float(y) for x, y
in zip(lo_weight[l][i], lo_sum)]
in zip(lo_weight[l][i][9:], lo_sum)]
rows.append([l] + lo_sum)
_f = '%s-3.csv' % ii
@ -131,8 +132,8 @@ def main(*argv):
_r = process_s2_data()
_lw = process_lo_weight()
produce_s2_part1(_r['sum'])
# produce_s2_part2(_r['rank'])
# produce_part3(_r['sum'], _lw)
produce_s2_part2(_r['rank'])
produce_part3(_r['sum'], _lw)
if __name__ == '__main__':

3
s4.py

@ -36,7 +36,8 @@ def get_weight(xmodel):
with open(fpath, 'rb') as f:
rows = csv.reader(f)
for r in rows:
result[r[0]] = [r[1], r[2], r[3], r[4], r[5], r[6]]
# result[r[0]] = [r[1], r[2], r[3], r[4], r[5], r[6]]
result[r[0]] = [r[k] for k in xrange(1, 26)]
return result

Loading…
Cancel
Save