From a57b85d3bfda26883a690cd115f2118dd80d1274 Mon Sep 17 00:00:00 2001 From: Julien Foenet Date: Mon, 7 Oct 2024 11:48:39 +0000 Subject: [PATCH] fix vulture --- .github/workflows/ci-workflow.yml | 2 +- formation_indus_ds_avancee/train_and_predict.py | 10 ---------- requirements_test.txt | 3 ++- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 6c6b8e9..bbd3014 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -22,7 +22,7 @@ jobs: - name: Run Linter run: python -m flake8 - name: Run Vulture - run: "Trainee should add command to run vulture" + run: python -m vulture - name: Run tests run: "Trainee should add command to run test" diff --git a/formation_indus_ds_avancee/train_and_predict.py b/formation_indus_ds_avancee/train_and_predict.py index ea8b56f..f148868 100644 --- a/formation_indus_ds_avancee/train_and_predict.py +++ b/formation_indus_ds_avancee/train_and_predict.py @@ -21,16 +21,6 @@ def train_model(features: pd.DataFrame, model_registry_folder: str) -> None: joblib.dump(model, os.path.join(model_registry_folder, 'model.joblib')) -def predict_with_io(features_path: str, model_path: str, predictions_folder: str) -> None: - features = pd.read_parquet(features_path) - features = predict(features, model_path) - time_str = time.strftime('%Y%m%d-%H%M%S') - features['predictions_time'] = time_str - features[['predictions', 'predictions_time']].to_csv(os.path.join(predictions_folder, time_str + '.csv'), - index=False) - features[['predictions', 'predictions_time']].to_csv(os.path.join(predictions_folder, 'latest.csv'), index=False) - - def predict(features: pd.DataFrame, model_path: str) -> pd.DataFrame: model = joblib.load(model_path) features['predictions'] = model.predict(features) diff --git a/requirements_test.txt b/requirements_test.txt index 252c2ce..56d12d3 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,3 +1,4 @@ behave pytest -pytest-cov \ No newline at end of file +pytest-cov +vulture \ No newline at end of file