Exemplo n.º 1
0
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)
    default="127.0.0.1",
    help="Host IP or domain for the interface; defaults to 127.0.0.1 (localhost).",
)
parser.add_argument(
    "--port", dest="port", type=int, default=7199, help="Host port for the interface; defaults to 7199."
)
# parser.add_argument('-s', '--save', dest = 'save', action = 'store_true', help = 'Save the data to --data_out after transformation (--do). Also available through the interface.')
# todo: extra data transformations (comma-separated python import path)

args = parser.parse_args()

opsstr = raw = config = var_names = transformations = None  # todo: remove

if exists(args.trans):
    try:
        opsstr = load_operations(args.trans)
    except IOError:
        stderr.write('transformation file "{0:s}" couldn\'\t be loaded\n'.format(args.trans))
        exit(1)
    try:
        config, transformations = load_chain(opsstr)
    except ValueError as err:
        stderr.write('there is an error in transformation file "{0:s}" (it should be valid json)\n'.format(args.trans))
        stderr.write("{0:s}\n".format(str(err)))
        exit(2)
else:
    stdout.write('transformation file "{0:s}" doesn\'t exist; using empty transformations\n'.format(args.trans))
    config = {"input_vars": None}
    transformations = OrderedDict()

if args.trans_out is None: