question

jaypro avatar image
0 Votes"
jaypro asked jaypro edited

Get transformation function inside entry script

Hello everyone,

i am currently getting into Azure Machine Learning. I am trying out the learning path for Data Scientists. In that learning path, the Designer is introduced, where Pipelines are being published to be consumed as a real time inference pipeline.

Since I dont want to use the Designer all the time I want to do the same in python and convert the tutorial inference pipeline (here: https://docs.microsoft.com/en-us/learn/modules/create-regression-model-azure-machine-learning-designer/inference-pipeline) to a python script for deployment. For that I am refering to the learning path on how to deploy a model (here: https://docs.microsoft.com/en-us/learn/modules/register-and-deploy-model-with-amls/2-deploy-model).

My current issue is that in the designer inference pipeline the transformation steps seem to get a transformation function to transform new incoming data based on the transformation that was done during training. The ressources in the azure documentation do not explain anywhere on how to retrieve this function from a training pipeline to do the same transformation in an entry script using python.

I would be happy if you could help me with this issue since I am eager to learn and use Azure Machine Learning in the future.
Best regards and Thank you.

azure-machine-learningazure-machine-learning-inference
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello,

Thanks for reaching out to us. I am sorry a little bit confused about your question, could you please share me more details about the structure you want? Do you mean you want to use Python script only for the transformation like Designer inference pipeline? Please correct me.

Regards,
Yutong

1 Vote 1 ·

(Part 1)
Hello Yutong,

thank you for your answer.

Let me give you an example:
For training I use the diabetes dataset. I am doing this in a notebook and not in the designer. To improve my training I construct a pipeline, where I apply a MinMax-Normalization function to some columns. After training I am registering my model to my workspace. In my next step I am deploying this model using an entry script. This script looks similar to the one inside the learning path (https://docs.microsoft.com/en-us/learn/modules/register-and-deploy-model-with-amls/2-deploy-model). Now, when I deploy it as a REST-Endpoint and data for new patients is coming in, I want to consume this endpoint.

(I am splitting my response, since only 1000 characters are allowed)

0 Votes 0 ·

(Part 2)

But the patients data is not transformed with the MinMax-Normalization function so far when I post my data to my REST-Endpoint. That's why I need to transform the new data inside the entry script (i guess) using the exact same transformation function that was used during training. Inside the learning path this was done using the designer (here: https://docs.microsoft.com/en-us/learn/modules/create-classification-model-azure-machine-learning-designer/inference-pipeline) but never explained how to do this using python/code.
If I don't do this, my model would be predicting on a totally different scale of data than it did during training and the prediction of the model would most likely to be wrong. So my question is how do I get this transformation function inside my entry script? Or is there another way to properly do this?

0 Votes 0 ·

(Part 3)

First I thought I need to load the training dataset again in my entry script and fit the MinMax-function on entry. But if I load a large dataset everytime new data is coming in, this probably would result in large delays or even an error.
To be honest, preprocessing is a basic thing to do in data science and therefore is also necessary for deployment. I am wondering why I cannot find anything about it in the Azure Documentation.
I hope my explanation made my issue clearer. Otherwise let me know.

I hope you can help me with my question.

Best Regards, J.

0 Votes 0 ·

0 Answers