Spaces:
Sleeping
Sleeping
Upload train.py with huggingface_hub
Browse files
train.py
CHANGED
|
@@ -14,7 +14,7 @@ import optuna
|
|
| 14 |
from sklearn.linear_model import LogisticRegression
|
| 15 |
from sklearn.compose import make_column_transformer
|
| 16 |
from imblearn.pipeline import Pipeline
|
| 17 |
-
|
| 18 |
from sklearn.tree import DecisionTreeClassifier
|
| 19 |
from sklearn.ensemble import VotingClassifier
|
| 20 |
from sklearn.ensemble import StackingClassifier
|
|
@@ -539,8 +539,8 @@ plt.show()
|
|
| 539 |
|
| 540 |
|
| 541 |
# Save the model locally
|
| 542 |
-
model_path = "best_engine_PM_prediction_v1.joblib"
|
| 543 |
-
joblib.dump(best_model, model_path)
|
| 544 |
|
| 545 |
# Log the model artifact
|
| 546 |
#mlflow.log_artifact(model_path, artifact_path="model")
|
|
@@ -561,8 +561,8 @@ except RepositoryNotFoundError:
|
|
| 561 |
|
| 562 |
# create_repo("churn-model", repo_type="model", private=False)
|
| 563 |
api.upload_file(
|
| 564 |
-
path_or_fileobj="best_engine_PM_prediction_v1.joblib",
|
| 565 |
-
path_in_repo="best_engine_PM_prediction_v1.joblib",
|
| 566 |
repo_id=repo_id,
|
| 567 |
repo_type=repo_type,
|
| 568 |
)
|
|
|
|
| 14 |
from sklearn.linear_model import LogisticRegression
|
| 15 |
from sklearn.compose import make_column_transformer
|
| 16 |
from imblearn.pipeline import Pipeline
|
| 17 |
+
|
| 18 |
from sklearn.tree import DecisionTreeClassifier
|
| 19 |
from sklearn.ensemble import VotingClassifier
|
| 20 |
from sklearn.ensemble import StackingClassifier
|
|
|
|
| 539 |
|
| 540 |
|
| 541 |
# Save the model locally
|
| 542 |
+
model_path = "Breakdown_prediction/best_engine_PM_prediction_v1.joblib"
|
| 543 |
+
joblib.dump(best_model, model_path,compress=("lzma",9))# job lfile > 110 NB |reduce to 20~40 MB
|
| 544 |
|
| 545 |
# Log the model artifact
|
| 546 |
#mlflow.log_artifact(model_path, artifact_path="model")
|
|
|
|
| 561 |
|
| 562 |
# create_repo("churn-model", repo_type="model", private=False)
|
| 563 |
api.upload_file(
|
| 564 |
+
path_or_fileobj="Breakdown_prediction/best_engine_PM_prediction_v1.joblib",
|
| 565 |
+
path_in_repo="Breakdown_prediction/best_engine_PM_prediction_v1.joblib",
|
| 566 |
repo_id=repo_id,
|
| 567 |
repo_type=repo_type,
|
| 568 |
)
|