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

Update search_cv.py #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions tensorcross/model_selection/search_cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ def __init__(
self.results_: ResultsDict = {
"best_score": -np.inf,
"best_params": {},
"best_model" : [],
"val_scores": [],
"params": [],
"models" : []
}

def _run_search( # noqa: PLR0912
Expand Down Expand Up @@ -136,6 +138,7 @@ def _run_search( # noqa: PLR0912

self.results_["val_scores"].append(val_scores)
self.results_["params"].append(grid_combination)
self.results_["models"].append(model)

logger.setLevel(tf_log_level) # Issue 30

Expand All @@ -146,6 +149,7 @@ def _run_search( # noqa: PLR0912
best_run_idx = np.argmin(mean_val_scores)
self.results_["best_score"] = self.results_["val_scores"][best_run_idx]
self.results_["best_params"] = self.results_["params"][best_run_idx]
self.results_["best_model"] = self.results_["models"][best_run_idx]

def summary(self) -> str:
"""Prints the summary of the search to the console.
Expand Down
Loading