-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyperparameter Optimization Module #164
Open
middleyuan
wants to merge
135
commits into
utiasDSL:main
Choose a base branch
from
middleyuan:hpo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 129 commits
Commits
Show all changes
135 commits
Select commit
Hold shift + click to select a range
8d3be23
1. bug fixed. 2. kernel extension. 3. batch GP implementatoin.
middleyuan 7f0e3ff
update dependencies
middleyuan cf3d4e8
explicitliy import scipy.linalg
middleyuan 359eecc
add cartpole configs for gpmpc
middleyuan 89a29b8
add hyperparameter optimization module
middleyuan 9e2a7ef
catch all the exception in hpo for debugging purpose.
middleyuan 27454da
put cartpole configs for gpmpc under the folder of gpmpc
middleyuan 17e408b
add hpo scripts
middleyuan bb4e1b0
1. include pandas 2. change rel import in gpmpc_experiment.py 3. remo…
middleyuan 14a6db1
rename config to match default algo name.
middleyuan e6a2e3d
remove old configs
middleyuan 0484388
add tests
middleyuan 84830df
edit bash file with correct arg name
middleyuan e69e048
add another host in gpmpc_hpo.sh
middleyuan 097e1c2
change to new dir in gpmpc_hpo.sh
middleyuan 405dcea
1. fix a small bug 2. add test_train_gpmpc_cartpole
middleyuan 549ff3e
add a hpo parallelism test
middleyuan 81b5602
saving before runing hpo
middleyuan a5ad5f2
I think the bug is that it reaches thee goal in the first step.
middleyuan ce4d75e
1. PPO configs. 2. Make cartpole init states harder. 3. First version…
middleyuan b40566c
Re-organize a bit (file name, remove __init__.py in test folders).
middleyuan 23f571d
1. HPO strategies. 2. test on hpo for ppo. 3. another way to save che…
middleyuan 802edb6
update gitignore
middleyuan 02d1c33
change configs
middleyuan 20d3a7f
update bash for hpo on gpmpc
middleyuan ad96f6f
add prior arg in gpmpc_sampler
middleyuan 5318c25
1. HPO effort evaluations. 2. Bash file for hpo strategy evalution.
middleyuan 924d3b3
update dependencies
middleyuan 14ae2aa
add the freedom to choose between random sampler and TPE sampler.
middleyuan c0b1b34
1. add strategy 5. 2. add unit test accordingly.
middleyuan f5c3a5a
1. prior configs. 2. update eval.py, sen.sh, and .gitifonore.
middleyuan 0e1248a
gpmpc hpo strategy study
middleyuan a0feec7
refactor the code
middleyuan bd39347
1. hpo on sac. 2. add activation arg in sac and fix a small bug.
middleyuan 4342b2a
fix typos
middleyuan 1e1f7cf
change to two jobs
middleyuan b087c87
change num of repetitions to make sure it at least has same num of sa…
middleyuan 59b4220
Merge branch 'hpo-on-ppo' into hpo-on-sac
middleyuan 4c22c86
reduce the budget
middleyuan fe02a65
toy example
middleyuan 3d33487
consider 4 version of noisy functions.
middleyuan 714a76d
include var study
middleyuan 2663cde
improve visualization in toy examples
middleyuan 249a284
updated visualization improvement in toy examples.
middleyuan e03cb33
change naming
middleyuan ee29967
final experiment setup
middleyuan 3a6448d
Merge branch 'hpo-on-ppo' into hpo-on-sac
middleyuan 831e186
final experiment setup
middleyuan 452937d
modify seeding
middleyuan 7b4a844
Ignore runtime error for hpo
middleyuan bfd6f21
Merge branch 'hpo-on-ppo' into hpo-on-gpmpc
middleyuan e310829
Merge branch 'hpo-on-sac' into hpo-on-gpmpc
middleyuan c45e3e4
merge from sac
middleyuan 8596fc8
fix a bug in hpo_sampler.py
middleyuan df01b80
final design to show possible lower compute time.
middleyuan 9faae33
1. hpo on ddpg. 2. fix a small bug in ddpg_utils.
middleyuan de90501
relax the threshold
middleyuan 4322f67
relax the threshold
middleyuan 038f046
make rl_hpo_strategy_eval.sh automatic.
middleyuan 4703d8b
Merge branch 'hpo-on-ppo' into hpo-on-sac
middleyuan 807e358
Merge branch 'hpo-on-ppo' into hpo-on-ddpg
middleyuan 6590134
fix a bug in rl_hpo_strategy_eval.sh
middleyuan 8c594c3
Merge branch 'hpo-on-ppo' into hpo-on-sac
middleyuan 87cbd1e
Merge branch 'hpo-on-ppo' into hpo-on-ddpg
middleyuan 8211c52
add gpmpc_hpo_strategy_eval.sh
middleyuan 26536e9
fix a small bug
middleyuan 5bca27a
fix the budget (trial) bug in configs.
middleyuan f083b64
prepare comparing hpo strategy on gpmpc
middleyuan bed32ce
fix a bug in gpmpc_hpo_strategy.sh
middleyuan 9503398
fix bugs in bash files
middleyuan 6cd934f
fix the trial bug in config
middleyuan ecb27b1
fix a function bug in eval.py
middleyuan 69d416b
Merge branch 'hpo-on-ppo' into hpo-on-ddpg
middleyuan a1b0756
1. add hpo resume functionality. 2. make eval function more general.
middleyuan c88e7e7
Merge branch 'hpo-on-ppo' into hpo-on-sac
middleyuan a9aa83b
update configs
middleyuan 7f791aa
make main.sh general
middleyuan d8d047b
Merge branch 'hpo-on-ppo' into hpo-on-sac
middleyuan 1e16f06
Merge branch 'hpo-on-ppo' into hpo-on-ddpg
middleyuan c4a8ded
resume previous config with trial increasd.
middleyuan 80e59ec
fix the sorting bug.
middleyuan 1a3a98a
Merge branch 'hpo-on-ppo' into hpo-on-ddpg
middleyuan 43387d5
Merge branch 'hpo-on-ppo' into hpo-on-sac
middleyuan 952b267
fix sorting bug
middleyuan 7f62195
a small bug fixed
middleyuan d5109f4
fix a bug on computing reward
middleyuan 1618395
Merge branch 'hpo-on-ppo' into hpo-on-gpmpc
middleyuan 778128b
adsd resume functionality
middleyuan 61ea053
edit main bash file and fix some typos
middleyuan 1caae68
simply assign zero if numerical issues happen during HPO
middleyuan 8583978
Merge branch 'hpo-on-ppo' into hpo-on-gpmpc
middleyuan f9f701d
adjust eval
middleyuan 5caf0c6
change to boxenplot
middleyuan eea138a
fix typo
middleyuan 362ea75
add reliable_stats
middleyuan 3649c44
Merge branch 'hpo-on-gpmpc' into hpo-on-ppo
middleyuan d6e0b08
Merge branch 'hpo-on-ddpg' into hpo-on-ppo
middleyuan 55624cd
update outdated configs
middleyuan 6e9bbc9
Merge remote-tracking branch 'origin/hpo-on-sac' into hpo-on-ppo
middleyuan 02d75ad
update jupyter notebooks
middleyuan 00f6608
update jupyter notebooks.
middleyuan b5749d0
final update for appendix
middleyuan e4d616d
update readme
middleyuan ef29146
fix typo
middleyuan 47f1598
1. clean up code for ppo controller, hyperparameter module. 2. Test o…
middleyuan 83ec989
test training with given optimized hp files.
middleyuan e890c04
1. test hpo with and without MySQL. 2. update README.
middleyuan e9499cd
remove discrepancy of readme.
middleyuan c45a975
update readme
middleyuan 8350b63
1. remove 'pandas' and 'seaborn' in package dependencies. 2. move tes…
middleyuan ee9ec34
-
middleyuan a260695
update config_overrides in examples of rl
middleyuan 13ef164
run pre-commit hooks to improve linting
middleyuan 3bbd0ba
1. ignore W503 and W504 as they conflict in pre-commit-config. 2. run…
middleyuan 56f2738
add activation config to the examples that use RL.
middleyuan ba837c5
1. standardize hpo template in the examples. 2. remove _learn(). 3. a…
middleyuan 51c601e
run pre-commit hooks.
middleyuan fb572f2
add gpmpc hpo test without using mysql
middleyuan c5fbeed
1. update config of cartpole task. 2. add max_steps and exponentiated…
middleyuan f8e3d0c
1. add bash files to automate hpo pipeline for gpmpc. 2. update gpmpc…
middleyuan 1f62d3b
Merge remote-tracking branch 'upstream/main' into hpo
middleyuan ffb29de
match .gitignore to upstram/main.
middleyuan 1508634
update for review
middleyuan 896ac9f
update based on the review comments.
middleyuan 3b49f7b
fix typo in readme.
middleyuan 133dfee
make test_train.py faster.
middleyuan fc6fd06
Merge remote-tracking branch 'utiasDSL/main' into hpo
middleyuan 2cf9424
1. add Vizier package. 2. update dependencies. 3. change database to …
middleyuan 1828ff1
update readme.
middleyuan 265d8df
commit for the second round review.
middleyuan 32596c8
1. improve docstrings. 2. add a metric for hpo. 3. add hpo.sh bash.
middleyuan adbbb46
1. some bugs fixed. 2. add special handling. 3. make tests faster.
middleyuan f89197a
1. add hpo objective bounds in config. 2. improve logging.py. 3. all …
middleyuan 2c046ef
fix minor config issue.
middleyuan 67cb7e3
some bug fix.
middleyuan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
task_config: | ||
seed: 42 | ||
info_in_reset: true | ||
ctrl_freq: 15 | ||
pyb_freq: 750 | ||
physics: pyb | ||
|
||
init_state_randomization_info: | ||
init_x: | ||
distrib: uniform | ||
high: 1.0 | ||
low: 1.0 | ||
init_x_dot: | ||
distrib: uniform | ||
high: 0.05 | ||
low: -0.05 | ||
init_theta: | ||
distrib: uniform | ||
high: 0.05 | ||
low: -0.05 | ||
init_theta_dot: | ||
distrib: uniform | ||
high: 0.05 | ||
low: -0.05 | ||
# disturbances: | ||
# observation: | ||
# - disturbance_func: white_noise | ||
# std: 0.0001 | ||
inertial_prop: | ||
cart_mass: 1.0 | ||
pole_length: 0.5 | ||
pole_mass: 0.1 | ||
inertial_prop_randomization_info: null | ||
randomized_inertial_prop: false | ||
|
||
|
||
# normalized_rl_action_space: false | ||
|
||
task: stabilization | ||
task_info: | ||
stabilization_goal: [0.0, 0.0, 0.0, 0.0] | ||
# stabilization_goal_tolerance: 0.01 | ||
stabilization_goal_tolerance: 0.0 | ||
use_constraint_penalty: false | ||
|
||
episode_len_sec: 5 | ||
cost: quadratic | ||
done_on_violation: false | ||
done_on_out_of_bound: false | ||
|
||
obs_goal_horizon: 1 | ||
|
||
# RL Reward | ||
rew_state_weight: [1, 1, 1, 1] | ||
rew_act_weight: 0.1 | ||
rew_exponential: True | ||
|
||
constraints: | ||
- constraint_form: default_constraint | ||
constrained_variable: input | ||
upper_bounds: [3.0] | ||
lower_bounds: [-3.0] | ||
- constraint_form: default_constraint | ||
constrained_variable: state | ||
# upper_bounds: [1.5, 0.45, 0.1, 0.3] | ||
# lower_bounds: [-1.5, -0.45, -0.1, -0.3] | ||
upper_bounds: [1.5, 0.45, 0.5, 0.5] | ||
lower_bounds: [-1.5, -0.45, -0.5, -0.5] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
examples/hpo/cartpole/config_overrides/ilqr_cartpole_hpo.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
hpo_config: | ||
|
||
hpo: True # do hyperparameter optimization | ||
load_if_exists: True # this should set to True if hpo is run in parallel | ||
use_database: True # this is set to true if MySQL is used | ||
objective: [average_rmse] # [other metrics defined in base_experiment.py] | ||
direction: [minimize] # [maximize, maximize] | ||
dynamical_runs: False # if True, dynamically increase runs | ||
warm_trials: 20 # number of trials to run before dyamical runs | ||
approximation_threshold: 5 # this is only used when dynamical_runs is True | ||
repetitions: 5 # number of samples of performance for each objective query | ||
alpha: 1 # significance level for CVaR | ||
use_gpu: True | ||
dashboard: False | ||
seed: 24 | ||
save_n_best_hps: 3 | ||
# budget | ||
trials: 40 | ||
|
||
# hyperparameters | ||
hps_config: | ||
max_iterations: 15 | ||
lamb_factor: 10 | ||
lamb_max: 1000 | ||
epsilon: 0.01 | ||
state_weight: [1, 1, 1, 1] | ||
action_weight: [0.1] |
24 changes: 24 additions & 0 deletions
24
examples/hpo/cartpole/config_overrides/ilqr_cartpole_stab_100.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
algo: ilqr | ||
algo_config: | ||
# Cost parameters | ||
q_lqr: [1, 1, 1, 1] | ||
r_lqr: [0.1] | ||
|
||
# Model arguments | ||
# Note: Higher simulation frequency is required if using controller designed | ||
# based on the continuous-time model | ||
discrete_dynamics: True | ||
|
||
# iLQR arguments | ||
max_iterations: 15 | ||
lamb_factor: 10 | ||
lamb_max: 1000 | ||
epsilon: 0.01 | ||
|
||
# prior info | ||
prior_param_coeff: 1.0 | ||
prior_info: | ||
prior_prop: | ||
cart_mass: 1.0 | ||
pole_length: 0.5 | ||
pole_mass: 0.1 |
34 changes: 34 additions & 0 deletions
34
examples/hpo/cartpole/config_overrides/linear_mpsc_cartpole_stab_100.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
safety_filter: linear_mpsc | ||
sf_config: | ||
# LQR controller parameters | ||
r_lin: | ||
- 0.1 | ||
q_lin: | ||
- 1 | ||
- 0.1 | ||
- 1 | ||
- 0.1 | ||
|
||
# MPC Parameters | ||
horizon: 20 | ||
warmstart: True | ||
integration_algo: rk4 | ||
# use_terminal_set: False | ||
use_terminal_set: True | ||
|
||
# Prior info | ||
prior_info: | ||
prior_prop: null | ||
randomize_prior_prop: False | ||
prior_prop_rand_info: null | ||
|
||
# Safe set calculation | ||
n_samples: 600 | ||
n_samples_terminal_set: 100 | ||
learn_terminal_set: False | ||
|
||
# Tau parameter for the calcuation of the RPI | ||
tau: 0.95 | ||
|
||
# Cost function | ||
cost_function: one_step_cost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 0 additions & 67 deletions
67
examples/hpo/gp_mpc/config_overrides/cartpole/cartpole_stab.yaml
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
examples/hpo/gp_mpc/config_overrides/cartpole/optimized_hyperparameters.yaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be a newline at the end of the file. I think the pre-commit hooks handle that. If not, you can configure vs code to always add one when a file is saved, which is what I do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the pre-commit hook should fix this, which means you haven't yet run the hook. This should be done ASAP as it may change a lot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the hooks have still not been run, since there are double quotes here and there.