sequence cspade

High-Volume Sensor Error Burst Detection

Scénario de test & Cas d'usage

Business Context

A manufacturing plant collects high-frequency logs from industrial machines. The engineering team needs to detect specific patterns of error codes that occur in rapid succession (bursts) to predict critical failures. We are interested in short sequences (max 3 errors) happening very close together.
Data Preparation

Simulate a larger volume of machine log data with random error codes occurring over time.

Copied!
1 
2DATA mycas.machine_logs;
3call streaminit(999);
4DO machine_id = 1 to 100;
5DO time_tick = 1 to 50;
6IF rand('UNIFORM') > 0.8 THEN DO;
7error_code = byte(65 + floor(rand('UNIFORM')*4));
8OUTPUT;
9END;
10END;
11END;
12 
13RUN;
14 

Étapes de réalisation

1
Run cspade with constraints: maximum sequence length of 3, maximum gap of 2 time units between errors, and max 2 items per event.
Copied!
1 
2PROC CAS;
3sequence.cspade / TABLE={name='machine_logs'} sequenceId='machine_id' eventId='time_tick' itemId='error_code' supportCnt=5 maxLen=3 maxGap=2 maxSize=2 casout={name='error_patterns', replace=true};
4 
5RUN;
6 

Expected Result


The action identifies specific error code patterns (e.g., 'A -> B') that occur frequently across machines but only when the errors happen within 2 time ticks of each other, isolating 'burst' events from unrelated sporadic errors.