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

Added DTLZ multiobjective test suite, based on modification of ParMOO test suite #8

Merged
merged 8 commits into from
Mar 23, 2023

Conversation

thchang
Copy link
Member

@thchang thchang commented Mar 20, 2023

Modified the test problems in ParMOO's sample simulation library, to fit with DeepHyper and provided an example script importing and solving DTLZ2.

Addresses Issue #5

Copy link
Member

@Deathn0t Deathn0t left a comment

Choose a reason for hiding this comment

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

Thank you for the PR @thchang, I left some comments.

examples/bench_dtlz.py Outdated Show resolved Hide resolved
@@ -0,0 +1 @@
__version__ = "0.0.1"
Copy link
Member

Choose a reason for hiding this comment

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

I suggest we stick to the version attribute of the Benchmark class defined in benchmark.py.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is also there, (name in the class is version, not __version__. Should I just delete this occurrence?

Copy link
Member

Choose a reason for hiding this comment

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

I think a link is missing in the "there". for benchmarks let's keep it as a class attribute version. For Python packages (e.g., deephyper, deephyper_benchmarks) it should be __version__ in the root __init__.py of the package.

lib/DTLZ/benchmark.py Outdated Show resolved Hide resolved
DIR = os.path.dirname(os.path.abspath(__file__))


class DTLZ_lib(Benchmark):
Copy link
Member

Choose a reason for hiding this comment

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

For class's names follow camel cases: "Start each word with a capital letter. Do not separate words with underscores. This style is called camel case or pascal case." No underscore, DTLZBenchmark maybe.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK DTLZBenchmark is fine -- IMHO, camel case doesn't work well when using acronyms like DTLZ, but perhaps it is better to maintain consistency

Copy link
Member

Choose a reason for hiding this comment

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

yeah, mainly for consistency see MPIDistributedBO, LCModelStopper.

Copy link
Member

Choose a reason for hiding this comment

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

Nothing to say about the content of the file! I also created some model.py files in neural network benchmarks where I define the model. If we reuse this model name of "utility modules" maybe we should document it in the main README.


# Read problem dims and definition (or read from ENV)
nb_dim = int(os.environ.get("DEEPHYPER_BENCHMARK_NDIMS", 5))
nb_obj = int(os.environ.get("DEEPHYPER_BENCHMARK_NOBJS", 2))
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering how we could be consistent between what should be "Environment variables" (e.g., DEEPHYPER_BENCHMARK_NDIMS) and "parameters of the run-function (e.g., sleep=False). Maybe the sleep=False, sleep_mean=..., sleep_noise=... should be implemented through a "decorator so that any function can be extended and we code it only once.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, if you have a decorator I'm happy to use it. For now, I had just copy-pasted the hpo definition from C-BBO.ackley and changed the function import/call to match this directory.

For the environment variables, I tried to copy the style that you used in Ackley. Open to changes if you have suggestions. For hyperparams that are specific to DTLZ, I added a _DTLZ_ in the middle of the variable name

@@ -0,0 +1,50 @@
import os
Copy link
Member

Choose a reason for hiding this comment

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

performing sorting of imports would be nice (proposed in visual studio code if you use this editor).

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I don't like fancy editors -- it's all vim and CL for me, but I think that's reasonable.

My only suggestion would be that I think it's nice to keep intrinsics (such as os and time) separate from external libraries (like numpy) separate from properties of this package (e.g., deephyper imports)

I'm fine with doing everything alphabetically to keep the style of deephyper consistent, but for now I've just sorted within those three classes. Let me know if you'd like it sorted universally

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it is not 100% alphabetical sorting, see here for example

  1. alphabetical ordering within each sub-group
  2. import before from ... import ...
  3. standard libraries before external dependencies
  4. deephyper imports last

lib/DTLZ/README.md Outdated Show resolved Hide resolved
@thchang
Copy link
Member Author

thchang commented Mar 22, 2023

Ooo, @Deathn0t , one additional question about this that I forgot to ask in the PR message:

When running examples/bench_dtlz.py, I immediately get a message that tensorflow is being loaded.

Why is this?

I'm not using tensorflow for anything and my understanding of deephyper is that it shouldn't need tensorflow unless it is specifically doing a tensorflow model's hyperparameter optimization, but I could be mistaken

@Deathn0t
Copy link
Member

Hey @thchang , yeah good point and good question. So, when running from deephyper.problem import HpProblem the deephyper/problem/__init__.py (link) file is being loaded which if NAS requirements are installed will load deephyper/problem/_neuralarchitecture.py to have the NaProblem and tensorflow is loaded there...

It would be better to have a lazy loader, trying to import NaProblem only when from deephyper.problem import NaProblem but I did not implement it for now (also I am not sure how the documentation will work if lazy loading is used...);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants