コード例 #1
0
ファイル: whiten.py プロジェクト: godsonhenry/NBA-Hackathon-2
                  '--skip',
                  default=[],
                  action='append',
                  type='string',
                  help='do NOT whiten these cols')

opts, args = parser.parse_args()

assert len(args) == 1, 'please supply exactly 1 input argument\n%s' % usage
pklNAME = args[0]

#-------------------------------------------------

### read data
h, d, kwargs = parseData.load_data(pklNAME,
                                   verbose=opts.verbose,
                                   timing=opts.time)

### whiten data
if opts.method == "zeroMean":
    d = whitenData.zeroMean_whiten(h, d, skip=opts.skip)
elif opts.method == "minMax":
    d = whitenData.minMax_whiten(h, d, skip=opts.skip)
else:
    raise ValueError('--method=%s not understood' % opts.method)

### write data
pklOUT = pklNAME[:-4] + "_%s.pkl" % (opts.method)
parseData.write_data(h,
                     d,
                     pklOUT,
コード例 #2
0
assert len(args) == 3, 'please supply exactly 3 input arguments\n%s' % usage
costFooKey, pklTRAIN, pklPREDICT = args

opts.exclude.append(costFooKey)  ### always exclude costFooKey!

opts.verbose = opts.verbose or opts.Verbose or opts.time

if opts.tag:
    opts.tag = "_" + opts.tag

#-------------------------------------------------

### read in training data
h, d, kw = parseData.load_data(pklTRAIN,
                               verbose=opts.verbose,
                               timing=opts.time)

### extract cost function data
if opts.verbose:
    print "extracting costFooKey=%s" % costFooKey
assert np.sum(
    h == costFooKey
) == 1, 'could not find a unique column matching costFooKey=%s' % costFooKey
costFoo = d[:, h == costFooKey].ravel()

### exclude variables
hsub, dsub = parseData.excludeCols(h,
                                   d,
                                   opts.exclude,
                                   verbose=opts.verbose,
コード例 #3
0
                  default=False,
                  action='store_true',
                  help='print how long important steps take')

opts, args = parser.parse_args()

#-----------

assert len(args) == 3, 'please supply exactly 3 input arguments\n%s' % usage
pklSHOT, pklPLYR, pklOUT = args

#-------------------------------------------------

### read player data
hplyr, dplyr, kwplyr = parseData.load_data(pklPLYR,
                                           verbose=opts.verbose,
                                           timing=opts.time)

### read in shot data
hshot, dshot, kwshot = parseData.load_data(pklSHOT,
                                           verbose=opts.verbose,
                                           timing=opts.time)

#-------------------------------------------------

### stich together data!
h, d = parseData.map_data(hplyr,
                          dplyr,
                          hshot,
                          dshot,
                          verbose=opts.verbose,
コード例 #4
0
#-------------------------------------------------

parser = OptionParser(usage=usage, description=description)

parser.add_option('-v', '--verbose', default=False, action='store_true')
parser.add_option('-t',
                  '--time',
                  default=False,
                  action='store_true',
                  help='print how long important steps take')

opts, args = parser.parse_args()

assert len(args) == 2, 'please supply exactly 2 input arguments\n%s' % usage
pklDATA, pklBOOL = args

#-------------------------------------------------

### load header data
h, _, _ = parseData.load_data(pklDATA, verbose=opts.verbose, timing=opts.time)

### load bool data
b = parseData.load_bool(pklBOOL, verbose=opts.verbose, timing=opts.time)

### print command line
s = ""
for keep in h[b]:
    s += " -e \"%s\"" % keep

print s