From 117f0fba4749ce7edf8139dd800a4ad51ea96b12 Mon Sep 17 00:00:00 2001 From: "e.calleris" <71027777+Enrico-Call@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:48:29 +0200 Subject: [PATCH] remove debug code --- modcmac_code/utils/utils.py | 3 +-- run_MODCMAC.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modcmac_code/utils/utils.py b/modcmac_code/utils/utils.py index 1ca3a46..b29bafd 100644 --- a/modcmac_code/utils/utils.py +++ b/modcmac_code/utils/utils.py @@ -125,7 +125,7 @@ def generate_proportionally_weighted_states(n_components, start_states, probs, r return np.array(random.choices(start_states, weights=adjusted_weights, k=n_components)) -def weibull_interpolation(P, P_start, ndeterioration, lambda_=92, kappa=2): +def weibull_interpolation(P, P_start, ndeterioration, lambda_=92, kappa=2.5): """ Adjust the transition matrix over time using a Weibull distribution, where the probability of moving to a higher state increases, and the probability of staying in the same state decreases. @@ -178,7 +178,6 @@ def weibull_interpolation(P, P_start, ndeterioration, lambda_=92, kappa=2): P[t] = P_copy - print(list(P[-1].round(3))) return P diff --git a/run_MODCMAC.py b/run_MODCMAC.py index 4688eec..f0ea8a5 100644 --- a/run_MODCMAC.py +++ b/run_MODCMAC.py @@ -33,6 +33,7 @@ def parse_arguments(): parser.add_argument("--device", type=str, default="cpu", help="Device.", choices=["cpu", "cuda", "mps"]) parser.add_argument("--save_folder", type=str, default="./models", help="Folder to save models.") parser.add_argument("--do_eval", action='store_true', help="Flag to do evaluation.") + parser.add_argument('--eval_steps', type=int, default=5, help='Number of evaluation steps to perform.') parser.add_argument("--path_pnet", type=str, default=None, help="Path to policy network.") parser.add_argument("--path_vnet", type=str, default=None, help="Path to value network.") parser.add_argument("--no_log", action="store_false", help="Flag to not log the run") @@ -125,7 +126,7 @@ def signal_handler(sig, frame): agent.train(training_steps=args.num_steps) else: agent.load_model(args.path_pnet, args.path_vnet) - cost_array, risk_array, uti_array, scoring_table = agent.do_eval(5) + cost_array, risk_array, uti_array, scoring_table = agent.do_eval(args.eval_steps) print("Cost: ", np.mean(cost_array)) print("Risk: ", np.mean(risk_array)) print("Utility: ", np.mean(uti_array))