question

SteveW-9102 avatar image
0 Votes"
SteveW-9102 asked shashishailaj commented

Azure Machine Learning Endpoint attempting to cast string parameter as an int

Hi,

I have created a an ML model in Azure ML using auto ML. This has been deployed as an endpoint using the UI.
This is a sample of the original dataset:
111244-image.png

Its deployed as a container instance and the deployment state is healthy.

When I test the endpoint, it pre-populates the test form with some example values, for the various paratmeters which are strings and ints.

110980-image.png


However, if I populate the blank fields with ints and leave the strings, .

111051-image.png

then test the service, I get an error that suggests it is trying to convert attribute13 to an int

110994-image.png

as you can see, it is fine with the productName parameter being a string, but tries to convert Attribute13 to an int.
The same happens with the other attributesXX.
If I set all the attributes to numerical values, the test completes and the endpoint returns a value from the model as expected.

IF i check the swagger file, it shows that the api is expecting a string:

111018-image.png

So that all suggests the issue exists somewhere in the python code created automatically.
This is kinda where I get stuck - I see resources on debugging the python code, I can see in my score.py file the example sample passes specifies these as 'object' dtypes:
111025-image.png

And after that I dont know where to go from here - feels like it should just work 'out of the box' as I got to this point purely through the UI.

Any help greatly appreciated.

Steve


azure-machine-learning
image.png (18.6 KiB)
image.png (18.8 KiB)
image.png (8.1 KiB)
image.png (38.5 KiB)
image.png (14.0 KiB)
image.png (32.2 KiB)
· 2
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.

Thanks for reaching out to us. Is that possible to share any guidance you are referring and the dataset you are using for the project?

Regards,
Yutong

0 Votes 0 ·

Hi, thanks for the reply!
I added a screen shot of the dataset - I cannot upload the full set publicly.
I also added a link to the documentation I was referring to.

Hope that helps.

Steve

0 Votes 0 ·

1 Answer

SteveW-9102 avatar image
2 Votes"
SteveW-9102 answered shashishailaj commented

TL;DR: Don't have column names that are numerical.

I have discovered that if I send the attributes in the order the appear in they dataset - ignoring the order that they are named on the api, then they are all parsed to the correct type. Effectively the 3 columns named 341, 513, 514 belong at the end, but for some reason have been lined up with the wrong parameter names.

112439-image.png
(this returns expected values)

So i renamed the columns in my training data pandas dataframe so they are not numerical (e.g. System341, System513, System514) and re-ran the AutoML, and deployed the new model.

112552-image.png

now the order of columns matches that of the dataset- and IT WORKS!


image.png (12.2 KiB)
image.png (24.4 KiB)
· 1
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.

@SteveW-9102 , Thank you for sharing your findings and knowledge with the azure community . Much appreciated!!

1 Vote 1 ·