Laboratorio Matlab: differenze tra le versioni

Da Bioingegneria Elettronica e Informatica.
(Reti Neurali Feed-Forward)
Riga 3: Riga 3:
  
 
<syntaxhighlight lang="matlab" line>
 
<syntaxhighlight lang="matlab" line>
 +
clear all, close all
 +
 +
load cancer_dataset.mat
 +
x = cancerInputs;
 +
t = cancerTargets(1,:);
 +
 +
temp = [x;t];
 +
rng(0)
 +
p = randperm(size(temp,2));
 +
 +
train_size = floor(size(temp,2)*.8);
 +
p_train = p(1:train_size);
 +
p_test = p(train_size+1:end);
 +
 +
x_train = temp(1:9,p_train);
 +
t_train = temp(10,p_train);
 +
 +
x_test = temp(1:9,p_test);
 +
t_test = temp(10,p_test);
 +
 +
save('dataset2.mat','x_train','t_train','x_test','t_test')
 
</syntaxhighlight>
 
</syntaxhighlight>

Versione delle 14:27, 21 mag 2019

Reti Neurali Feed-Forward

Esempio di applicazione di reti neurali artificiali.

  1. clear all, close all
  2.  
  3. load cancer_dataset.mat
  4. x = cancerInputs;
  5. t = cancerTargets(1,:);
  6.  
  7. temp = [x;t];
  8. rng(0)
  9. p = randperm(size(temp,2));
  10.  
  11. train_size = floor(size(temp,2)*.8);
  12. p_train = p(1:train_size);
  13. p_test = p(train_size+1:end);
  14.  
  15. x_train = temp(1:9,p_train);
  16. t_train = temp(10,p_train);
  17.  
  18. x_test = temp(1:9,p_test);
  19. t_test = temp(10,p_test);
  20.  
  21. save('dataset2.mat','x_train','t_train','x_test','t_test')