Changeset 4
- Timestamp:
- 08/12/09 16:55:14 (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/private/make_image_sw.m
r2 r4 13 13 Tau_interp=interp2(Lat0,Lon0,Tau,Lat,Lon,'nearest'); 14 14 15 %mise au format des autres donn ï¿œes15 %mise au format des autres données 16 16 load([indir 'Valid_Pixels_251.dat']); 17 17 Tau_1d=nan*ones(size(Valid_Pixels_251)); -
trunk/toolbox/MLPfit.m
r2 r4 460 460 %%plotplot(Xa,MLPval(Xa,w1,w2,F1,F2),'b-',X,Yb,'r-') 461 461 %plot(Xa,MLPval(Xa,w1,w2,F1,F2),'b-') 462 %S=sprintf('en rouge fonction utilis e pour simuler les donnes en bleu courbe apprise par le MLP');462 %S=sprintf('en rouge fonction utilisée pour simuler les données en bleu courbe apprise par le MLP'); 463 463 %title(S); 464 464 -
trunk/toolbox/MLPval.m
r2 r4 1 1 function [Y]=MLPval(x,W1,W2,F1,F2) 2 3 2 %MLPval compute output values from a trained MLP 4 5 3 % 6 7 4 % [Y]=MLPval(X,W1,W2,F1,F2) 8 9 5 % 10 11 6 % X is the input data 12 13 7 % W1 the weight matrix input -> hidden layer 14 15 8 % W2 weight matrix hidden layer -> ouput 16 17 9 % F1 (default 'tah') activation function of the hidden layer units 18 19 10 % F2 (default 'lin') activation function of the output layer units 20 21 11 % 22 23 12 % Y the output ouf the network at point X 24 25 13 % 26 27 14 % 21/04/97 S. Canu 28 29 30 31 15 if nargin < 3; 32 33 16 help MLPval 34 35 17 error(sprintf('\n *** MLPval error: invalid call***\n\n\t[Y]=MLPval(X,W1,W2,F1,F2);\n\n')); 36 37 18 end; 38 39 40 41 19 % Check that matrix (X) and matrix (W1) have compatible dimensions 42 43 44 45 20 [n,d] = size(x); 46 47 21 [dp1,m] = size(W1); 48 49 22 [mp1,q] = size(W2); 50 51 23 if (d+1)~=dp1, 52 53 24 error('The number of colum in x plus one must equal the number of rows in W1'); 54 55 25 end 56 57 26 if (m+1)~=mp1, 58 59 27 error('The number of colum in W1 plus one must equal the number of rows in W2'); 60 61 28 end 62 63 64 65 29 % Complete unspecified name of activation function 66 67 68 69 30 if nargin < 5; 70 71 31 F2='lin'; 72 73 32 if nargin < 4; 74 75 33 F1 ='tah'; 76 77 34 end; 78 79 35 end; 80 81 82 83 84 85 36 if F1=='tah' & F2=='lin' 86 87 37 a1 = [x ones(n,1)]*W1; 88 89 38 x1 = tanh(a1); 90 91 39 a2 = [x1 ones(n,1)]*W2; 92 93 40 Y = a2; 94 95 96 97 41 elseif F1=='sig' & F2=='lin' 98 99 42 a1 = [x ones(n,1)]*W1; 100 101 43 x1 = tanh(a1); 102 103 44 a2 = [x1 ones(n,1)]*W2; 104 105 45 Y = a2; 106 107 108 109 46 elseif F1=='tah' & F2=='tah' 110 111 47 a1 = [x ones(n,1)]*W1; 112 113 48 x1 = phi(a1); 114 115 49 a2 = [x1 ones(n,1)]*W2; 116 117 50 Y = tanh(a2); 118 119 120 121 51 elseif F1=='sig' & F2=='tah' 122 123 52 a1 = [x ones(n,1)]*W1; 124 125 53 x1 = phi(a1); 126 127 54 a2 = [x1 ones(n,1)]*W2; 128 129 55 Y = tanh(a2); 130 131 132 133 56 elseif F1=='tah' & F2=='sig' 134 135 57 a1 = [x ones(n,1)]*W1; 136 137 58 x1 = tanh(a1); 138 139 59 a2 = [x1 ones(n,1)]*W2; 140 141 60 Y = phi(a2); 142 143 144 145 61 elseif F1=='sig' & F2=='sig' 146 147 62 a1 = [x ones(n,1)]*W1; 148 149 63 x1 = phi(a1); 150 151 64 a2 = [x1 ones(n,1)]*W2; 152 153 65 Y = phi(a2); 154 66 155 67 156 68 elseif F1=='tah' & F2=='exp' 157 158 69 a1 = [x ones(n,1)]*W1; 159 160 70 x1 = tanh(a1); 161 162 71 a2 = [x1 ones(n,1)]*W2; 163 164 72 Y = exp(a2); 165 166 167 168 73 elseif F1=='sig' & F2=='exp' 169 170 74 a1 = [x ones(n,1)]*W1; 171 172 75 x1 = phi(a1); 173 174 76 a2 = [x1 ones(n,1)]*W2; 175 176 77 Y = exp(a2); 177 178 179 78 else 180 181 79 error('The name of the activation function is incorect') 182 183 80 end 184 185 186 187 188 -
trunk/toolbox/cenred.m
r2 r4 1 1 function [X,moya,ecaa] = cenred(Z,moya,eca) 2 3 2 % Fonction qui centree par moya et eca 4 3 %avec la formule X=(2/3)*(Z-moya)/eca 5 4 %les invivudus etant en ligne 6 7 8 9 5 UN = ones(size(Z)); 10 11 6 Moy =moya ; 12 7 Std =eca; 13 8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 15 16 9 Moy = diag(Moy); 17 18 10 Moy = UN * Moy; 19 20 21 22 11 taille=size(Z,1); 23 24 12 Ecart_type = diag(sqrt((taille-1)/taille)*Std); 25 26 13 Ecart_type = UN * Ecart_type; 27 28 14 29 15 30 31 32 33 34 % Calcul de la matrice X des donnï¿œes centrï¿œes rï¿œduites 35 16 % Calcul de la matrice X des données centrées réduites 36 17 X = (2/3).*(Z - Moy)./Ecart_type ; 37 38 39 -
trunk/toolbox/decenred.m
r2 r4 1 1 function X = decenred(Z,moya,ecaa) 2 3 2 % Fonction pour denormaliser la matrice Z 4 5 6 3 % en lignes 7 4 %load moya;load ecaa 8 9 5 UN = ones(size(Z)); 10 6 Moy = moya; 11 7 Moy = diag(Moy); 12 8 Moy = UN * Moy; 13 14 9 taille=size(Z,1); 15 16 10 Ecart_type = diag(sqrt((taille-1)/taille)*ecaa); 17 11 Ecart_type = UN * Ecart_type; 18 19 12 20 % Calcul de la matrice X des donnï¿œes centrï¿œes rï¿œduites 21 13 % Calcul de la matrice X des données centrées réduites 22 14 X = (3./2.)* Z .*Ecart_type + Moy; 23 24 25
Note: See TracChangeset
for help on using the changeset viewer.