Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions experiments/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

import argparse
import os
import json
from .utils import algo_dict, load_from_json, system_dict, challenge_dicts
from .main import load_data, run_challenge, make_plots, save_config, prGreen, prPink
from dynadojo.challenges import FixedError, FixedComplexity, FixedTrainSize
Expand All @@ -64,6 +65,7 @@
plot_parser = subparsers.add_parser('plot', help='Plot an experiment results')
check_parser = subparsers.add_parser('check', help='Check for missing jobs')
scale_parser = subparsers.add_parser('scale', help='Temporary utility which rescales losses by dimensionality')
status_parser =subparsers.add_parser('status', help='List all available config.json files that you have already made')

# Accept command line arguments
make_parser.add_argument('--algo', type=str, default='lr', help='Specify which algo to run')
Expand Down Expand Up @@ -207,3 +209,32 @@
# save the new data as csv file in data_dir
data.to_csv(args.data_dir + "/data.csv", index=False)
prGreen(f"Rescaled data saved to {args.data_dir}/data.csv")
elif args.command == 'status':
experiment_list = [] #all the config.json files in the outputs folder

#Loop and sort into dict but type (e.g. fixed complexity, fixed error, etc)
experiment_dict = {}

directory_path = 'experiments/outputs'

#Find all 'config.json' files, add filepath to a list
for dirpath, dirnames, filenames in os.walk(directory_path):
for file in filenames:
if file.endswith('config.json'):
f = open(dirpath+'/'+file,'r')
experiment = json.load(f)
experiment_type = experiment['challenge_cls']['class_name']

if experiment_type in experiment_dict.keys():
experiment_dict[experiment_type].append({'total_jobs' : experiment['total_jobs'], 'complete_jobs' : 0, 'folder_path': dirpath+'/'+file})
else:
experiment_dict[experiment['challenge_cls']['class_name']] = [{'total_jobs' : experiment['total_jobs'], 'complete_jobs' : 0, 'folder_path': dirpath+'/'+file}]


#Print
for challenge_type in experiment_dict.keys():
print(challenge_type+':')

#Print Paths
for path in experiment_dict[challenge_type]:
print(' '+path['folder_path'], path['complete_jobs'], '/', path['total_jobs'],'Jobs')
10 changes: 9 additions & 1 deletion experiments/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,12 @@ def prGreen(skk): print("\033[92m{}\033[00m" .format(skk))

def prCyan(skk): print("\033[96m{}\033[00m" .format(skk))

def prPink(skk): print("\033[95m{}\033[00m" .format(skk))
def prPink(skk): print("\033[95m{}\033[00m" .format(skk))

#Helper function for status bar:
def loadingBar(num_complete : int, num_total : int, length : int, color : str = '\033[32m') -> str:
#Colors:
RESET = '\033[0m'

num_status = int(((num_complete/num_total)*length)//1)
return (color+'━'*num_status + RESET + '━'*(length-num_status))