Skip to content

Commit

Permalink
Update train.py
Browse files Browse the repository at this point in the history
added r in path
  • Loading branch information
Aman123lug authored Aug 28, 2023
1 parent 2b705aa commit d5dd3d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def training(self, path:Path):

report = classification_report(y_test, y_pred)
print("classification report:", report)
logger.info(f" training successfull !")

mlflow.log_metric("training Score", training_accuracy)
mlflow.log_metric("test accuracy", test_accracy)
Expand All @@ -60,10 +61,11 @@ def training(self, path:Path):

with open("metrics.txt", "w+") as f:
f.write(str(test_accracy))
logger.info(f" metrics saved !")

# save model
pickle.dump(dtree, open("model/model.pkl", "wb"))

pickle.dump(dtree, open(r"model/model.pkl", "wb"))
logger.info(f" mode saved !")
IC = type('IdentityClassifier', (), {"predict": lambda i : i, "_estimator_type": "classifier"})
cm=ConfusionMatrixDisplay.from_estimator(IC, y_pred, y_test, normalize='true', values_format='.2%')

Expand All @@ -72,7 +74,7 @@ def training(self, path:Path):


if __name__ == "__main__":
preprocess_path ="data/preprocess_data.csv"
preprocess_path =r"data/preprocess_data.csv"

try:
logger.info(f" >>>> stage {STAGE_NAME} <<<< started !")
Expand Down

0 comments on commit d5dd3d5

Please sign in to comment.