Predicting Vehicle Fleet Failure Probability Using Amazon SageMaker Jumpstart

Predicting Vehicle Fleet Failure Probability Using Amazon SageMaker JumpstartMore Info

By: Alex Johnson
Date: 05 JUL 2023
Category: Advanced (300), Amazon SageMaker, Amazon SageMaker JumpStart, Intermediate (200)

Predictive maintenance plays a vital role in the automotive sector, as it helps prevent unexpected mechanical failures and minimizes reactive maintenance that can hamper operations. By foreseeing vehicle failures and arranging timely maintenance, you can significantly cut down on downtime, enhance safety, and increase productivity.

Imagine leveraging deep learning techniques to address common aspects leading to vehicle failures, unplanned downtime, and repair costs. In this article, we will guide you through the process of training and deploying a model to predict the probability of failure in vehicle fleets using Amazon SageMaker JumpStart. This platform serves as a machine learning (ML) hub within Amazon SageMaker, offering pre-trained models for various use cases to facilitate your entry into the world of ML. The solution discussed here is also accessible on GitHub.

SageMaker JumpStart Solution Templates

Amazon SageMaker JumpStart offers comprehensive, one-click solutions for numerous ML applications. Below are some use cases you can explore for available templates:

  • Demand forecasting
  • Credit rating prediction
  • Fraud detection
  • Computer vision
  • Data extraction and analysis from documents
  • Predictive maintenance
  • Churn prediction
  • Personalized recommendations
  • Reinforcement learning
  • Healthcare and life sciences
  • Financial pricing

These templates encompass a diverse range of use cases, with multiple solution templates available under each category. The predictive maintenance solution for vehicle fleets, which we focus on in this article, is located within the Solutions section. You can choose the most suitable template from the SageMaker JumpStart landing page. For additional details on specific solutions and how to implement a SageMaker JumpStart solution, visit the Solution Templates section.

Solution Overview

The AWS predictive maintenance solution for automotive fleets utilizes deep learning techniques to address common factors causing vehicle failures, unplanned downtime, and repair expenses. This solution serves as an initial framework to help you swiftly develop a proof of concept. It comes equipped with data preparation and visualization capabilities within SageMaker, allowing you to train and optimize hyperparameters for your dataset. You can either use your data or experiment with a synthetic dataset provided within the solution. This version processes vehicle sensor data over time, while a forthcoming version will handle maintenance record data.

The diagram below illustrates how you can integrate this solution with SageMaker components. The following services are utilized as part of the solution:

  • Amazon S3: Utilized for storing datasets
  • SageMaker Notebook: Employed for data preprocessing, visualization, and model training
  • SageMaker Endpoint: Used to deploy the trained model

The workflow includes these steps:

  1. Extract historical data from the Fleet Management System, including vehicle data and sensor logs.
  2. Once the ML model is trained, the SageMaker model artifact is deployed.
  3. The connected vehicle transmits sensor logs to AWS IoT Core (or via an HTTP interface).
  4. Sensor logs are stored using Amazon Kinesis Data Firehose.
  5. AWS Lambda queries the model for predictions using the sensor logs.
  6. Sensor logs are sent for inference to the SageMaker model.
  7. Predictions are stored in Amazon Aurora.
  8. Aggregate results are visualized on an Amazon QuickSight dashboard.
  9. Real-time failure probability notifications are dispatched via Amazon Simple Notification Service (Amazon SNS), which communicates back to the connected vehicle.

This solution comprises six notebooks:

  • 0_demo.ipynb: A quick preview of the solution
  • 1_introduction.ipynb: Overview and introduction to the solution
  • 2_data_preparation.ipynb: Preparing a sample dataset
  • 3_data_visualization.ipynb: Visualizing the sample dataset
  • 4_model_training.ipynb: Training a model to detect failures on the sample dataset
  • 5_results_analysis.ipynb: Analyzing the model’s results

Prerequisites

Before you can run SageMaker JumpStart, ensure that you have set up Amazon SageMaker Studio, the integrated development environment (IDE) within SageMaker that encompasses all necessary ML features. If you already have SageMaker Studio running, you can skip this step.

First, you need to sign up for an AWS account and create an administrative user and group. For guidance on these steps, refer to the Set Up Amazon SageMaker Prerequisites.

Next, create a SageMaker domain, which sets up storage and allows user access to SageMaker. For further details, check Onboard to Amazon SageMaker Domain. This demo will be executed in the AWS Region us-east-1.

Finally, launch SageMaker Studio, preferably using a user profile app. For instructions, see Launch Amazon SageMaker Studio. To execute this SageMaker JumpStart solution and deploy the infrastructure to your AWS account, you need to set up an active SageMaker Studio instance (refer to Onboard to Amazon SageMaker Studio). Once your instance is operational, follow the instructions in SageMaker JumpStart to initiate the solution. The solution artifacts are available in this GitHub repository for your reference.

Launching the SageMaker Jumpstart Solution

To begin with the solution, follow these steps:

  1. In the SageMaker Studio console, select JumpStart.
  2. On the Solutions tab, choose Predictive Maintenance for Vehicle Fleets.
  3. Click Launch. The deployment process will take several minutes.
  4. After deployment is complete, select Open Notebook.

If prompted to choose a kernel, select PyTorch 1.8 Python 3.6 for all notebooks in this solution.

Solution Preview

Start with the 0_demo.ipynb notebook, which provides a quick preview of the expected outcome after completing the full notebook for this solution. Run all cells in SageMaker Studio by choosing Run and Run All Cells (or Cell and Run All in a SageMaker notebook instance). Make sure all cells finish processing before moving to the next notebook.

This solution relies on a configuration file to operate the provisioned AWS resources. The file is generated as follows:

import boto3
import os
import json

client = boto3.client('servicecatalog')
cwd = os.getcwd().split('/')
i= cwd.index('S3Downloads')
pp_name = cwd[i + 1]
pp = client.describe_provisioned_product(Name=pp_name)
record_id = pp['ProvisionedProductDetail']['LastSuccessfulProvisioningRecordId']
record = client.describe_record(Id=record_id)

keys = [ x['OutputKey'] for x in record['RecordOutputs'] if 'OutputKey' and 'OutputValue' in x]
values = [ x['OutputValue'] for x in record['RecordOutputs'] if 'OutputKey' and 'OutputValue' in x]
stack_output = dict(zip(keys, values))

with open(f'/root/S3Downloads/{pp_name}/stack_outputs.json', 'w') as f:
    json.dump(stack_output, f)

For additional insights into this topic, you can check out another blog post here. If you wish to explore more expert opinions on the subject, visit this authority on the topic, and for a great resource, check out this job listing.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *