1 / 5

Esercitazione N°6

Esercitazione N°6. Apprendimento Non-Supervisionato. Esercizio 1 Learning Competitivo. >> P = rand(2,20); % insieme random in R 2 >> plot(P(1,:),P(2,:),'+r') % training set >> net = newc([0 1;0 1], 8 , 0.1); % rete >> w = net.IW{1}; >> hold on;

astro
Download Presentation

Esercitazione N°6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Esercitazione N°6 Apprendimento Non-Supervisionato

  2. Esercizio 1 Learning Competitivo >> P = rand(2,20);% insieme random in R2 >> plot(P(1,:),P(2,:),'+r')% training set >> net = newc([0 1;0 1], 8 , 0.1);% rete >> w = net.IW{1}; >> hold on; >> plot(w(:,1),w(:,2),'ob'); % plot dei pesi >> net.trainParam.epochs = 7; >> net = train(net,P);% addestramento TRAINR, Epoch 0/7 TRAINR, Epoch 7/7 TRAINR, Maximum epoch reached. >> w = net.IW{1}; >> plot(w(:,1),w(:,2),'og');% nuovo plot >> sim(net,[0;0.2])% richiamo della rete ans = (4,1) 1 I pesi degli 8 neuroni assumono inizialmente una posiizone baricentrica rispetto all'insieme di addestramento, poi si distribuiscono, determinando i clusters

  3. Esercizio 2 Mappe Auto-Organizzanti 1-D >> angles = 0:0.5*pi/99:0.5*pi; >> P=[sin(angles); cos(angles)]; >> plot(P(1,:),P(2,:),'+r'); >> net = newsom([0 1;0 1],[10]); >> net.trainParam.epochs = 10; >> net = train(net,P); TRAINR, Epoch 0/10 TRAINR, Epoch 10/10 TRAINR, Maximum epoch reached. >> plotsom(net.IW{1,1},net.layers{1}.distances); >> sim(net,[1;0]) ans = (1,1) 1 >> Rispetto alle reti competitive, le SOM definiscono una relazione di vicinato. Nella fase di addestramento, non vengono modificati solo i pesi del vincitore, ma anche dei suoi vicini. In fase di richiamo c'è un insieme di uscite che risponde, sulla base della relazione di vicinato.

  4. Esercizio 3 Mappe Auto-Organizzanti 2-D In questo caso la mappa è organizzata in una griglia bi-dimensionale >> P = rand(2,1000); >> plot(P(1,:),P(2,:),'+g'); >> hold on; >> net = newsom([0 1; 0 1],[5 6]); >> plotsom(net.IW{1,1},net.layers{1}.distances); >> net.trainParam.epochs = 1; >> net = train(net,P); TRAINR, Epoch 0/1 TRAINR, Epoch 1/1 TRAINR, Maximum epoch reached. >> plotsom(net.IW{1,1},net.layers{1}.distances); >> sim(net,[0.5;0.3]) ans = (19,1) 1

  5. Le reti LVQ operano una classificazione supervisionata, tramite un primo stadio non supervisionato seguito da un secondo strato supervisionato. Il vantaggio consiste nel fatto che la classificazione viene eseguita sulla base dei cluster dei punti di addestramento, anziché sui punti stessi, quindi in un certo modo si ottimizza la partizione dello spazio degli ingressi in base a come i punti di addestramento sono distribuiti in tale spazio. Esercizio 4 Learning Vector Quantization >> P = [ -3 -2 -2 0 0 0 0 2 2 3 0 1 -1 2 1 -1 -2 1 -1 0]; >> C = [1 1 1 2 2 2 2 1 1 1]; >> T = ind2vec(C); >> plotvec(P,C) >> net = newlvq(minmax(P),4,[.6 .4],0.1); >> hold on >> w = net.IW{1}; >> plot(w(1,1),w(1,2),'ow'); >> net.trainParam.epochs = 150; >> net = train(net,P,T); TRAINR, Epoch 0/150 TRAINR, Epoch 1/150 TRAINR, Performance goal met. >> plotvec(net.IW{1},vec2ind(net.LW{2}),'*')

More Related