def main(): args = getArgs() if args.seed is None: seed = random.randrange(sys.maxsize) args.seed = seed print(f"generating new random seed: {seed}") else: print(f"setting random seed to: {args.seed}") random.seed(args.seed) datasetlist = args.datasets print(f"doing experiment with {datasetlist} in that order") k = args.kfold results = {} runlist = args.methods set_keras_growth(args.gpu) prefix = "runner" if args.prefix is not None: prefix = args.prefix rootpath = prefix + datetime.now().strftime('%Y_%m_%d_%H_%M_%S') createdir(rootpath) min_retain_losses = list() min_losses = list() writejson(f"{rootpath}/settings.json", sys.argv[1:]) if args.callbacks is not None: callbacks = args.callbacks else: callbacks = list() alphalist = [0.8] nresults = list() for i in range(0, args.n): nresults.append( runalldatasets(args, callbacks, datasetlist, rootpath, runlist, alphalist=alphalist, n=i, printcvresults=args.cvsummary, printcv=args.printcv, doevaluation=args.doevaluation, learning_rate=args.learning_rate)) writejson(f"{rootpath}/data.json", nresults) resdf = pd.DataFrame(nresults) resdf.to_csv( f"{rootpath}/results_{args.kfold}kfold_{args.epochs}epochs_{args.onehot}onehot.csv" )
def main(mpirank, mpisize, mpicomm): args = getArgs() if args.seed is None: seed = random.randrange(sys.maxsize) args.seed = seed print(f"generating new random seed:{seed}") random.seed(args.seed) datasetlist = args.datasets k = args.kfold results = {} runlist = args.methods if "," in args.gpu: gpus = args.gpu.split(",") mygpu = gpus[mpirank % 2] set_keras_growth(int(mygpu)) else: set_keras_growth(args.gpu) dataset_results = dict() prefix = "runner" if args.prefix is not None: prefix = args.prefix rootpath = prefix + datetime.now().strftime('%Y_%m_%d_%H_%M_%S') if mpirank == 0: createdir(rootpath) writejson(f"{rootpath}/settings.json", sys.argv[1:]) min_retain_losses = list() min_losses = list() datasetsdone = list() if args.callbacks is not None: callbacks = args.callbacks else: callbacks = list() nresults = list() alphalist = [ 0.8 ] # this code does not iterate over alpha, see mpi_deesweighting.py for i in range(0, args.n): dataset_results = runalldatasetsMPI(args, callbacks, datasetlist, mpicomm, mpirank, rootpath, runlist, alphalist, n=i, printcvresults=args.cvsummary, printcv=args.printcv, doevaluation=args.doevaluation) nresults.append(dataset_results) if mpirank == 0: writejson(f"{rootpath}/data.json", nresults) resdf = pd.DataFrame(results) resdf.to_csv( f"{rootpath}/results_{args.kfold}kfold_{args.epochs}epochs_{args.onehot}onehot.csv" )
def main(mpirank, mpisize, mpicomm): args = getArgs() if args.seed is not None: random.seed(args.seed) datasetlist = args.datasets print(f"doing experiment with {datasetlist} in that order") k = args.kfold results = {} runlist = args.methods if "," in args.gpu: gpus = args.gpu.split(",") mygpu = gpus[mpirank % 2] set_keras_growth(int(mygpu)) else: set_keras_growth(args.gpu) dataset_results = dict() prefix = "runner" if args.prefix is not None: prefix = args.prefix rootpath = prefix + datetime.now().strftime('%Y_%m_%d_%H_%M_%S') if mpirank == 0: createdir(rootpath) writejson(f"{rootpath}/settings.json", vars(args)) min_retain_losses = list() min_losses = list() if args.alpharange is not None: splits = args.alpharange.split(":") alphastart = float(splits[0]) alphastop = float(splits[1]) alpharange = np.linspace(alphastart, alphastop, args.alphacount) else: alpharange = np.linspace(0.000001, 1.00001, args.alphacount) datasetsdone = list() if args.callbacks is not None: callbacks = args.callbacks else: callbacks = list() nresults = list() for i in range(0, args.n): dataset_results = runalldatasetsMPI(args, callbacks, datasetlist, mpicomm, mpirank, rootpath, runlist, alpharange, n=i, printcvresults=args.cvsummary, printcv=args.printcv) nresults.append(dataset_results) if mpirank == 0: # plotNAlphaResults(datasetlist, nresults, rootpath) writejson(f"{rootpath}/data.json", nresults) resdf = pd.DataFrame(results) resdf.to_csv( f"{rootpath}/results_{args.kfold}kfold_{args.epochs}epochs_{args.onehot}onehot.csv" )