Scénario de test & Cas d'usage
Training of classical artificial neural networks.
Discover all actions of neuralNetCreation 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.
| 1 | DATA 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; |
| 16 | RUN; |
| 1 | PROC CASUTIL; |
| 2 | load DATA=machine_sensors casout={name='machine_sensors', replace=true}; |
| 3 | RUN; |
| 4 | PROC 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}}; |
| 9 | RUN; |
| 1 | PROC 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}; |
| 16 | RUN; |
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.