Skip to content

Commit

Permalink
Fit model if not fitted
Browse files Browse the repository at this point in the history
  • Loading branch information
Yard1 committed Sep 19, 2021
1 parent c01e4e4 commit 24bf2d9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pycaret/internal/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -10016,11 +10016,21 @@ def get_leaderboard(
model_only=model_only,
)
)
elif model_only:
model = deepcopy(model_container[i])
else:
model = deepcopy(prep_pipe)
model.steps.append(["trained_model", deepcopy(model_container[i])])
model = deepcopy(model_container[i])
if not is_fitted(model):
model, _ = create_model_supervised(
estimator=model,
verbose=False,
system=False,
fit_kwargs=fit_kwargs,
groups=groups,
add_to_model_list=False,
)
if not model_only:
pipeline = deepcopy(prep_pipe)
pipeline.steps.append(["trained_model", model])
model = pipeline
display.move_progress()
finalized_models.append(model)
result_container_mean.append(mean_scores)
Expand Down

0 comments on commit 24bf2d9

Please sign in to comment.