Skip to content
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 #151

Merged
merged 125 commits into from May 14, 2024

Conversation

middleyuan
Copy link
Contributor

The pull request contains

  1. DDPG, SAC, PPO
  • Change the saving method for the checkpoint.
  • Add activation as an argument for the constructor.
  1. GPMPC
  • Add the feature that allows one to learn GP in parallel (this speeds up roughly D times faster, where D is the dimension of the dynamics)
  • Add activation as an argument for the constructor ('Matern' or 'RBF' kernel are supported).
  1. Hyperparameter optimization (HPO) module
  • database.py implements the functions that interact with MySQL.
  • hpo_sampler.py defines the hyperparameter spaces for the selected controller.
  • hpo.py defines the hyperparameter optimization class.
  1. safe_control_gym/hyperparameters/README.md describes the basic steps for running HPO.

…ve unnecessary config in cartpole_stab.yaml 2. add hpo module in test_build.py
…ckpoint in ppo.py. 4. Boolean var in ppo_sampler.
@middleyuan middleyuan added the enhancement New feature or request label Apr 10, 2024
@adamhall
Copy link
Contributor

Run precommit hooks etc. to ensure formatting is good.

@adamhall
Copy link
Contributor

experiments folder was removed. Clean up experiments and move to examples folder that exists in the current main branch.

@adamhall
Copy link
Contributor

Move any files used for tests into the tests directory.

@adamhall
Copy link
Contributor

rename hyperparameters_13.....yaml to something more readable.

Copy link
Contributor

@Federico-PizarroBejarano Federico-PizarroBejarano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled your branch and reran the pre-commit hooks and there are some minor fixes you should add.

.gitignore Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
examples/no_controller/verbose_api.py Outdated Show resolved Hide resolved
safe_control_gym/hyperparameters/README.md Outdated Show resolved Hide resolved
safe_control_gym/hyperparameters/README.md Outdated Show resolved Hide resolved
safe_control_gym/hyperparameters/README.md Outdated Show resolved Hide resolved
safe_control_gym/hyperparameters/README.md Outdated Show resolved Hide resolved
safe_control_gym/hyperparameters/hpo.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Federico-PizarroBejarano Federico-PizarroBejarano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@adamhall adamhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -815,6 +832,128 @@ def learn(self,
except UnboundLocalError:
training_results['info'] = None
return training_results

def _learn(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change def learn to something like def gp_hyperparam_opt and then change def learn and def _learn to more closely match _learn from the other learning classes
.


return train_runs, test_runs

def _run(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we standardize this across all the controllers, if possible, and use the experiment class instead of _run.

pyproject.toml Outdated
optuna-dashboard = "^0.9"
mysql-connector-python = "8.0.33"
pymysql = "1.0.3"
seaborn = "0.12.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Delete if matplotlib is sufficient

@@ -395,6 +508,293 @@ def kernel_inv(self,
non_lazy_tensors = [k.inv_matmul(torch.eye(num_of_points).double()) for k in k_list]
return torch.stack(non_lazy_tensors)

class GaussianProcesses:
'''Gaussian Processes decorator for batch GP in gpytorch.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename or Add a comment that this is for parallel training of GPs and that only 1 learning rate can be specified for all GPs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still ToDo.

@Federico-PizarroBejarano Federico-PizarroBejarano merged commit f90ac22 into utiasDSL:main May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants