def configure(): cli = CLI() cli.configure('-e', '--execute', 'execute action (correlation|scatter|histogram)', choices=['correlation','scatter','histogram'], default='correlation', required=True, type='string') cli.configure('-d', '--data', 'data input file to use', default=None, required=True, type='string') cli.configure('-D', '--dtype', 'data file type (csv|pickle) to use', choices=['csv','pickle'], default='csv', required=True, type='string') cli.configure('-k', '--key', 'key(s) to use', default=None, required=True, type='string') cli.configure('-r', '--rows', 'row to use', default=None, type='string') cli.configure('-c', '--columns', 'columns to use', default=None, type='string') cli.configure('-f', '--fields', 'field names of columns to use', default=None, type='string') cli.configure('-o', '--output', 'output path for generated output', default=None, type='string') cli.configure('-R', '--randomize', 'Use a random subset of data of specified size', default=None, type='string') cli.configure('-j', '--json', 'save command parameters as JSON for re-execution', default='temp.json', type='string') cli.configure('-x', '--configuration', 'use configuration command parameters for execution', default=None, type='string') args = cli.parse() execArg = args['--execute'] logger.info('Using execute: {0}'.format( execArg ) ) dataArg = args['--data'] logger.info('Using data: {0}'.format( dataArg ) ) dtypeArg = args['--dtype'] logger.info('Using dtype: {0}'.format( dtypeArg ) ) keyArg = args['--key'] logger.info('Using key: {0}'.format( keyArg ) ) rowsArg = args['--rows'] logger.info('Using rows: {0}'.format( rowsArg ) ) colsArg = args['--columns'] logger.info('Using columns: {0}'.format( colsArg ) ) fieldsArg = args['--fields'] logger.info('Using fields: {0}'.format( fieldsArg ) ) outputArg = args['--output'] logger.info('Using output: {0}'.format( outputArg ) ) randomizeArg = args['--randomize'] logger.info('Using randomize: {0}'.format( randomizeArg ) ) jsonArg = args['--json'] logger.info('Using json: {0}'.format( jsonArg ) ) configurationArg = args['--configuration'] logger.info('Using configuration: {0}'.format( configurationArg ) ) if validate(cli) == False: exit(-1) return(execArg, dataArg, dtypeArg, keyArg, rowsArg, colsArg, fieldsArg, outputArg, randomizeArg, jsonArg, configurationArg)
def configure(): cli = CLI() cli.configure('-e', '--execute', 'execute action (classify|gridsearch|crossvalidate)', choices=['classify','gridsearch','crossvalidate'], default='classify', type='string') cli.configure('-c', '--configuration', 'configuration to use', default='./configuration.json', type='string') cli.configure('-m', '--module', 'preprocessor module to use', default=None, type='string') cli.configure('-p', '--prediction', 'execute prediction', default='false', type='string') cli.configure('-o', '--override', 'configuration name:value pair to use (overrides configuration)', default=None, type='string') args = cli.parse() executeArg = args['--execute'] logger.info('Using execute: {0}'.format( executeArg ) ) configurationArg = args['--configuration'] logger.info('Using configuration: {0}'.format( configurationArg ) ) moduleArg = args['--module'] logger.info('Using module: {0}'.format( moduleArg ) ) predictionArg = args['--prediction'] logger.info('Using prediction: {0}'.format( predictionArg ) ) overrideArg = args['--override'] logger.info('Using override: {0}'.format( overrideArg ) ) return(executeArg, configurationArg, moduleArg, predictionArg, overrideArg)