|
1 | | -# Write a zenml pipeline that loads sklearn iris dataset and builds a sklearn classifier |
| 1 | +# Write a zenml pipeline that loads sklearn iris dataset and builds a sklearn classifier |
2 | 2 |
|
3 | 3 | from zenml.pipelines import pipeline |
4 | | -from zenml.steps.preprocesser import StandardPreprocesser |
5 | | -from zenml.steps.split import RandomSplit |
6 | 4 | from zenml.steps.evaluator import TFMAEvaluator |
| 5 | +from zenml.steps.preprocesser import StandardPreprocesser |
| 6 | +from zenml.steps.preprocesser.standard_preprocesser.standard_preprocesser import ( |
| 7 | + StandardPreprocesser, |
| 8 | +) |
7 | 9 | from zenml.steps.trainer import TFFeed |
8 | | -from zenml.steps.deployer import TFServingDeployer |
9 | | -from zenml.steps.preprocesser.standard_preprocesser.standard_preprocesser import \ |
10 | | - StandardPreprocesser |
| 10 | + |
11 | 11 |
|
12 | 12 | @pipeline |
13 | 13 | def tf_mnist_pipeline(epochs: int = 5, lr: float = 0.001): |
14 | 14 | """Links all the steps together in a pipeline.""" |
15 | 15 | # Link all the steps together by calling them and passing the output |
16 | 16 | # of one step as the input |
17 | 17 |
|
18 | | -# x_train, x_test, y_train, y_test = RandomSplit(test_size=0.2)( |
19 | | -# dataset=iris_data_loader() |
20 | | -# ) |
| 18 | + # x_train, x_test, y_train, y_test = RandomSplit(test_size=0.2)( |
| 19 | + # dataset=iris_data_loader() |
| 20 | + # ) |
21 | 21 | x_train, x_test, y_train, y_test = StandardPreprocesser( |
22 | 22 | test_size=0.2, |
23 | 23 | random_state=42, |
24 | | - )( |
25 | | - dataset=iris_data_loader() |
26 | | - ) |
27 | | - model = TFFeed(epochs=epochs, lr=lr)( |
28 | | - x_train=x_train |
| 24 | + )(dataset=iris_data_loader()) |
| 25 | + model = TFFeed(epochs=epochs, lr=lr)(x_train=x_train, y_train=y_train) |
| 26 | + |
| 27 | + # Complete the pipeline with evaluation or deployment steps |
| 28 | + metrics = TFMAEvaluator()(model=model, x_test=x_test, y_test=y_test) |
29 | 29 |
|
30 | | - |
| 30 | + return model, metrics |
0 commit comments