Skip to content
New Workbook
Sign up
Predicting industrial machine downtime - Level 3
0

Predicting Industrial Machine Downtime: Level 3

📖 Background

You work for a manufacturer of high-precision metal components used in aerospace, automotives, and medical device applications. Your company operates three different machines on its shop floor that produce different sized components, so minimizing the downtime of these machines is vital for meeting production deadlines.

Your team wants to use a data-driven approach to predicting machine downtime, so proactive maintenance can be planned rather than being reactive to machine failure. To support this, your company has been collecting operational data for over a year and whether each machine was down at those times.

In this third level, you're going to develop a predictive model that could be combined with real-time operational data to detect likely machine failure. This level is aimed towards advanced learners. If you want to challenge yourself a bit less, check out the other levels!

💾 The data

The company has stored the machine operating data in a single table, available in 'data/machine_downtime.csv'.

Each row in the table represents the operational data for a single machine on a given day:
  • "Date" - the date the reading was taken on.
  • "Machine_ID" - the unique identifier of the machine being read.
  • "Assembly_Line_No" - the unique identifier of the assembly line the machine is located on.
  • "Hydraulic_Pressure(bar)", "Coolant_Pressure(bar)", and "Air_System_Pressure(bar)" - pressure measurements at different points in the machine.
  • "Coolant_Temperature", "Hydraulic_Oil_Temperature", and "Spindle_Bearing_Temperature" - temperature measurements (in Celsius) at different points in the machine.
  • "Spindle_Vibration", "Tool_Vibration", and "Spindle_Speed(RPM)" - vibration (measured in micrometers) and rotational speed measurements for the spindle and tool.
  • "Voltage(volts)" - the voltage supplied to the machine.
  • "Torque(Nm)" - the torque being generated by the machine.
  • "Cutting(KN)" - the cutting force of the tool.
  • "Downtime" - an indicator of whether the machine was down or not on the given day.

1. Introduction

Minimizing machine downtime is critical for meeting production deadlines in manufacturing high-precision metal components. Proactive maintenance, enabled by accurate downtime predictions, can significantly enhance operational efficiency. This report outlines the methodology and results of developing predictive models to forecast machine failures using historical operational data.

2. Data Exploration and Preprocessing

2.1. Data Loading and Overview

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Load the dataset
downtime = pd.read_csv('data/machine_downtime.csv')
print(downtime.head())
print(downtime.info())

Dataset Overview:

  • Total Entries: 2,500
  • Features: 16

Missing Values: Several numerical features contain missing data, which necessitates preprocessing.

2.2. Data Cleaning

Handling Missing Values: Assess and handle missing data via imputation or removal.

# Check for missing values
print(downtime.isnull().sum())

Date Processing: Convert 'Date' to datetime and extract relevant features.

from sklearn.preprocessing import LabelEncoder

# Fill missing numerical values with median
numerical_cols = downtime.select_dtypes(include=['float64', 'int64']).columns
downtime[numerical_cols] = downtime[numerical_cols].fillna(downtime[numerical_cols].median())

# Convert 'Date' to datetime
downtime['Date'] = pd.to_datetime(downtime['Date'], format='%d-%m-%Y')

# Extract day, month, and day of the week
downtime['Day'] = downtime['Date'].dt.day
downtime['Month'] = downtime['Date'].dt.month
downtime['DayOfWeek'] = downtime['Date'].dt.dayofweek

# Drop original 'Date' column
downtime.drop('Date', axis=1, inplace=True)

# Encode categorical variables using Label Encoding
le = LabelEncoder()
downtime['Machine_ID'] = le.fit_transform(downtime['Machine_ID'])
downtime['Assembly_Line_No'] = le.fit_transform(downtime['Assembly_Line_No'])
print(downtime.isnull().sum())
from sklearn.preprocessing import LabelEncoder

le = LabelEncoder()
downtime['Machine_ID'] = le.fit_transform(downtime['Machine_ID'])
downtime['Assembly_Line_No'] = le.fit_transform(downtime['Assembly_Line_No'])

2.3. Feature Engineering

Feature Scaling: Normalize or standardize features to prepare for model training.

# Encode 'Downtime' as binary labels
downtime['Downtime'] = downtime['Downtime'].map({'No_Machine_Failure': 0, 'Machine_Failure': 1})
from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()

# Define feature matrix X and target vector y
X = downtime.drop('Downtime', axis=1)
y = downtime['Downtime']

# Fit and transform the features
X_scaled = scaler.fit_transform(X)
‌
‌
‌