optimization (minor)

This commit is contained in:
Steve Nyemba 2021-03-30 09:00:57 -05:00
parent 0ef149f76b
commit 9bbe9b7ff9
1 changed files with 5 additions and 5 deletions

View File

@ -197,17 +197,17 @@ def generate(**_args):
f = open(os.sep.join([_args['logs'],'output',_args['context'],'map.json'])) f = open(os.sep.join([_args['logs'],'output',_args['context'],'map.json']))
_map = json.loads(f.read()) _map = json.loads(f.read())
f.close() f.close()
if 'file' in _args : # if 'file' in _args :
df = pd.read_csv(_args['file']) # df = pd.read_csv(_args['file'])
else: # else:
df = _args['data'] if not isinstance(_args['data'],str) else pd.read_csv(_args['data']) # df = _args['data'] if not isinstance(_args['data'],str) else pd.read_csv(_args['data'])
args = {"context":_args['context'],"max_epochs":_args['max_epochs'],"candidates":_args['candidates']} args = {"context":_args['context'],"max_epochs":_args['max_epochs'],"candidates":_args['candidates']}
args['logs'] = _args['logs'] if 'logs' in _args else 'logs' args['logs'] = _args['logs'] if 'logs' in _args else 'logs'
args ['max_epochs'] = _args['max_epochs'] args ['max_epochs'] = _args['max_epochs']
# args['matrix_size'] = _matrix.shape[0] # args['matrix_size'] = _matrix.shape[0]
args['batch_size'] = 2000 args['batch_size'] = 2000
args['partition'] = 0 if 'partition' not in _args else _args['partition'] args['partition'] = 0 if 'partition' not in _args else _args['partition']
args['row_count'] = df.shape[0] args['row_count'] = _args['data'].shape[0]
# #
# @TODO: perhaps get the space of values here ... (not sure it's a good idea) # @TODO: perhaps get the space of values here ... (not sure it's a good idea)
# #