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

Pipeline_space as yaml input #46

Merged
merged 24 commits into from
Dec 27, 2023
Merged

Pipeline_space as yaml input #46

merged 24 commits into from
Dec 27, 2023

Conversation

Neeratyoy
Copy link
Contributor

@Neeratyoy Neeratyoy commented Dec 4, 2023

Enabled initialization of search_space via a YAML file.
You can find an example in neps_examples/basic_usage/defining_search_space. For more information, refer to docs/pipeline_space.md.
Supported Parameter Types: Int, Float, Categorical, Constant

@Neeratyoy Neeratyoy changed the title Yaml config space pipeline_space as yaml input Dec 4, 2023
@Neeratyoy Neeratyoy changed the title pipeline_space as yaml input [WIP] pipeline_space as yaml input Dec 4, 2023
@Neeratyoy
Copy link
Contributor Author

Neeratyoy commented Dec 6, 2023

The directories were restructured. Needs to be updated with the master.

@danrgll danrgll added the enhancement New feature or request label Dec 6, 2023
@danrgll danrgll marked this pull request as ready for review December 6, 2023 14:56
@danrgll
Copy link
Contributor

danrgll commented Dec 6, 2023

The directories were restructured. Needs to be updated with the master.

Done.

neps/api.py Outdated Show resolved Hide resolved
@danrgll danrgll changed the title [WIP] pipeline_space as yaml input Pipeline_space as yaml input Dec 6, 2023
Copy link
Collaborator

@TarekAbouChakra TarekAbouChakra left a comment

Choose a reason for hiding this comment

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

The feature addition looks good. I've tested the example, and it worked as expected.

The inclusion of testing is a great addition, adding robustness to the codebase.

Comment on lines +72 to +77
assert pipeline_space["learning_rate"].lower == 0.00001
assert pipeline_space["learning_rate"].upper == 0.1
assert pipeline_space["learning_rate"].log is True
assert pipeline_space["learning_rate"].is_fidelity is False
assert pipeline_space["learning_rate"].default == 3.3e-2
assert pipeline_space["learning_rate"].default_confidence_score == 0.125
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danrgll @TarekAbouChakra
For this PR let us push this.

For later refactoring, can we compress such lines by creating a FloatParameter using these values explicitly in one line, and comparing the loaded instantiation using something like this?
If so, let us keep a note and do this for next year's release.

def test_correct_including_priors_yaml_file():
"""Test the function with a correctly formatted YAML file."""
pipeline_space = pipeline_space_from_yaml(
"tests/test_yaml_search_space/correct_config_including_priors.yml"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could we perhaps make the location (tests/test_yaml_search_space/) a global or class variable for all such relative path imports?
(Same, please note for the next release)

Comment on lines 122 to 126
with pytest.raises(SearchSpaceFromYamlFileError) as excinfo:
pipeline_space_from_yaml(
Path("tests/test_yaml_search_space/inconsistent_types_config2.yml")
)
assert str(excinfo.value.exception_type == "TypeError")
Copy link
Contributor Author

@Neeratyoy Neeratyoy Dec 7, 2023

Choose a reason for hiding this comment

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

Since a boolean expression is converted to either "True" or "False" the assertion will always be True.
Are we sure these test cases pass?
We should check these before releasing them.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right. im going to fix that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be fixedhere

@Neeratyoy
Copy link
Contributor Author

Looks good!

There is only one issue with the tests cases for the wrong YAML inputs where I think the test is not being checked correctly.

Overall, it looks quite comprehensive with what looks like adequate documentation!
Some other comments I have left as notes for future improvements.

One more such point is, can we now generate a yaml from a pipeline_space or SearchSpace and save it along with the files we write for a NePS run?
If so, let us add that too @danrgll @TarekAbouChakra.

@Neeratyoy
Copy link
Contributor Author

@TarekAbouChakra @danrgll
Please feel free to coordinate and monitor merges during December. :)

@danrgll danrgll merged commit a14e716 into master Dec 27, 2023
11 checks passed
@danrgll danrgll deleted the yaml_config_space branch December 27, 2023 13:37
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.

3 participants