Skip to content
Snippets Groups Projects
Commit 42021d75 authored by Julian Steinmetz's avatar Julian Steinmetz
Browse files

Check if folders exist.

parent a7db8f60
No related branches found
No related tags found
No related merge requests found
......@@ -126,6 +126,8 @@ def main():
# Create GridSearchCV with k-fold cross-validation
k_fold = KFold(n_splits=5, shuffle=True, random_state=42)
grid_search = GridSearchCV(estimator=xgb_model, param_grid=param_grid, cv=k_fold)
best_params = grid_search.best_params_
best_model = grid_search.best_estimator_
start = datetime.now()
......@@ -141,7 +143,12 @@ def main():
# Save the trained model
with open(f'{save_directory_trained_model}/{model_name}', 'wb') as f:
pickle.dump(grid_search, f)
pickle.dump(best_model, f)
filename = f'{save_directory_trained_model}/{model_name}_best_parameters.txt'
filehandle = open(filename, "a")
header = f'best parameter'
filehandle.write(header + "\n")
filehandle.close()
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment