def test_load_chain(): config, ops = load_chain(load_operations('test/test01.json')) data = load('test/demo_data_100x3.npy') rows = [row for row in data] ops = train_transforms(ops, rows) data = apply_transforms(ops, rows)
args.data_out = "{0:s}.npy".format(nm) stdout.write('no output file given; using "{0:s}"\n'.format(args.data_out)) # todo: maybe check write permissions for the output file if one is specified, but it's a bit of a pain without creating/purging the file if not args.learn and not args.do and not args.interface: stdout.write( "no operations requested and no interface opened; nothing to do (see --help, specifically --interface and --learn/--do)\n" ) exit(0) columns = get_cols(raw, var_names) del raw if args.learn: stdout.write("learning parameters for transformations from {0:d} columns\n".format(len(columns))) transformations = train_transforms(transformations, columns) stdout.write('saving transformations to "{0:s}"\n'.format(args.trans_out)) opsstr = save_chain(config, transformations) save_operations(opsstr, args.trans_out) if args.do: stdout.write("applying transformations to {0:d} columns\n".format(len(columns))) columns = apply_transforms(transformations, columns) stdout.write('saving transformed data to "{0:s}"\n'.format(args.data_out)) data, names = get_array(columns) numpy_save(args.data_out, data) if args.interface: run_server(args.host, args.port) stdout.write("done\n")