neuralNet annTrain

Standard Case: Predicting Industrial Machine Failure with an MLP

Scénario de test & Cas d'usage

Business Context

An industrial manufacturing company wants to implement a predictive maintenance program. The goal is to train a neural network to predict imminent machine failure based on real-time sensor data. This allows for proactive maintenance, reducing downtime and costs.
About the Set : neuralNet

Training of classical artificial neural networks.

Discover all actions of neuralNet
Data Preparation

Creation of a simulated dataset representing sensor readings from industrial machines. It includes operational parameters and a binary target 'Failure' indicating if a failure occurred within the next 24 hours. The data is then partitioned for training and validation.

Copied!
1DATA machine_sensors;
2 call streaminit(123);
3 DO MachineID = 1 to 200;
4 DO i = 1 to 100;
5 Temperature = 70 + rand('Normal', 0, 5);
6 Pressure = 1000 + rand('Normal', 0, 50);
7 Vibration = 0.5 + rand('Normal', 0, 0.1);
8 HoursSinceMaint = rand('Uniform') * 500;
9 Failure = 0;
10 IF (HoursSinceMaint > 450 and Vibration > 0.6 and Temperature > 78) THEN Failure = 1;
11 IF (rand('Uniform') < 0.05) THEN Failure = 1; /* Random failures */
12 IF (rand('Uniform') < 0.1) THEN call missing(of Temperature Pressure Vibration);
13 OUTPUT;
14 END;
15 END;
16RUN;

Étapes de réalisation

1
Load the sensor data into a CAS table and partition it into 70% for training and 30% for validation.
Copied!
1PROC CASUTIL;
2 load DATA=machine_sensors casout={name='machine_sensors', replace=true};
3RUN;
4PROC CAS;
5 partition.partition /
6 TABLE={name='machine_sensors'},
7 partInd={name='_partInd_', replace=true},
8 sampling={method='STRATIFIED', vars={'Failure'}, partprop={train=0.7, valid=0.3}};
9RUN;
2
Train a Multi-Layer Perceptron (MLP) with two hidden layers. Use the validation table for early stopping and standardize interval inputs. Impute missing values using the mean.
Copied!
1PROC CAS;
2 ACTION neuralNet.annTrain /
3 TABLE={name='machine_sensors', where='_partInd_=1'},
4 validTable={name='machine_sensors', where='_partInd_=2'},
5 inputs={'Temperature', 'Pressure', 'Vibration', 'HoursSinceMaint'},
6 target='Failure',
7 nominals={'Failure'},
8 hiddens={25, 10},
9 acts={'RECTIFIER', 'TANH'},
10 arch='MLP',
11 std='STD',
12 missing='MEAN',
13 nloOpts={algorithm='LBFGS', maxIters=50, validate={frequency=5, stagnation=4}},
14 seed=456,
15 saveState={name='maintenance_model', replace=true};
16RUN;

Expected Result


The action successfully trains a neural network model. The output log should display the model information, optimization progress with decreasing error, and final fit statistics for both training and validation sets. A CAS table named 'maintenance_model' should be created containing the saved state of the trained model.