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

Extracted the pipeline -> Optimizer step into a seperate method to ma… #116

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions tpcp/optimize/_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,13 +721,7 @@ def optimize(self, dataset: DatasetT, **optimize_params) -> Self:

n_splits = cv.get_n_splits(dataset)

# We need to wrap our pipeline for a consistent interface.
# In the future we might be able to allow objects with optimizer Interface as input directly.
optimizer = Optimize(
self.pipeline,
safe_optimize=self.safe_optimize,
optimize_with_info=self.optimize_with_info,
)
optimizer = self._wrap_pipeline()

# For each para combi, we separate the pure parameters (parameters that do not affect the optimization) and
# the hyperparameters.
Expand Down Expand Up @@ -833,6 +827,16 @@ def optimize(self, dataset: DatasetT, **optimize_params) -> Self:

return self

def _wrap_pipeline(self):
# We need to wrap our pipeline for a consistent interface.
# In the future we might be able to allow objects with optimizer Interface as input directly.
optimizer = Optimize(
self.pipeline,
safe_optimize=self.safe_optimize,
optimize_with_info=self.optimize_with_info,
)
return optimizer

def _format_results(self, candidate_params, n_splits, out, more_results=None): # noqa: C901
"""Format the final result dict.

Expand Down
Loading