def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('ticker', type=arg_type.ticker) parser.add_argument('cusip', type=arg_type.cusip) parser.add_argument('hpset', type=arg_type.hpset) parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) paths = build.report_compare_models2(arg.ticker, arg.cusip, arg.hpset, test=arg.test) pp(paths) applied_data_science.dirutility.assure_exists(paths['dir_out']) return Bunch( arg=arg, path=paths, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('issuer', type=seven.arg_type.issuer) parser.add_argument('trace_index', type=seven.arg_type.trace_id) parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) path = seven.build.traceinfo_get(arg.issuer, arg.trace_index, test=arg.test) applied_data_science.dirutility.assure_exists(path['dir_out']) return Bunch( arg=arg, path=path, random_seed=random_seed, # timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('issuer', type=seven.arg_type.issuer) parser.add_argument('cusip', type=seven.arg_type.cusip) parser.add_argument('target', type=seven.arg_type.target) parser.add_argument('ensemble_date', type=seven.arg_type.date) parser.add_argument('--debug', action='store_true') parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() if arg.debug: # logging.error() and logging.critial() call pdb.set_trace() instead of raising an exception seven.logging.invoke_pdb = True random_seed = 123 random.seed(random_seed) paths = seven.build.signal(arg.issuer, arg.cusip, arg.target, arg.ensemble_date, test=arg.test) applied_data_science.dirutility.assure_exists(paths['dir_out']) return Bunch( arg=arg, path=paths, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('ticker', type=seven.arg_type.ticker) parser.add_argument('cusip', type=seven.arg_type.cusip) parser.add_argument('hpset', type=seven.arg_type.hpset) parser.add_argument('n', type=seven.arg_type.positive_int) parser.add_argument('--test', action='store_true') parser.add_argument( '--testinput', action='store_true') # read from input directory ending in '-test' parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) paths = seven.build.report05_compare_importances(arg.ticker, arg.cusip, arg.hpset, arg.n, test=arg.test, testinput=arg.testinput) applied_data_science.dirutility.assure_exists(paths['dir_out']) return Bunch( arg=arg, path=paths, max_absolute_error_processed=200.0, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() arg_type = seven.arg_type parser.add_argument('ticker', type=arg_type.ticker) parser.add_argument('cusip', type=arg_type.cusip) parser.add_argument('hpset', type=arg_type.hpset) parser.add_argument('effective_date', type=arg_type.date) parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) doit = Doit(arg.ticker, arg.cusip, arg.hpset, arg.effective_date, test=arg.test) applied_data_science.dirutility.assure_exists(doit.dir_out) return Bunch( arg=arg, doit=doit, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('ticker', type=arg_type.ticker) parser.add_argument('cusip', type=arg_type.cusip) parser.add_argument('hpset', type=arg_type.hpset) parser.add_argument('effective_date', type=arg_type.date) parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) arg.me = parser.prog.split('.')[0] if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) paths = build.fit_predict_reduce(arg.ticker, arg.cusip, arg.hpset, arg.effective_date, test=arg.test) applied_data_science.dirutility.assure_exists(paths['dir_out']) return Bunch( arg=arg, path=paths, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('--analyze', action='store') parser.add_argument('--get', action='store') parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) path = seven.build.buildinfo(test=arg.test) applied_data_science.dirutility.assure_exists(path['dir_out']) return Bunch( arg=arg, path=path, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('issuer', type=seven.arg_type.issuer) parser.add_argument('cusip', type=seven.arg_type.cusip) parser.add_argument('target', type=seven.arg_type.target) parser.add_argument('predicted_event_id', type=seven.arg_type.event_id) parser.add_argument('fitted_event_id', type=seven.arg_type.event_id) parser.add_argument('--debug', action='store_true') parser.add_argument('--cache', action='store_true') parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() if arg.debug: # logging.error() and logging.critial() call pdb.set_trace() instead of raising an exception seven.logging.invoke_pdb = True random_seed = 123 random.seed(random_seed) # the enforcement of the rule the the reclassified trade types of the predicted and fitted # events are the same is done by seven.build.predict(). It raises an exception of they # are not the same. paths = seven.build.predict( arg.issuer, arg.cusip, arg.target, arg.predicted_event_id, arg.fitted_event_id, test=arg.test, ) applied_data_science.dirutility.assure_exists(paths['dir_out']) with open(seven.build.traceinfo(arg.issuer)['out_by_trace_index'], 'rb') as f: traceinfo_by_trade_id = pickle.load(f) return Bunch( arg=arg, path=paths, random_seed=random_seed, timer=Timer(), traceinfo_by_trade_id=traceinfo_by_trade_id, )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('ticker', type=seven.arg_type.ticker) parser.add_argument('cusip', type=seven.arg_type.cusip) parser.add_argument('hpset', type=seven.arg_type.hpset) parser.add_argument('effective_date', type=seven.arg_type.date) parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) paths = seven.build.fit_predict(arg.ticker, arg.cusip, arg.hpset, arg.effective_date, test=arg.test) applied_data_science.dirutility.assure_exists(paths['dir_out']) # delete output files, so that they are rebuilt # the code in function append_to_csv() will extend existing files for logical_name, path_to_file in paths.iteritems(): if logical_name.startswith('out_'): if os.path.isfile(path_to_file): os.remove(path_to_file) model_spec_iterator = ( HpGrids.HpGrid0 if arg.hpset == 'grid0' else HpGrids.HpGrid1 if arg.hpset == 'grid1' else HpGrids.HpGrid2 if arg.hpset == 'grid2' else HpGrids.HpGrid3 if arg.hpset == 'grid3' else None )().iter_model_specs model_specs = [ model_spec for model_spec in model_spec_iterator() ] return Bunch( arg=arg, path=paths, model_specs=model_specs, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('issuer', type=seven.arg_type.issuer) parser.add_argument('cusip', type=seven.arg_type.cusip) parser.add_argument('effective_date', type=seven.arg_type.date) parser.add_argument('--analyze_trace', action='store_true') parser.add_argument('--cache', action='store_true') parser.add_argument('--debug', action='store_true') parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() if arg.debug: # logging.error() and logging.critial() call pdb.set_trace() instead of raising an exception seven.logging.invoke_pdb = True random_seed = 123 random.seed(random_seed) paths = seven.build.features_targets(arg.issuer, arg.cusip, arg.effective_date, test=arg.test) applied_data_science.dirutility.assure_exists(paths['dir_out']) # start building the history of trace prints from trace prints 100 calendar days prior to the effective date first_relevant_trace_print_date = Date( from_yyyy_mm_dd=arg.effective_date).value - datetime.timedelta(100) timer = Timer() return Bunch( arg=arg, first_relevant_trace_print_date=first_relevant_trace_print_date, module='features_targets.py', path=paths, random_seed=random_seed, timer=timer, )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) arg.me = parser.prog.split('.')[0] if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) doit = Doit(test=arg.test) applied_data_science.dirutility.assure_exists(doit.out_dir) return Bunch( arg=arg, doit=doit, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('ticker', type=arg_type.ticker) parser.add_argument('cusip', type=arg_type.cusip) parser.add_argument('hpset', type=arg_type.hpset) parser.add_argument('effective_date', type=arg_type.date) parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) paths = build.fit_predict2(arg.ticker, arg.cusip, arg.hpset, arg.effective_date, test=arg.test) applied_data_science.dirutility.assure_exists(paths['dir_out']) model_spec_iterator = ( HpGrids.HpGrid0 if arg.hpset == 'grid0' else HpGrids.HpGrid1 if arg.hpset == 'grid1' else HpGrids.HpGrid2 if arg.hpset == 'grid2' else None)().iter_model_specs model_specs = [model_spec for model_spec in model_spec_iterator()] return Bunch( arg=arg, path=paths, model_specs=model_specs, random_seed=random_seed, timer=Timer(), )
def make_control(argv): 'return a Bunch' parser = argparse.ArgumentParser() parser.add_argument('ticker', type=seven.arg_type.ticker) parser.add_argument('cusip', type=seven.arg_type.cusip) parser.add_argument('hpset', type=seven.arg_type.hpset) parser.add_argument('--test', action='store_true') parser.add_argument( '--testinput', action='store_true') # read from input directory ending in '-test' parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) paths = seven.build.report04_predictions(arg.ticker, arg.cusip, arg.hpset, test=arg.test, testinput=arg.testinput) pp(paths) if len(paths['in_predictions']) == 0: print arg print 'no predictions found' sys.exit(1) applied_data_science.dirutility.assure_exists(paths['dir_out']) return Bunch( arg=arg, path=paths, random_seed=random_seed, timer=Timer(), )
def make_control(argv): parser = argparse.ArgumentParser() parser.add_argument('ticker') parser.add_argument('--test', action='store_true') parser.add_argument('--trace', action='store_true') arg = parser.parse_args(argv[1:]) # ignore invocation name if arg.trace: pdb.set_trace() random_seed = 123 random.seed(random_seed) # put all output in directory paths = seven.build.cusips(arg.ticker, test=arg.test) applied_data_science.dirutility.assure_exists(paths['dir_out']) return Bunch( arg=arg, path=paths, random_seed=random_seed, test=arg.test, timer=Timer(), )