Amazon Machine Learning
  • 04 Jan 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Amazon Machine Learning

  • Dark
    Light
  • PDF

Article summary

This graph template allows you to call an Amazon Web Services Machine Learning real-time machine learning endpoint to get a prediction or a score from a model. 

The graph uses the HTTPS web service endpoint identified in the AWS machine learning console. It requires an AWS Access Key and a Secret Access key.

It is recommended that these are held in your application parameters rather than within the graph or project itself.

Use the Xponent Refresh Application Parameters graph to assist with this process. 

Package contents

  • Graph: awsMachineLearning
  • Public Variables: 
    • None

Using

There are two structures that need to be passed to the graph - the AWS API information, including the access key, and then the information to be passed to the web service endpoint itself. 

Amazon Options

{
	"accessKeyId": "****",
	"secretAccessKey": "***",
	"region": "eu-west-1",
	"service": "machinelearning",
	"host": "realtime.machinelearning.eu-west-1.amazonaws.com",
	"x-amz-target": "AmazonML_20141212.Predict",
	"path": "/",
	"endpoint": "https://realtime.machinelearning.eu-west-1.amazonaws.com",
	"method": "POST"
}

These values are as follows:

  • accessKeyId - the AWS Access Key - not shown above 
  • secretAccessKey - the AWS Secret Access key - not shown above
  • region - the AWS region name - AWS ML is not available in all regions but is available in "eu-west-1" - Dublin and "us-east-1" - North Virginia
  • service - always "machinelearning" 
  • host - the realtime scoring endpoint for your region - see the AWS Machine Learning Console 
  • x-amz-target - not very well documented - but always set to "AmazonML_20141212.Predict"
  • path - always "/"
  • endpoint - from the AWS Machine Learning Console 
  • method - always "POST" 

Machine Learning Request 

The machine learning request has the following format: 

{
	"MLModelId": "ml-****",
	"Record": {
		"age": "23"
	    ...
	},
	"PredictEndpoint": "https://realtime.machinelearning.eu-west-1.amazonaws.com"
}

The values are as follows: 

  • MLModelId - the unique identifier for the AWS Machine Learning Model from the AWS Machine Learning Console
  • PredictEndpoint - from the AWS Machine Learning Console - same as the "endpoint" field in the Amazon Options
  • Record - this is an object that provides all of the input criteria to the model for scoring - all values passed as strings

Add the Managed Graph 

Add the managed graph to your project: 

If you don't have one already, create a Web Service Connection that specifies your real-time endpoint from the AWS Machine Learning Console as the Endpoint.

The graph can then be used in your flow. Depending on the model type, it may return different responses. In the example below, this is a binary prediction model.

The returned object is:

{
	"Prediction": {
		"predictedLabel": "0",
		"predictedScores": {
			"0": 0.42783865332603455
		},
		"details": {
			"PredictiveModelType": "BINARY",
			"Algorithm": "SGD"
		}
	}
}

Is it helpful? React and share your comment

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence