neuralNet annCode

High-Dimensionality Reduction using Autoencoder and `listNode` Parameter

Scénario de test & Cas d'usage

Business Context

A manufacturing plant uses high-resolution images of its products for quality control. To speed up analysis, they use a neural network autoencoder to reduce the dimensionality of the image data (e.g., from 100 features to 10). They need to generate scoring code that outputs only the compressed hidden layer values.
About the Set : neuralNet

Training of classical artificial neural networks.

Discover all actions of neuralNet
Data Preparation

Simulate a dataset of flattened images, where each observation has 100 pixel intensity variables. The data represents product images for quality inspection.

Copied!
1DATA casuser.product_images;
2 array pixels{100} p1-p100;
3 call streaminit(456);
4 DO i = 1 to 5000;
5 DO j = 1 to 100;
6 pixels{j} = rand('UNIFORM');
7 END;
8 OUTPUT;
9 END;
10 drop j i;
11RUN;

Étapes de réalisation

1
Train an autoencoder model using `annTrain`. The inputs and targets are the same pixel variables. The architecture has a bottleneck hidden layer of 10 neurons. Store the model in `image_autoencoder_model`.
Copied!
1PROC CAS;
2 LOADACTIONSET 'neuralNet';
3 neuralNet.annTrain /
4 TABLE={name='product_images'},
5 inputs={{name='p1'},{name='p2'},{name='p3'},{name='p4'},{name='p5'},{name='p6'},{name='p7'},{name='p8'},{name='p9'},{name='p10'},{name='p11'},{name='p12'},{name='p13'},{name='p14'},{name='p15'},{name='p16'},{name='p17'},{name='p18'},{name='p19'},{name='p20'},{name='p21'},{name='p22'},{name='p23'},{name='p24'},{name='p25'},{name='p26'},{name='p27'},{name='p28'},{name='p29'},{name='p30'},{name='p31'},{name='p32'},{name='p33'},{name='p34'},{name='p35'},{name='p36'},{name='p37'},{name='p38'},{name='p39'},{name='p40'},{name='p41'},{name='p42'},{name='p43'},{name='p44'},{name='p45'},{name='p46'},{name='p47'},{name='p48'},{name='p49'},{name='p50'},{name='p51'},{name='p52'},{name='p53'},{name='p54'},{name='p55'},{name='p56'},{name='p57'},{name='p58'},{name='p59'},{name='p60'},{name='p61'},{name='p62'},{name='p63'},{name='p64'},{name='p65'},{name='p66'},{name='p67'},{name='p68'},{name='p69'},{name='p70'},{name='p71'},{name='p72'},{name='p73'},{name='p74'},{name='p75'},{name='p76'},{name='p77'},{name='p78'},{name='p79'},{name='p80'},{name='p81'},{name='p82'},{name='p83'},{name='p84'},{name='p85'},{name='p86'},{name='p87'},{name='p88'},{name='p89'},{name='p90'},{name='p91'},{name='p92'},{name='p93'},{name='p94'},{name='p95'},{name='p96'},{name='p97'},{name='p98'},{name='p99'},{name='p100'}},
6 target='p1',
7 arch='AUTOENCODER',
8 hidden={{n=10, act='TANH'}},
9 casOut={name='image_autoencoder_model', replace=true};
10RUN;
2
Use `annCode` with the `listNode='HIDDEN'` parameter to generate code that only outputs the values from the hidden layer neurons.
Copied!
1PROC CAS;
2 neuralNet.annCode /
3 modelTable={name='image_autoencoder_model'},
4 listNode='HIDDEN',
5 code={casOut={name='autoencoder_hidden_code', replace=true}};
6RUN;

Expected Result


The action must generate DATA step code that, when executed, produces a table containing only the 10 output values of the hidden layer neurons. The generated code should be stored in the `autoencoder_hidden_code` table. This validates the `listNode` parameter's ability to extract compressed features from a high-dimensional input.