You work for a power tool manufacturer as a machine learning specialist.
You work in the battery-powered power tool division, where your team of machine learning specialists and data scientists has been tasked with building a model that predicts the lifespan of particular models of power tools.
You have selected the Linear Learner algorithm on which to build your model.
You have cleaned and engineered your features for your training and test data.
Your feature engineering transformations convert all feature attributes to integers or real numbers.
You have also trained your model and have deployed it to Amazon SageMaker Hosting Services. Your training dataset has this structure: | model| power | battery Ah | use pattern | region | country | For your client application inference requests, how would you structure the body argument for your invoke_endpoint call?
Click on the arrows to vote for the correct answer
A. B. C. D. E.Answer: B.
Option A is incorrect.
The Linear Learner algorithm expects either CSV or recordio-protobuf as the inference request content type.
For text/csv the value of the body argument for the invoke_endpoint API call should be a string with comma-separated values for each feature.
This option has a comma-separated string, but it has 7 values, when you only have 6 features in your data used to train your model.
Option B is correct.
The Linear Learner algorithm expects either CSV or recordio-protobuf as the inference request content type.
For text/csv the value of the body argument for the invoke_endpoint API call should be a string with comma-separated values for each feature.
This option has a comma-separated string, and it has 6 values.
You also have 6 features in your data used to train your model, so this inference request is structured correctly.
Option C is incorrect.
The Linear Learner algorithm expects either CSV or recordio-protobuf as the inference request content type.
Also, any transforms performed on the training data must also be performed on inference request data before attempting to obtain an inference.
The body argument in this option has not been transformed in the way your training data was transformed.
Option D is incorrect.
The Linear Learner algorithm expects either CSV or recordio-protobuf as the inference request content type.
Also, the body argument to the invoke_endpoint should be a string, not an array.
Option E is incorrect.
The Linear Learner algorithm expects either CSV or recordio-protobuf as the inference request content type.
Also, the body argument to the invoke_endpoint should be a string, not a list.
Reference:
Please see the Amazon SageMaker developer guide titled Train a Model with Amazon SageMaker, the Amazon SageMaker developer guide titled Common Parameters for Built-In Algorithms, and the Amazon SageMaker developer guide titled Common Data Formats for Inference.
To make an inference request to an Amazon SageMaker endpoint, you need to provide the input data in a specific format depending on the model you have deployed.
In this case, the model was built using the Linear Learner algorithm, and the training dataset has six features: model, power, battery Ah, use pattern, region, and country. According to the question, the feature engineering transformations convert all feature attributes to integers or real numbers.
Therefore, the correct answer would be D. An array set to these values: [547,3.5,1.5,23.4,2,43]
Each value in the array corresponds to one of the features in the training dataset, in the following order:
Note that the values in the array are not surrounded by quotes or separated by commas, as this is not the correct format for an array in Python.
Option A is incorrect because it provides the values as a string, which would need to be parsed and split to obtain the input values in the correct format for the model.
Option B is incorrect because it only includes the first five features and does not include the numerical value for the country feature.
Option C is incorrect because it provides the values as a string and includes the feature names instead of the numerical values.
Option E is incorrect because it uses the Python list notation instead of the array notation.