Skip to content

Commit

Permalink
Add timestamp in model filename
Browse files Browse the repository at this point in the history
  • Loading branch information
nicedlp committed Sep 7, 2023
1 parent 978e455 commit ce9a5e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion formation_indus_ds_avancee/train_and_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def train_model(features: pd.DataFrame, model_registry_folder: str) -> None:
y = features[target]
model = RandomForestRegressor(n_estimators=1, max_depth=10, n_jobs=1)
model.fit(X, y)
joblib.dump(model, os.path.join(model_registry_folder, 'model.joblib'))


timestr = time.strftime("%Y%m%d-%H%M%S")

joblib.dump(model, os.path.join(model_registry_folder, f'model_{timestr}.joblib'))


def predict_with_io(features_path: str, model_path: str, predictions_folder: str) -> None:
Expand Down

0 comments on commit ce9a5e5

Please sign in to comment.