def main(): parser = ArgumentParser() action_parser = parser.add_subparsers(title="actions", dest="action", required=True, help="select action to execute") # args for training train_parser = action_parser.add_parser("train", help="train the classifier") train_parser.add_argument("-r", "--root-dir", dest="root_dir", required=True, help="root directory of the dataset") train_parser.add_argument("-d", "--data-key", dest="data_key", required=True, help="name of the dataset") train_parser.add_argument("-m", "--model-name", dest="model_key", required=True, help="model to be used for training") train_parser.add_argument("-s", "--save-path", dest="save_path", required=True, help="save path for trained model") # args for testing test_parser = action_parser.add_parser("test", help="test the classifier") test_parser.add_argument("-r", "--root-dir", dest="root_dir", required=True, help="root directory of the dataset") test_parser.add_argument("-d", "--data-key", dest="data_key", required=True, help="name of the dataset") test_parser.add_argument("-m", "--model-name", dest="model_key", required=True, help="model to be used for testing") test_parser.add_argument("-s", "--save-path", dest="save_path", required=True, help="save path of the trained model") args_dict = vars(parser.parse_args()) init_logger(args_dict) logging.info(f'User Arguments: {args_dict}!!!') run(**vars(parser.parse_args()))
def main(n: str, compute_qf: str): params = {**RUN_PARAMS} if n is not None: params['GITCOIN_TIMESTEPS'] = n if compute_qf is not None: params['GITCOIN_COMPUTE_QF'] = compute_qf for (key, value) in params.items(): os.environ[key] = value print("Preparing simulation") from model.run import run print("Run simuation") result = run() print(f"Simulation executed! Pickling result to {PICKLE_PATH}") with open(PICKLE_PATH, 'wb') as fid: cloudpickle.dump(result, fid) print("Results pickled sucessfuly")
from model import run # Run training and test run.run()
# In[1]: # Dependences import pandas as pd import numpy as np # Experiments from model import run pd.options.display.float_format = '{:.2f}'.format # get_ipython().run_line_magic('matplotlib', 'inline') # %matplotlib inline # run the simulation df = run.run() # In[ ]: # observe the dataset # In[2]: df.head() # In[ ]: # plot the data # In[3]: