• 沒有找到結果。

Amazon Lookout for Equipment

N/A
N/A
Protected

Academic year: 2022

Share "Amazon Lookout for Equipment"

Copied!
180
0
0

加載中.... (立即查看全文)

全文

(1)

Amazon Lookout for Equipment

User Guide

(2)

Amazon Lookout for Equipment: User Guide

Copyright © Amazon Web Services, Inc. and/or its affiliates. All rights reserved.

Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon.

(3)

Table of Contents

What is Amazon Lookout for Equipment? ... 1

Are you a first-time user of Lookout for Equipment? ... 1

Pricing for Amazon Lookout for Equipment ... 2

How it works ... 3

Use case: fluid pump ... 5

Setting up ... 8

Step 1: Set up an account and IAM user ... 8

Sign up for AWS ... 8

Create an IAM user ... 8

Next step ... 9

Step 2: IAM Access Roles ... 9

Create an IAM role ... 9

Attach policies to the IAM role ... 12

Edit the trust relationship ... 15

Next step ... 16

Step 3: Set Up the AWS CLI ... 16

Transferring historical data ... 18

Formatting your data ... 18

Uploading your data into Amazon S3 ... 21

Creating a dataset ... 24

Creating a dataset from multiple .csv files ... 24

Creating a dataset from one .csv file ... 27

Ingesting a dataset ... 28

Managing your datasets ... 30

Training a model ... 33

Viewing your models and evaluating their performance ... 35

Finding the root cause of an anomaly ... 38

Monitoring your equipment ... 40

Seeing how your equipment operates ... 42

Best practices ... 44

Choosing the right application ... 44

Choosing and formatting the right data ... 45

Filtering for normal data ... 46

Using failure labels ... 46

Evaluating the output ... 46

Improving your results ... 47

Consulting subject matter experts ... 48

Quotas ... 49

Supported Regions ... 49

Quotas ... 49

Security ... 51

Data protection ... 51

Encryption at rest ... 52

Encryption in transit ... 52

Key management ... 52

Identity and access management ... 53

Audience ... 54

Authenticating with identities ... 54

Managing access using policies ... 56

AWS Identity and Access Management for Amazon Lookout for Equipment ... 58

Identity-based policy examples ... 61

AWS managed policies ... 65

Troubleshooting ... 67

Monitoring ... 69

(4)

Monitoring Amazon Lookout for Equipment with AWS CloudTrail ... 70

Monitoring with Amazon CloudWatch ... 72

VPC endpoints (AWS PrivateLink) ... 74

Considerations for Lookout for Equipment VPC endpoints ... 74

Creating an interface VPC endpoint for Lookout for Equipment ... 74

Creating a VPC endpoint policy for Lookout for Equipment ... 75

Compliance validation ... 75

Resilience ... 76

Infrastructure security in Amazon Lookout for Equipment ... 76

AWS CloudFormation resources ... 77

Lookout for Equipment and AWS CloudFormation templates ... 77

Learn more about AWS CloudFormation ... 77

API Reference ... 78

Actions ... 78

CreateDataset ... 79

CreateInferenceScheduler ... 82

CreateModel ... 87

DeleteDataset ... 92

DeleteInferenceScheduler ... 94

DeleteModel ... 96

DescribeDataIngestionJob ... 98

DescribeDataset ... 101

DescribeInferenceScheduler ... 104

DescribeModel ... 108

ListDataIngestionJobs ... 113

ListDatasets ... 116

ListInferenceExecutions ... 119

ListInferenceSchedulers ... 123

ListModels ... 126

ListTagsForResource ... 129

StartDataIngestionJob ... 131

StartInferenceScheduler ... 134

StopInferenceScheduler ... 137

TagResource ... 140

UntagResource ... 142

UpdateInferenceScheduler ... 144

Data Types ... 146

DataIngestionJobSummary ... 148

DataPreProcessingConfiguration ... 150

DatasetSchema ... 151

DatasetSummary ... 152

InferenceExecutionSummary ... 153

InferenceInputConfiguration ... 156

InferenceInputNameConfiguration ... 157

InferenceOutputConfiguration ... 158

InferenceS3InputConfiguration ... 159

InferenceS3OutputConfiguration ... 160

InferenceSchedulerSummary ... 161

IngestionInputConfiguration ... 163

IngestionS3InputConfiguration ... 164

LabelsInputConfiguration ... 165

LabelsS3InputConfiguration ... 166

ModelSummary ... 167

S3Object ... 169

Tag ... 170

Common Errors ... 170

Common Parameters ... 172

(5)

Document history ... 175

(6)

Are you a first-time user of Lookout for Equipment?

What is Amazon Lookout for Equipment?

Amazon Lookout for Equipment is a machine learning (ML) service for monitoring industrial equipment that detects abnormal equipment behavior and identifies potential failures. With Lookout for Equipment, you can implement predictive maintenance programs and identify suboptimal equipment processes.

Amazon Lookout for Equipment doesn't require extensive ML knowledge or experience. You upload historical data generated by your industrial equipment to train a custom ML model that finds

potential failures by leveraging up to 300 sensors into a single model. Amazon Lookout for Equipment automatically creates the best model to learn your equipment's normal operating conditions. The model is optimized to find abnormal behavior that occurred before failures in the historical data. Using either the AWS console or the AWS SDK, you run the model to process new sensor data in real time.

To use Amazon Lookout for Equipment, you do the following:

1. Format and upload your historical data to an Amazon Simple Storage Service (Amazon S3) bucket.

You can use data from process historians, Supervisory Control and Data Acquisition (SCADA) systems, or another condition monitoring system. Format and upload data showing the periods of failures or abnormal behavior in your historical data, if you have it.

2. Create a dataset from the data that you've uploaded.

3. Choose the data in the dataset that is relevant to the asset whose behavior you want to analyze.

4. Add the periods of historical failures shown in the data, if you have it.

5. Train your ML model using Lookout for Equipment.

6. After fine-tuning the model, deploy it to monitor data in real time.

Amazon Lookout for Equipment is designed to monitor fixed and stationary industrial equipment that operates continuously, with limited variability in operating conditions. This includes rotating equipment such as pumps, compressors, motors, and turbines. It is also targeted for Process industries with applications such as heat exchangers, boilers, and inverters. Amazon Lookout for Equipment may not be ideal for equipment with significantly variable operating conditions, such as vehicles, robots, appliances, and computer numerical control (CNC) machines.

Topics

• Are you a first-time user of Lookout for Equipment? (p. 1)

• Pricing for Amazon Lookout for Equipment (p. 2)

Are you a first-time user of Lookout for Equipment?

If you are a first-time user of Lookout for Equipment, we recommend that you read the following sections in the listed order:

1.How Amazon Lookout for Equipment works (p. 3) – Explains how Lookout for Equipment works and shows you how you can build a predictive maintenance system that meets your specific needs.

2.Best practices with Lookout for Equipment (p. 44) – Explains some basic Lookout for Equipment concepts and shows you how to get started with analyzing your data.

(7)

Pricing for Amazon Lookout for Equipment

3.Use case: fluid pump (p. 5) – Provides a detailed example that you can use to explore Lookout for Equipment.

Pricing for Amazon Lookout for Equipment

For information, see Amazon Lookout for Equipment Pricing.

(8)

How Amazon Lookout for Equipment works

Amazon Lookout for Equipment uses machine learning to detect abnormal behavior in your equipment and identify potential failures. Each piece of industrial equipment is referred to as an industrial asset, or asset. To use Lookout for Equipment to monitor your asset, you do the following:

1. Provide Lookout for Equipment with your asset's data. The data come from sensors that measure different features of your asset. For example, you could have one sensor that measures temperature and another that measures pressure.

2. Train a custom ML model on the data.

3. Monitor your asset with the model that you've trained.

You need to train a model for each of your assets because they each have their own data signatures. A data signature indicates the distinct behavior and characteristics of an individual asset. This signature depends on the age of the equipment, its operating environment, what sensors are installed (including process data), who operates it, and many other factors. You use Amazon Lookout for Equipment to build a custom ML model for each asset. For example, you would build a custom model for each of two assets of the same asset type, Pump 1 and Pump 2.

The model is trained to use data to establish a baseline for the asset. It's trained to know what constitutes normal behavior. As it monitors your equipment, it can identify abnormal behavior that might indicate a precursor to an asset failure. Amazon Lookout for Equipment uses machine learning to detect deviations from normal behavior because asset failures are rare and even the same failure type might have its own unique data pattern. All detectable failures are preceded by behavior or conditions that fall out of the normal behavior of the equipment, so Lookout for Equipment is designed to look for those behaviors or conditions.

If you have the data available, you can highlight abnormal equipment behavior using label data. The trained model can use the anomalous behavior in the dataset to improve its performance.

When you train a model, Amazon Lookout for Equipment evaluates how different types of ML models perform with your asset's data. It chooses the model that performs the best on the dataset to monitor your equipment.

You can now use the model to monitor your asset. You can schedule the frequency with which Amazon Lookout for Equipment monitors the asset.

Although Amazon Lookout for Equipment can warn you of a potential failure, it cannot tell you the exact failure mode. It can use the sensors from which it analyzed data to indicate a failure. You can use this information to see if your equipment is in a state that could lead to a failure.

1. Create and properly format .csv files containing your sensor data. For more information, see Formatting your data (p. 18).

2. Upload your data to Amazon Simple Storage Service (Amazon S3). For more information, see Uploading your data into Amazon S3 (p. 21).

3. Use a schema to create a dataset from the .csv files that you've uploaded. A schema defines the organization of your data in JSON format. The dataset that you generate from this process is a container for the sensor data that you've uploaded. For more information, see Creating a dataset in Amazon Lookout for Equipment (p. 24).

(9)

4. Ingest the dataset into Amazon Lookout for Equipment. Ingesting the dataset imports it into a format that the ML model can use for training. For more information, see Ingesting a dataset (p. 28).

5. Train a model on the dataset. For more information about training a model, see Training a model (p. 33).

6. Monitor your asset with the model that you've trained. For more information, see Monitoring your equipment in real time (p. 40).

You repeat the preceding steps for each asset that you want to monitor. Before you use Amazon

Lookout for Equipment to monitor your equipment, you need to set it up. To set up Amazon Lookout for Equipment, see Setting up Lookout for Equipment (p. 8).

(10)

Use case: fluid pump

Example

Lookout for Equipment is designed primarily for stationary industrial equipment that operates continuously. This includes many types of equipment, including pumps, compressors, motors, and turbines.

As an example of using Lookout for Equipment on data from a high-level machine , let's look at a fluid pump.

In a simplified form, this fluid pump consists of three major components and their sensors. Note that this is just an example and not a complete list of features and components of such a pump.

1.Motor – The motor converts electricity into mechanical rotation. Key sensors might measure the current, voltage, or revolutions per minute (RPM).

2.Bearing – Bearings keep the rotating shaft in position while allowing it to rotate with minimal friction.

Key sensors measure vibration.

3.Pump – The pump is an impeller that rotates on the shaft and pulls fluid from one direction and forces fluid in another direction, similar to a boat propeller. Key sensors measure inlet and outlet flow rate, pressure, and temperature.

For a simple application of Amazon Lookout for Equipment, let's say that the only available data consists of measurements of how fast the pump is spinning in RPM, and the outlet flow rate of the fluid. The following historical time-series plots show both sets of measurements.

These graphs show the expected relationship between RPM and flow rate: as the pump rotates faster, the fluid flows faster. The graphs show two operating modes: one with low RPM and a low flow rate, and a second mode with high RPM and high flow rate. In this case, Amazon Lookout for Equipment wants to learn this normal relationship in terms of operating modes. .The following graph shows another way to visualize the learned normal operating modes.

(11)

The normal behavior of this pump is clear. The operator runs the pump at low RPM and high RPM in order to get a low flow rate or a high flow rate. As the pump continues to run, we expect that the data will continue to fall into one of these two operating modes. However, if the pump starts to have problems, this relationship might not hold true.

Over time, the impeller (the part similar to a boat propeller) starts to rust, chip, loosen, or become misaligned. As this happens, the data might show abnormal behavior. When the pump rotates at higher a RPM, the flow rate remains low, as shown in the following graph.

These types of issues are precisely what Amazon Lookout for Equipment is designed to detect.

In this case, we see a simple representation of the normal operating states of the pump and abnormal behavior if the pump has an issue. The following graph shows a simplified view of how Lookout for

(12)

Equipment detects the output over time. When the relationship between RPM and flow rate is normal, Lookout for Equipment detects that everything is normal. However, as the RPM increases but the flow rate stays the same, Lookout for Equipment starts detecting abnormal behavior. The vertical red line denotes the potential failure point for the pump, at which unplanned downtime occurs.

This is a very simple example of a straightforward application with only two inputs (RPM and flow rate) that have a direct linear relationship with each other. The situation become dramatically more complex when we add additional inputs, such as pressure, temperature, motor current, motor voltage, bearing vibration, and so on. The more you increase the number of inputs, the more complex the relationships between all of the inputs becomes. With some equipment, the number of inputs can easily reach into the hundreds. In addition, this simplified example doesn't attempt to represent the time-series aspect of the problem—the model also has to learn the changes in relationships over time. For example, even subtle changes in vibration over time can be critical to detecting issues.

Amazon Lookout for Equipment works with up to 300 inputs at once. Keep in mind that to accurately analyze the data, Lookout for Equipment requires that the inputs are related to issues that you want to find, and that the historical data used to train (and evaluate) the model represents the equipment's normal behavior.

(13)

Step 1: Set up an account and IAM user

Setting up Lookout for Equipment

To set up Lookout for Equipment, open an AWS account and create an AWS Identity and Access Management (IAM) user. Then download and configure the AWS Command Line Interface (AWS CLI).

Topics

• Step 1: Set up an AWS account and IAM user (p. 8)

• Step 2: Set up IAM Access Roles for Lookout for Equipment (p. 9)

• Step 3: Set up the AWS Command Line Interface (AWS CLI) (p. 16)

Step 1: Set up an AWS account and IAM user

Before you can start with Lookout for Equipment, you must sign up for an AWS account if you don't already have one and create an AWS Identity and Access Management (IAM) user.

Important

Lookout for Equipment provides a management console, which you can use for most tasks.

Lookout for Equipment also provides APIs to upload data collected by your existing sensors and build, train, and deploy machine learning models using that data. You must use the AWS Command Line Interface (AWS CLI) to use these operations or write code. For example, to upload samples of normal and abnormal sensor data so that Lookout for Equipment can create a custom model to find potential failures, you must either use the AWS CLI or write code to make requests, using either the APIs directly or by using the AWS SDKs.

Topics

• Sign up for AWS (p. 8)

• Create an IAM user (p. 8)

• Next step (p. 9)

Sign up for AWS

When you sign up for Amazon Web Services (AWS), your AWS account is automatically signed up for all AWS services, including Lookout for Equipment.

If you already have an AWS account, skip to the next topic.

To create an AWS account

1. Open https://portal.aws.amazon.com/billing/signup.

2. Follow the online instructions.

Part of the sign-up procedure involves receiving a phone call and entering a verification code on the phone keypad.

Record your AWS account ID because you'll need it for the next task.

Create an IAM user

Services in AWS, such as Lookout for Equipment, require that you provide credentials when you access them so that the service can determine whether you have permissions to access the resources owned by

(14)

Next step

that service. The console requires your password. You can create access keys for your AWS account to access the AWS CLI or API.

However, we don't recommend that you access AWS using the credentials for your AWS account. Instead, we recommend that you use AWS Identity and Access Management (IAM). Create an IAM user, add the user to an IAM group with administrative permissions, and then grant administrative permissions to the IAM user that you created. You can then access AWS using a special URL and that IAM user's credentials.

If you signed up for AWS, but you haven't created an IAM user for yourself, you can create one using the IAM console.

To create an administrator user and sign in to the console

1. Create an administrator user called adminuser in your AWS account. For instructions, see Creating Your First IAM User and Administrators Group in the IAM User Guide.

2. A user can sign in to the AWS Management Console using a special URL. For more information, How Users Sign In to Your Account in the IAM User Guide.

You can use this same process to create more groups and users and to give your users access to your AWS account resources.

For more information about IAM, see the following:

• AWS Identity and Access Management (IAM)

• Getting started

• IAM User Guide

Next step

Step 2: Set up IAM Access Roles for Lookout for Equipment (p. 9)

Step 2: Set up IAM Access Roles for Lookout for Equipment

When you create a data source or set up an inference scheduler, Lookout for Equipment needs access to the AWS resources required to create that Lookout for Equipment resource. You must create an AWS Identity and Access Management (IAM) permissions policy before you create the Lookout for Equipment resource. When you call the operation, you must provide the Amazon Resource Name (ARN) of a role with permissions to perform that operation. For example, if you are calling the CreateInferenceScheduler (p. 82) operation, it requires an Amazon S3 bucket for both the input data and for the output data. You would need to provide Lookout for Equipment with a role with a permissions policy to access the bucket.

The AWS console enables you to create a new IAM role to match your specific needs.

Create an IAM role

An IAM role is an IAM identity that you can create in your account that has specific permissions. It's similar to an IAM user in that it's an AWS identity with permission policies that determine what the identity can and cannot do in AWS. However, instead of being uniquely associated with one person, a role can be assumed by anyone in your organization who needs it. As well, a role does not have standard long-term credentials such as a password or access keys associated with it. Instead, when you assume a role, AWS provides you with temporary security credentials for your role session.

(15)

Create an IAM role

Two types of access are discussed here:

• AWS Management Console access, which is used primarily for accessing the Lookout for Equipment console.

• SageMaker, which is a managed service that can be used to easily access Lookout for Equipment programmatically when making API calls.

AWS Management Console access: The console always uses your original credentials to authorize a switch to an IAM role. This applies whether you sign in as an IAM user, as a SAML-federated role, or as a web-identity federated role. For example, if you switch to Role A, IAM uses your original user credentials (or those of your federated role) to determine whether you're allowed to assume Role A. If you then switch to Role B while you're using Role A, the console still uses your original user credentials to authorize the switch, not the credentials for Role A.

SageMaker: Amazon SageMaker is a managed service, so it performs operations on your behalf using the hardware that's managed by SageMaker. It can only perform operations that the user permits. In other words, a SageMaker user can grant permissions with an IAM role where the user then passes that role when making an API call. For example, if you want to use the CreateModel (p. 87) operation, you need to pass a RoleArn, which is the ARN of an IAM role with permissions to the data source from which the model is to be created.

The following shows you how to create an IAM role to delegate access to Lookout for Equipment from either the AWS Management Console or from an Amazon SageMaker instance.

To create an IAM role

1. Open the Lookout for Equipment console at https://console.aws.amazon.com/lookoutequipment.

2. Enter IAM in the search bar and then choose IAM Service from the results.

3. Under Access management on the left navigation pane, choose Roles.

4. Choose Create role.

5. Under Select type of trusted entity, choose AWS service.

6. From the list of services, choose SageMaker, and then choose Next: Permissions.

(16)

Create an IAM role

7. Choose Next: Tags.

8. Choose Next: Review.

9. For Role name, enter l4e-role, and then choose Create Role.

(17)

Attach policies to the IAM role

Attach policies to the created IAM role

You now need to attach the access policies that allow Lookout for Equipment to access other required AWS services.

To attach policies to the created IAM role

1. Search for the created IAM role in the search bar and choose it from the returned results.

2. Choose Attach policies.

(18)

Attach policies to the IAM role

3. Search for the following additional managed policies and select them from the returned results:

• AmazonS3FullAccess

• IAMFullAccess

• AmazonLookoutEquipmentFullAccess 4. Choose Attach policy.

(19)

Attach policies to the IAM role

(20)

Edit the trust relationship

Edit the trust relationship for the created IAM role

A trust relationship defines what entities can assume the role that you've created. When you created the role, you chose SageMaker as a trusted entity. The same role can also be used for Lookout for Equipment Console access. Modify the role so that the trusted relationship is between your AWS account and Lookout for Equipment.

To edit the trust relationship of your created IAM role

Under Access management on the left navigation pane, choose Roles.

1. Search for the created IAM role in the search bar and choose it from the returned results.

2. On the Trust relationships tab, choose Edit trust relationship.

3. Under Policy Document, paste the following policy.

{

"Version": "2012-10-17", "Statement": [

{

"Effect": "Allow", "Principal": {

"Service": "lookoutequipment.amazonaws.com"

},

"Action": "sts:AssumeRole"

}, {

(21)

Next step

"Effect": "Allow", "Principal": {

"Service": "sagemaker.amazonaws.com"

},

"Action": "sts:AssumeRole"

} ]}

We recommend that you use the aws:SourceAccount and aws:SourceArn condition keys to protect yourself against the confused deputy problem. The source account is the owner of the experiment and the source ARN is the ARN of the experiment. For example, you could add the following condition block to the trust policy.

In the following example, replace account_id with your own information.

"Condition": { "StringEquals": {

"aws:SourceAccount": "account_id"

},

"ArnLike": {

"aws:SourceArn": [

"arn:aws:lookoutequipment:us-west-2:account_id:model/*", "arn:aws:lookoutequipment:us-west-2:account_id:dataset/*",

"arn:aws:lookoutequipment:us-west-2:account_id:inference-scheduler/*"

] } }

Next step

Step 3: Set up the AWS Command Line Interface (AWS CLI) (p. 16)

Step 3: Set up the AWS Command Line Interface (AWS CLI)

To set up the AWS CLI

1. Download and configure the AWS CLI. For instructions, see the following topics in the AWS Command Line Interface User Guide:

• Getting Set Up with the AWS Command Line Interface

• Configuring the AWS Command Line Interface

2. In the AWS CLI config file, add a named profile for the administrator user.

[profile adminuser]

aws_access_key_id = adminuser access key ID

aws_secret_access_key = adminuser secret access key region = aws-region

(22)

Step 3: Set Up the AWS CLI

You use this profile when running the AWS CLI commands. For more information about named profiles, see Named Profiles in the AWS Command Line Interface User Guide. For a list of AWS Regions, see Regions and Endpoints in the Amazon Web Services General Reference.

3. Verify the setup by typing the following help command at the command prompt.

aws help

(23)

Formatting your data

Transferring historical data into Amazon Lookout for Equipment

To transfer your data into Amazon Lookout for Equipment, you must:

• Properly format your data in .csv files.

• Create a dataset from the .csv files.

• Ingest the dataset into Amazon Lookout for Equipment.

By following the preceding steps, you can train your model on a properly formatted dataset. You can use the model that you've trained to monitor your equipment in real time.

Topics

• Formatting your data (p. 18)

• Creating a dataset in Amazon Lookout for Equipment (p. 24)

• Ingesting a dataset (p. 28)

• Managing your datasets (p. 30)

Next step

Formatting your data (p. 18)

Formatting your data

To monitor your equipment, you must provide Amazon Lookout for Equipment with time-series data from the sensors on your equipment. The data that you're providing to Lookout for Equipment is a series of numerical measurements from the sensors. You provide this data from either a data historian or Amazon Simple Storage Service (Amazon S3). A data historian is a software program that records and retrieves sensor data from your equipment.

To provide Amazon Lookout for Equipment with time-series data from the sensors, you must use properly formatted .csv files to create a dataset. Creating a dataset aggregates the data in a format that is suitable for analysis. You create a dataset for a single piece of equipment, or asset. You train an ML model on the dataset that you create. You then use that model to monitor your asset. You don't have to use all the data from the sensors to train a model. You train a model using data from some of the sensors in the dataset.

You can store the data for your asset in one of the following ways:

• Recommended: Using one .csv file for each sensor

• Storing all of the sensor data in one .csv file

Each .csv file must have at least two columns. The first column of the file is a timestamp that indicates the date and time. You must have at least one additional column containing the data from a sensor. Each subsequent column can have data from a different sensor.

(24)

Formatting your data

You must have a double (numerical) as the data type for your sensor data. You can only train your model on numeric data.

When you are preparing your data, you should keep the following information in mind:

• The data across all of your .csv files must span at least 90 days. For example, you can have two .csv files, with one file having data from January and February, and the other having data from March and the first part of April.

• You can create a dataset with up to 3,000 sensors, but you can train a model on up to 300 sensors.

• The maximum length of a sensor name is 200 characters.

• The size of a .csv file can't exceed 5 GB. If you want to create a dataset greater than 5 GB, you must use multiple .csv files.

• The files that you use to create a dataset can't exceed 50 GB in total.

• You can use up to 1,000 files to create a dataset.

• You can use the following delimiters for the data in the timestamp column:

• '-'

• '_'

• ' '

NoteQuotation marks are used around the delimiters to make them easier to read.

• The timestamp column can use the following formats:

• yyyy-MM-dd-HH-mm-ss

• yyyy-MM-dd'T'HH:mm:ss

• yyyy-MM-dd HH:mm:ss

• yyyy-MM-dd-HH:mm:ss

• yyyy/MM/dd'T'HH:mm:ss

• yyyy/MM/dd HH:mm:ss

• yyyy MM dd'T'HH:mm:ss

• yyyy MM dd HH:mm:ss

• yyyyMMdd'T'HH:mm:ss

• yyyyMMdd HH:mm:ss

• yyyyMMddHHmmss

• yyyy-MM-dd'T'HH:mm

• yyyy-MM-dd HH:mm

• yyyy-MM-dd-HH:mm

• yyyy/MM/dd'T'HH:mm

• yyyy/MM/dd HH:mm

• yyyy MM dd'T'HH:mm

• yyyy MM dd HH:mm

• yyyyMMdd'T'HH:mm

• yyyyMMdd HH:mm

• yyyyMMddHHmm

• The valid characters that you can use in the column names of the dataset are 0 to 9, a to z, A to Z, .,

\ _,and -.

You can use label data to highlight any part of your dataset where your asset functioned abnormally. For more information, see the section called “Label data” (p. 21).

The following examples show you the different ways that you can format a .csv file.

(25)

Formatting your data

Formatting your data with one .csv file for each sensor

If your are storing the data from each sensor in one .csv file, use the following table to see how to format the data.

SensorData.csv

Timestamp Sensor

3

1/1/2020 0:00 34

1/1/2020 0:05 33

1/1/2020 0:10 35

1/1/2020 0:15 33

1/1/2020 0:20 34

The following example shows the information from the preceding table as a .csv file.

Timestamp,Sensor 3 1/1/2020 0:00,34 1/1/2020 0:05,33 1/1/2020 0:10,35 1/1/2020 0:15,33 1/1/2020 0:20,34

We recommend using "Timestamp" as the name for the column with the time-series data. For the column with data from the sensor, we recommend using a name that distinguishes it from other sensors.

Formatting all the data for an asset in one .csv file

To store the data for your asset in one .csv file, you arrange the data in the following format.

AssetData.csv

Timestamp Sensor

1Sensor 2

1/1/2020 0:00 212

1/1/2020 0:05 311

1/1/2020 0:10 510

1/1/2020 0:15 39

1/1/2020 0:20 412

The following example shows the information from the preceding table as a .csv file.

(26)

Uploading your data into Amazon S3

Timestamp,Sensor 1,Sensor 2 1/1/2020 0:00,2,12

1/1/2020 0:05,3,11 1/1/2020 0:10,5,10 1/1/2020 0:15,3,9 1/1/2020 0:20,4,12

You can choose your column names. We recommend using "Timestamp" as the name for the column with the time-series data. For the names of the columns with data from your sensors, we recommend using names that distinguish one sensor from another.

Label data

If you have them available, we recommend using labels for abnormal equipment behavior in your data.

These labels could be applied to periods when the equipment did not function properly. You store the label data as a .csv file that consists of two columns. The file has no header. The first column has the start time of the abnormal behavior. The second column has the end time.

The following example shows how your label data should appear as a .csv file.

2020-02-01T20:00:00.000000,2020-02-03T00:00:00.000000 2020-07-01T20:00:00.000000,2020-07-03T00:01:00.000000

Next step

Uploading your data into Amazon S3 (p. 21)

Uploading your data into Amazon S3

Amazon Lookout for Equipment needs to access your .csv files to create a dataset. You must store the files in the correct location and provide Lookout for Equipment with the information that it needs to access them.

To understand how to properly store your .csv files, you need to be familiar with the following Amazon Simple Storage Service (Amazon S3) concepts:

• Bucket – A container to store your objects.

• Object – The entity stored in the S3 bucket. In this case, it's your training or tuning text files.

• Key – The unique identifier for an object within a bucket.

• Prefix – Any portion of a key up to the final delimiter. You use prefixes to organize your data and specify objects in the S3 bucket.

To upload your data, you must first create an Amazon S3 bucket. To learn how to create an S3 bucket, see Create your first S3 bucket.

Amazon S3 uses prefixes to organize the storage of your files. A prefix is a logical grouping of objects in a bucket that is separated by a delimiter. The prefix value is similar to a directory name that you use to store similar data under the same directory in a bucket. For more information about prefixes, see Organizing objects using prefixes.

The Amazon S3 console supports the folder concept to help you see how prefixes organize your data.

When you create an additional folder, you modify the prefix of your object key by adding another

(27)

Uploading your data into Amazon S3

delimiter. To learn more about using folders, see Organizing objects in the Amazon S3 console using folders.

The Amazon S3 locations that you use to store your .csv files and the prefixes that Amazon Lookout for Equipment uses to access them depend on how your data is organized. For more information, see the following sections.

If the sensor data for your asset is stored in multiple .csv files

You use the following prefix to store the data for each sensor on your asset.

s3://DOC-EXAMPLE-BUCKET/AssetName/SensorName/SensorName.csv If you had sensors on your asset with the following sensor names:

• Sensor1

• Sensor2

• Sensor3

You would use the following objects keys for the sensors:

• s3://DOC-EXAMPLE-BUCKET/AssetName/Sensor1/Sensor1.csv

• s3://DOC-EXAMPLE-BUCKET/AssetName/Sensor2/Sensor2.csv

• s3://DOC-EXAMPLE-BUCKET/AssetName/Sensor3/Sensor3.csv

The object key s3://DOC-EXAMPLE-BUCKET/AssetName/Sensor1/Sensor1.csv has the following prefixes:

• s3://DOC-EXAMPLE-BUCKET/AssetName/

• s3://DOC-EXAMPLE-BUCKET/AssetName/Sensor1/

By using the s3://DOC-EXAMPLE-BUCKET/AssetName/ prefix, you can access Sensor1.csv, Sensor2.csv, and Sensor3.csv.

The following procedure shows you how to use the Amazon S3 console to upload a .csv file containing data from one sensor to an Amazon S3 bucket.

To upload a .csv file of one sensor to an Amazon S3 bucket

1. Sign in to the AWS Management Console and open the Amazon S3 console at https://

console.aws.amazon.com/s3/.

2. In the Buckets list, choose the name of the bucket that you've created to store the data for your sensor.

3. Choose Create folder.

4. Specify the name of the asset as the folder name (for example, Pump1). Then choose Create folder.

5. Choose the folder with the name of the asset.

6. Choose Create folder.

7. Specify the name of the sensor as the folder name (for example, Sensor1).

8. Choose the folder with the sensor name.

9. Choose Upload. Then choose Add files.

10. Choose the .csv file containing your sensor data.

(28)

Uploading your data into Amazon S3

You've successfully uploaded your data. To learn how to use a schema to create a dataset from your .csv files, see Creating a dataset from multiple .csv files (p. 24).

If the sensor data for your asset is stored in one .csv file

You use the following object key structure to store the data for each sensor on your asset:

s3://DOC-EXAMPLE-BUCKET/FacilityName/AssetName/AssetName.csv

For FacilityName, you specify the location of your asset. For example, Powerplant1 or Factory1 could be facility names.

The object key s3://DOC-EXAMPLE-BUCKET/FacilityName/AssetName/AssetName.csv has the following prefixes:

• s3://DOC-EXAMPLE-BUCKET/FacilityName/

• s3://DOC-EXAMPLE-BUCKET/FacilityName/AssetName/

When you ingest your model, you use the s3://DOC-EXAMPLE-BUCKET/FacilityName/ prefix to access the .csv file.

To upload a .csv file of one sensor to an Amazon S3 bucket

1. Sign in to the AWS Management Console and open the Amazon S3 console at https://

console.aws.amazon.com/s3/

2. In the Buckets list, choose the name of the bucket that you've created to store the data for your sensor.

3. Choose Create folder.

4. Specify the name of the facility as the folder name (for example, Powerplant1). Then choose Create folder.

5. Choose the folder with the name of the facility.

6. Choose Create folder.

7. Specify the name of the asset as the folder name (for example, Motor1).

8. Choose the folder with the asset name.

9. Choose Upload. Then choose Add files.

10. Choose the .csv file containing the sensor data from your asset.

You've successfully uploaded your data. To learn how to use a schema to create a dataset from your .csv files, see Creating a dataset from one .csv file (p. 27).

Uploading label data (optional)

After you upload the sensor data, you can upload label data to highlight any abnormal equipment behavior. The following is an Amazon S3 prefix that you should use for your label data:

s3://DOC-EXAMPLE-BUCKET1/label-data

The following are example S3 locations where you would store the .csv files of your label data:

s3://DOC-EXAMPLE-BUCKET1/label-data/label-data01.csv s3://DOC-EXAMPLE-BUCKET1/label-data/label-data02.csv

After you've uploaded the files, you can create a dataset from your .csv files. For more information, see Creating a dataset in Amazon Lookout for Equipment (p. 24).

(29)

Creating a dataset

Next step

Creating a dataset in Amazon Lookout for Equipment (p. 24)

Creating a dataset in Amazon Lookout for Equipment

After you've uploaded your data to Amazon Simple Storage Service (Amazon S3) using the correct prefixes and object keys, you create a dataset from them. A dataset is a container for all of the data that you've uploaded. You train the machine learning model from Amazon Lookout for Equipment on this dataset.

To create a dataset from your .csv files, you create a schema for both the files and the fields within them.

A schema is the organizational framework that Amazon Lookout for Equipment applies to your data.

Lookout for Equipment uses this schema to store all of the data in one dataset.

The schema that you define depends on how you've stored the data. Use one of the following sections to help you create a schema.

• Creating a dataset from multiple .csv files (p. 24)

• Creating a dataset from one .csv file (p. 27)

Creating a dataset from multiple .csv files

If you've uploaded multiple .csv files, with each sensor having its own .csv file, you would use the following schema to create a dataset from those files.

{ "Components": [ {

"ComponentName": "Sensor1", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor1", "Type": "DOUBLE"

} ] }, {

"ComponentName": "Sensor2", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor2", "Type": "DOUBLE"

} ] }, {

(30)

Creating a dataset from multiple .csv files

"ComponentName": "Sensor3", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor3", "Type": "DOUBLE"

} ] }, {

"ComponentName": "Sensor4", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor4", "Type": "DOUBLE"

} ] } ] }

In the preceding schema, Components refers to a collection of identifiers for the .csv files of your sensors. The ComponentName is the portion of a prefix of an Amazon S3 object key that identifies a .csv file. The following examples show you how the values specified for ComponentName access the .csv files you've stored in your Amazon S3 buckets:

• "ComponentName: "Sensor1" accesses s3://DOC-EXAMPLE- BUCKET/AssetName/Sensor1/Sensor1.csv

• "ComponentName: "Sensor2" accesses s3://DOC-EXAMPLE- BUCKET/AssetName/Sensor2/Sensor2.csv

• "ComponentName: "Sensor3" accesses s3://DOC-EXAMPLE- BUCKET/AssetName/Sensor3/Sensor3.csv

• "ComponentName: "Sensor4" accesses s3://DOC-EXAMPLE- BUCKET/AssetName/Sensor4/Sensor4.csv

You define a Columns object for each ComponentName that you define in the schema. The Name fields in the Columns object must match the columns in your .csv files.

Within each Columns object, the Name fields that reference the columns containing the timestamp data must have the Type field specified as DATETIME. The Name fields that reference your sensor data must have a Type of DOUBLE.

You can use a schema to create a dataset for your .csv files in the Amazon Lookout for Equipment console, but we recommend using the API. You can use the following example code with the AWS SDK for Python (Boto3) to create a dataset.

import boto3 import json import pprint

from botocore.config import Config config = Config(

(31)

Creating a dataset from multiple .csv files

region_name = 'Region' # Choose a valid AWS Region

)lookoutequipment = boto3.client(service_name="lookoutequipment", config=config) dataset_schema = {

"Components": [ {

"ComponentName": "Sensor1", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor1", "Type": "DOUBLE"

} ] }, {

"ComponentName": "Sensor2", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor2", "Type": "DOUBLE"

} ] }, {

"ComponentName": "Sensor3", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor3", "Type": "DOUBLE"

} ] }, {

"ComponentName": "Sensor4", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor4", "Type": "DOUBLE"

} ] } ] }

dataset_name = "dataset-name"

data_schema = {

'InlineDataSchema': json.dumps(dataset_schema),

}create_dataset_response = lookoutequipment.create_dataset(DatasetName=dataset_name, DatasetSchema=data_schema)

pp = pprint.PrettyPrinter(depth=4)

(32)

Creating a dataset from one .csv file

pp.pprint(create_dataset_response)

Next step

Ingesting a dataset (p. 28)

Creating a dataset from one .csv file

If you've uploaded one .csv file containing all of the sensor data for the asset, you would use the following schema to create a dataset from that file.

{

"Components": [ {

"ComponentName": "AssetName", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor1", "Type": "DOUBLE"

}, {

"Name": "Sensor2", "Type": "DOUBLE"

}, {

"Name": "Sensor3", "Type": "DOUBLE"

}, {

"Name": "Sensor4", "Type": "DOUBLE"

}, ] } ]}

The "ComponentName" is the portion of the prefix of the Amazon S3 object key that identifies the .csv file containing the sensor data for your asset. When you specify the value of "ComponentName" as "AssetName", you access s3://DOC-EXAMPLE-

BUCKET/FacilityName/AssetName/AssetName.csv. You enter the columns of your dataset in the Columns object. The name of each column in your .csv file must match the Name in the schema. For the column containing the time stamp data, you must specify the value of "Type" as "DATETIME" in the schema. For the columns containing data from sensors, you must specify the value of "Type" as

"DOUBLE".

You can use a schema to create a dataset for your .csv files in the Amazon Lookout for Equipment console, but we recommend using the API. You can use the following example code using the AWS SDK for Python (Boto3) to create a dataset.

import boto3 import json

(33)

Ingesting a dataset

import pprint

from botocore.config import Config config = Config(

region_name = 'Region' # Choose a valid AWS Region.

)lookoutequipment = boto3.client(service_name="lookoutequipment", config=config) dataset_schema = {

"Components": [ {

"ComponentName": "AssetName", "Columns": [

{

"Name": "Timestamp", "Type": "DATETIME"

}, {

"Name": "Sensor1", "Type": "DOUBLE"

}, {

"Name": "Sensor2", "Type": "DOUBLE"

}, {

"Name": "Sensor3", "Type": "DOUBLE"

}, {

"Name": "Sensor4", "Type": "DOUBLE"

}, ] } ]

}dataset_name = "dataset-name"

data_schema = {

'InlineDataSchema': json.dumps(dataset_schema), }

create_dataset_response = lookoutequipment.create_dataset(DatasetName=dataset_name, DatasetSchema=data_schema)

pp = pprint.PrettyPrinter(depth=4) pp.pprint(create_dataset_response)

Next step

Ingesting a dataset (p. 28)

Ingesting a dataset

Amazon Lookout for Equipment requires you to create a dataset from your .csv files containing your sensor data and the schema that you've provided for those files. For more information about using a schema to create a dataset, see Creating a dataset in Amazon Lookout for Equipment (p. 24).

To convert the dataset into a format that is suitable for analysis, you must ingest it. Ingesting a dataset imports it into Amazon Lookout for Equipment and lets you train a machine learning model on it. To ingest your data, you start the data ingestion step and specify the Amazon Simple Storage Service (Amazon S3) location that contains your sensor data.

You can use one the following procedures to ingest a dataset.

(34)

Ingesting a dataset

Console

To use the console to ingest a dataset, choose the Amazon S3 prefix that selects all of the sensor data for the asset.

To ingest a dataset (console)

1. Sign in to AWS Management Console and open the Amazon Lookout for Equipment console at Amazon Lookout for Equipment console.

2. Choose a dataset that you've created.

3. Choose Ingest data.

4. For S3 location, provide the Amazon S3 prefix for all of the sensor data for the asset.

a. If you created the dataset from multiple .csv files, with each file containing data from one sensor, you would use the prefix: s3://DOC-EXAMPLE-BUCKET1/AssetName/.

b. If you created the dataset from a single .csv file for your asset, you would use the prefix:

s3://DOC-EXAMPLE-BUCKET1/FacilityName/.

5. For IAM role, choose a role that provides permissions to access the .csv files you've stored in Amazon S3. If you don't have a role that provides permissions, choose Create a role.

6. Choose Ingest.

AWS SDK for Python (Boto3)

Use the following AWS SDK for Python (Boto3) example code to ingest your dataset. You must have the modules installed from the code examples that showed you how to create a dataset to successfully use the following code.

import boto3 import time

from botocore.config import Config

config = Config(

region_name = 'Region' #Choose a valid AWS Region )

lookoutequipment = boto3.client(service_name="lookoutequipment", config=config)

INGESTION_DATA_SOURCE_BUCKET = 'DOC-EXAMPLE-BUCKET1'

# If you're ingesting multiple .csv files of your sensor data, use the following Amazon S3 path: s3://DOC-EXAMPLE-BUCKET/AssetName/. If you're ingesting a single .csv file of your asset data, use the following Amazon S3 path: s3://DOC-EXAMPLE-BUCKET/FacilityName/.

INGESTION_DATA_SOURCE_PREFIX = 'my_data/sensor_readings/'

# The ROLE_ARN and DATASET_NAME values that are used in this script have been defined in the previous SDK for Python example code for creating a dataset.

data_ingestion_role_arn = ROLE_ARN dataset_name = DATASET_NAME ingestion_input_config = dict()

ingestion_input_config['S3InputConfiguration'] = dict(

[

('Bucket', INGESTION_DATA_SOURCE_BUCKET), ('Prefix', INGESTION_DATA_SOURCE_PREFIX) ]

)

(35)

Managing your datasets

# Start data ingestion

start_data_ingestion_job_response = lookoutequipment.start_data_ingestion_job(

DatasetName=dataset_name,

RoleArn=data_ingestion_role_arn,

IngestionInputConfiguration=ingestion_input_config)

data_ingestion_job_id = start_data_ingestion_job_response['JobId']

data_ingestion_status = start_data_ingestion_job_response['Status']

print(f'=====Data Ingestion job is started. Job ID: {data_ingestion_job_id}=====\n')

# Wait until completes

print("=====Polling Data Ingestion Status=====\n") print("Data Ingestion Status: " + data_ingestion_status) while data_ingestion_status == 'IN_PROGRESS':

time.sleep(30)

describe_data_ingestion_job_response =

lookoutequipment.describe_data_ingestion_job(JobId=data_ingestion_job_id) data_ingestion_status = describe_data_ingestion_job_response['Status']

print("Data Ingestion Status: " + data_ingestion_status) print("\n=====End of Polling Data Ingestion Status=====")

Managing your datasets

You've created a dataset or multiple datasets that are in a format that Amazon Lookout for Equipment can use to analyze the data from your equipment. You might want to see which datasets you've created, where the data came from, and who created it. You might be able to use that information to determine whether you need to create a new dataset. You can train a model on the new dataset that might monitor your equipment more accurately than the model that you've trained on the dataset you've previously created. To make managing your datasets easier, you can delete the datasets that you no longer need.

For each dataset, you can view the dataset details and the data source. The data source shows you the IAM role ARN (Amazon Resource Number) used to create the dataset. The IAM role ARN shows you which AWS account number and IAM role were used to create the dataset. It also shows you the Amazon Simple Storage Service (Amazon S3) location of the multiple .csv files, or the single .csv file used to create the dataset.

The dataset details include the schema, the organizational framework, used to create the dataset. The dataset details also tell you when the dataset was created and when it was last modified.

For a dataset, the following procedures enable you to view the dataset details, the data source, and delete that dataset.

To manage your datasets (Console)

To manage your datasets (Console)

This procedure uses the Amazon Lookout for Equipment console to first view a data source, then view the dataset details, and then delete a dataset.

1. Sign in to AWS Management Console and open the Amazon Lookout for Equipment console at Amazon Lookout for Equipment console.

2. For Datasets, choose a dataset.

3. For Step 2. Ingest data, choose View data source.

4. View both the IAM role ARN and the S3 location on this page.

(36)

Managing your datasets

5. Preceding Data source, for Amazon Lookout for Equipment > Datasets > dataset-name, choose the name of your dataset.

6. Navigate to the Dataset details section, which follows the How it works section.

7. To view the data schema, choose View under Data schema.

8. To delete a dataset, choose Delete under Dataset details.

9. Type the word "delete" and choose Delete.

To manage your datasets (AWS SDK for Python (Boto3))

Use the following AWS SDK for Python (Boto3) example code to manage your datasets. It will show you how to list all your datasets, get information about a dataset, and delete a dataset. You must have the modules installed from code examples that showed you how to create a dataset to successfully use the following code.

To run the following code, you need to have run the example code in either Creating a dataset from multiple .csv files (p. 24) or Creating a dataset from one .csv file (p. 27).

import boto3 import json import pprint

from botocore.config import Config

config = Config(

region_name = 'Region' # Choose a valid AWS Region )

lookoutequipment = boto3.client(service_name="lookoutequipment", config=config)

# Specify a value for the prefixes that your dataset uses to list the DATASET_NAME_PREFIX = "dataset-name"

kargs = {"MaxResults": 50}

if DATASET_NAME_PREFIX is not None:

kargs["DatasetNameBeginsWith"] = DATASET_NAME_PREFIX has_more_records = True

pp = pprint.PrettyPrinter(depth=4) print("=====Dataset Summaries=====\n") while has_more_records:

list_datasets_response = lookoutequipment.list_datasets(**kargs) if "NextToken" in list_datasets_response:

kargs["NextToken"] = list_datasets_response["NextToken"]

else:

has_more_records = False # print datasets

dataset_summaries = list_datasets_response["DatasetSummaries"]

for dataset_summary in dataset_summaries:

pp.pprint(dataset_summary)

print("\n=====End of Dataset Summaries=====")

# The following code queries a dataset

dataset_name_to_query = "example-dataset-1" # Change this to dataset name that you want to query

describe_dataset_response = lookoutequipment.describe_dataset(

DatasetName=dataset_name_to_query )

print("=====Dataset Query Response=====\n") pp = pprint.PrettyPrinter(depth=5)

(37)

Managing your datasets

pp.pprint(describe_dataset_response) print("\n=====End of Response=====\n") print("=====Schema of Dataset =====\n")

pp.pprint(json.loads(describe_dataset_response["Schema"])) print("\n=====End of Schema of Dataset=====\n")

# The following code deletes a dataset

dataset_name_to_delete = "example-dataset-1" # Change this to dataset name that you want to delete

delete_dataset_response = lookoutequipment.delete_dataset(

DatasetName=dataset_name_to_delete )

print("=====Dataset Delete Response=====\n") pp = pprint.PrettyPrinter(depth=5)

pp.pprint(delete_dataset_response) print("\n=====End of Response=====\n")

(38)

Training a model (console)

Training a model

You create a model with the dataset that you've ingested. You can train your model on up to 300 sensors in your dataset. Because failures or other serious issues with equipment are rare, Amazon Lookout for Equipment uses your dataset to establish a normal mode of behavior for your asset. If you have data showing that the asset has failed or malfunctioned, you can label those failures in the dataset. Labeling the failures or the events that required equipment maintenance can improve the accuracy of the model.

Before you train a model, you must create a dataset and ingest it. For information about creating a dataset, see Creating a dataset in Amazon Lookout for Equipment (p. 24). For information about ingesting a dataset, see Ingesting a dataset (p. 28).

When you create a model, you can use the following work flow to help improve your model's accuracy:

1. Choose the sensors that your model uses.

2. Use labels for asset failures in the dataset if you have them available.

3. Set the time range for training the model and the time range for evaluating how well it performed.

For more information, see Evaluating the output (p. 46) and Improving your results (p. 47).

4. Choose a sampling rate from the original dataset. For a dataset that has sensors taking readings every minute, you can use readings that have been taken every hour to train your model. For more information, see Evaluating the output (p. 46) and Improving your results (p. 47).

5. Provide a condition that indicates that the asset is off. Lookout for Equipment will ignore data satisfying this condition,and will not use that data in training the model.

6. Evaluate how the model performed.

7. If you want to improve the performance of the model, repeat this procedure and choose different sensors, labels, sampling rates, or time ranges.

You might believe that some sensors give more insight into the performance of your asset than others.

You can choose which sensors are most useful in training your model.

Amazon Lookout for Equipment is designed to establish a baseline for normal behavior of your assets and detect when your equipment is behaving abnormally. You can improve the model's ability to detect abnormal behavior by using label data that highlights when the equipment wasn't functioning properly.

Within your dataset, you can specify a time range for training your model and a time range for testing your model's performance. You can evaluate your model's performance only if you provide these time ranges.

You might have a lot of data in your dataset. Sampling from that dataset might help you avoid overtraining your model.

The following procedures show you how to create a model.

Training a model (console)

To train a model (console)

1. Sign in to AWS Management Console and open the Amazon Lookout for Equipment console at Amazon Lookout for Equipment console.

2. Choose a dataset that you've ingested.

(39)

Training a model (AWS SDK for Python (Boto3))

3. Choose Create model.

4. For Model name, choose a name for your model.

5. For Component name, under Fields, choose the sensors that you want to use to train your model.

6. To improve the accuracy of the model, you have the option to do the following.

• For S3 location under Historical maintenance label event (labels) data - optional, provide the Amazon S3 location of the label data. For IAM role, you must specify an IAM role that provides Amazon Lookout for Equipment access to your data in S3.

• For Training and evaluation setting - optional, provide the following:

Training data time range - The time range for training the model on your data.

Evaluation data time range - The time range for testing the model's performance on your data.

• For Time series sample rate, specify the rate that you want to downsample the data from your dataset.

• For Off-time detection - optional, specify the sensor that you will use to detect when the asset is turned off. Then select the threshold that will indicate the off state for that sensor.

Training a model (AWS SDK for Python (Boto3))

The following example code uses the AWS SDK for Python (Boto3) to train a model.

import boto3 import json import pprint import time

from datetime import datetime from botocore.config import Config config = Config(region_name = 'Region')

lookoutequipment = boto3.client(service_name="lookoutequipment", config=config) MODEL_NAME = 'model-name'

# You can choose a sampling rate for your data. The valid values are "PT1S", "PT5S", "PT10S", "PT15S", "PT30S", "PT1M", "PT5M", "PT10M", "PT15M", "PT30M", "PT1H". S - second, M - minute, H - hour

TARGET_SAMPLING_RATE = 'sampling-rate'

# If you have label data, specify the following variables LABEL_DATA_SOURCE_BUCKET = 'label-data-source-bucket'

LABEL_DATA_SOURCE_PREFIX = 'label-data-source-prefix/' # This must end with "/" if you provide a prefix

# The following are example training and evaluation start times. datetime(2018, 8, 13, 0, 0, 0) generates 2018-08-13 00:00:00

TRAINING_DATA_START_TIME = datetime(2016, 11, 1, 0, 0, 0) TRAINING_DATA_END_TIME = datetime(2017, 12, 31, 0, 0, 0) EVALUATION_DATA_START_TIME = datetime(2018, 1, 1, 0, 0, 0) EVALUATION_DATA_END_TIME = datetime(2018, 8, 13, 0, 0, 0)

# To configure off-time detection, use the format

# OFF_CONDITION = '{component}\\{sensor} < {target}'

# In the following example, Asset X will be considered to be in the off state if the latest value

# received by Sensor 1 is less than 10.

OFF_CONDITION = 'AssetX\\Sensor1 < 10.0'

########################################################

# construct request for create_model

########################################################

model_name = MODEL_NAME

DATA_SCHEMA_FOR_MODEL = None # You can use a schema similar to dataset here. The sensors used here should be subset of what is present in dataset

create_model_request = {

(40)

Viewing your models and evaluating their performance

'ModelName': model_name, 'DatasetName': DATASET_NAME, }if DATA_SCHEMA_FOR_MODEL is not None:

data_schema_for_model = {

'InlineDataSchema': DATA_SCHEMA_FOR_MODEL, }

create_model_request['DatasetSchema'] = data_schema_for_model if TARGET_SAMPLING_RATE is not None:

data_preprocessing_config = {

'TargetSamplingRate': TARGET_SAMPLING_RATE }

create_model_request['DataPreProcessingConfiguration'] = data_preprocessing_config if LABEL_DATA_SOURCE_BUCKET is not None:

labels_input_config = dict()

labels_input_config['S3InputConfiguration'] = dict(

[

('Bucket', LABEL_DATA_SOURCE_BUCKET), ('Prefix', LABEL_DATA_SOURCE_PREFIX) ]

)

create_model_request['LabelsInputConfiguration'] = labels_input_config # We need to set role_arn to access label data

create_model_request['RoleArn'] = ROLE_ARN

if TRAINING_DATA_START_TIME is not None or TRAINING_DATA_END_TIME is not None:

create_model_request['TrainingDataStartTime'] = TRAINING_DATA_START_TIME create_model_request['TrainingDataEndTime'] = TRAINING_DATA_END_TIME

if EVALUATION_DATA_START_TIME is not None or EVALUATION_DATA_END_TIME is not None:

create_model_request['EvaluationDataStartTime'] = EVALUATION_DATA_START_TIME create_model_request['EvaluationDataEndTime'] = EVALUATION_DATA_END_TIME if OFF_CONDITION is not None:

create_model_request['OffCondition'] = OFF_CONDITION

########################################################

# Create_model

########################################################

create_model_response = lookoutequipment.create_model(**create_model_request)

########################################################

# Wait until complete

########################################################

model_status = create_model_response['Status']

print("=====Polling Model Status=====\n") print("Model Status: " + model_status) while model_status == 'IN_PROGRESS':

time.sleep(30)

describe_model_response = lookoutequipment.describe_model(ModelName=model_name) model_status = describe_model_response['Status']

print("Model Status: " + model_status) print("\n=====End of Polling Model Status=====")

Viewing your models and evaluating their performance

You can view the ML models you've trained on the datasets containing the data from your equipment. If you've used part of your dataset for training and the other part for evaluation, you can see and evaluate the model's performance. You can also see which sensors were used to create a model. If you need better performance, you can use different sensors for training your next model.

Amazon Lookout for Equipment provides an overview of the model's performance and detailed information about abnormal equipment behavior events. An abnormal equipment behavior event

(41)

Viewing your models and evaluating their performance

is a situation where the model detected an anomaly in the sensor data that could lead to your asset malfunctioning or failing. You can see how well the model performed in detecting those events.

If you've provided Amazon Lookout for Equipment with label data for your dataset, you can see how the model's predictions compare to the label data. It shows the average forewarning time across all true positives. Forewarning time is the average length of time between when the model first finds evidence that something might be going wrong and when it actually detects the equipment abnormality.

For example, you can have a circumstance where Amazon Lookout for Equipment detects six of the seven abnormal behavior events in your labeled evaluation data. In six out of the seven events, on average, it might have provided an indication that something was off 32 hours before it detected an abnormality.

For this situation, we would say that Lookout for Equipment averaged 32 hours of forewarning.

Amazon Lookout for Equipment also reports the results where it incorrectly identified an abnormal behavior event in the label data. The label data that you provide when you create a dataset has a time range for abnormal equipment events. You specify the duration of the abnormal events in the label data.

In the evaluation data, the model used by Lookout for Equipment could incorrectly identify abnormal events outside of the equipment range. You can see how often the model identifies these events when you evaluate the model's performance.

You can use the following procedure and example code to view the models you've created. They also show you how to get information about a model, such as how well it performed. For details on how to use this information to find the root cause of an anomaly, see Finding the root cause of an anomaly (p. 38).

Viewing a model (console)

To view a model (console)

You can use this procedure to view model metrics in the console. To evaluate how the model performed, you must provide label data. If you provide label data, you can see when the model detected abnormal equipment behavior events.

1. Sign in to AWS Management Console and open the Amazon Lookout for Equipment console at Amazon Lookout for Equipment console.

2. Choose a dataset.

3. Choose a model. You can see whether the model is ready to monitor the equipment.

4. Navigate to Training and evaluation.

In the following image, you can see metrics related to the performance. You can see how many times the model identified abnormal equipment behavior events incorrectly. You can also see which sensors played the largest role in the model identifying the abnormal equipment behavior events. The console displays the top 15 sensors that contributed to the model identifying an abnormal equipment behavior event.

參考文獻

相關文件

The aim of this paper is to summarize some of the bibliographical data for the more than 230 mountain and temple gazetteers of which the archive is comprised, to compare the

Since we use the Fourier transform in time to reduce our inverse source problem to identification of the initial data in the time-dependent Maxwell equations by data on the

• Examples of items NOT recognised for fee calculation*: staff gathering/ welfare/ meal allowances, expenses related to event celebrations without student participation,

The research proposes a data oriented approach for choosing the type of clustering algorithms and a new cluster validity index for choosing their input parameters.. The

Courtesy: Ned Wright’s Cosmology Page Burles, Nolette &amp; Turner, 1999?. Total Mass Density

• But, If the representation of the data type is changed, the program needs to be verified, revised, or completely re- written... Abstract

• However, inv(A) may return a weird result even if A is ill-conditioned, indicates how much the output value of the function can change for a small change in the

Following the supply by the school of a copy of personal data in compliance with a data access request, the requestor is entitled to ask for correction of the personal data