Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Train #57

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- pandas=2.1.3
- jupyterlab=4.0.9
- pip=23.3.1
- cookiecutter=2.6.0
- pip:
- mlflow==2.8.1
- wandb==0.16.0
80 changes: 60 additions & 20 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,48 @@ def go(config: DictConfig):
)

if "basic_cleaning" in active_steps:
##################
# Implement here #
##################
pass
# Clean raw data
_ = mlflow.run(
os.path.join(hydra.utils.get_original_cwd(), "src", "basic_cleaning"),
"main",
parameters={
"input_artifact": "sample.csv:latest",
"output_artifact": "clean_sample.csv",
"output_type": "clean_sample",
"output_description": "Data with outliers and null values removed",
"min_price": config['etl']['min_price'],
"max_price": config['etl']['max_price']
},
)

if "data_check" in active_steps:
##################
# Implement here #
##################
pass
# perform tests on data
_ = mlflow.run(
os.path.join(hydra.utils.get_original_cwd(), "src", "data_check"),
"main",
parameters={
"csv": "clean_sample.csv:latest",
"ref": "clean_sample.csv:reference",
"kl_threshold": config["data_check"]["kl_threshold"],
"min_price": config["etl"]["min_price"],
"max_price": config["etl"]["max_price"],
},
)


if "data_split" in active_steps:
##################
# Implement here #
##################
pass
# split data in train, validation and test set
_ = mlflow.run(
f"{config['main']['components_repository']}/train_val_test_split",
"main",
version='main',
parameters={
"input": "clean_sample.csv:latest",
"test_size": config['modeling']['test_size'],
"random_seed": config['modeling']['random_seed'],
"stratify_by": config['modeling']['stratify_by']
},
)

if "train_random_forest" in active_steps:

Expand All @@ -77,19 +103,33 @@ def go(config: DictConfig):
# NOTE: use the rf_config we just created as the rf_config parameter for the train_random_forest
# step

##################
# Implement here #
##################
_ = mlflow.run(
os.path.join(hydra.utils.get_original_cwd(), "src", "train_random_forest"),
"main",
parameters={
"trainval_artifact": "trainval_data.csv:latest",
"val_size": config['modeling']['val_size'],
"random_seed": config['modeling']['random_seed'],
"stratify_by": config['modeling']['stratify_by'],
"rf_config": rf_config,
"max_tfidf_features":config['modeling']['max_tfidf_features'],
"output_artifact":"random_forest_export",
},
)

pass

if "test_regression_model" in active_steps:

##################
# Implement here #
##################

pass
_ = mlflow.run(
f"{config['main']['components_repository']}/test_regression_model",
"main",
version='main',
parameters={
"mlflow_model": "random_forest_export:prod",
"test_dataset": "test_data.csv:latest"
},
)


if __name__ == "__main__":
Expand Down
34 changes: 34 additions & 0 deletions src/basic_cleaning/MLproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: basic_cleaning
conda_env: conda.yml

entry_points:
main:
parameters:

input_artifact:
description: ## ADD DESCRIPTION
type: string

output_artifact:
description: ## ADD DESCRIPTION
type: string

output_type:
description: ## ADD DESCRIPTION
type: string

output_description:
description: ## ADD DESCRIPTION
type: string

min_price:
description: ## ADD DESCRIPTION
type: string

max_price:
description: ## ADD DESCRIPTION
type: string


command: >-
python run.py --input_artifact {input_artifact} --output_artifact {output_artifact} --output_type {output_type} --output_description {output_description} --min_price {min_price} --max_price {max_price}
Loading
Loading