Rechercher : dans
Par :

Exemple acp en matlab

Dernière réponse le 12 jui 2009 à 11:34:27 fifi, le 10 avr 2008 à 21:49:37 
 Signaler ce message aux modérateurs

Bonjour,SVP
un exemple de ACP (analyse en composant principal ) avec matlab avec toutes les détailles .

Configuration: Windows XP
Internet Explorer 6.0

Meilleures réponses pour « exemple acp en matlab » dans :
Concaténer les vecteurs ou les matrices sous Matlab Voir L'opération de concaténation des variables de Matlab consiste à regrouper ces variables dans une seule (vecteur ou matrice). Exemple : |2 3 4| X= |1 2 5| |0 2 7| Avec : |9 6 8| Y= |5 6 2| |3 2 1| Donne...
La vectorialisation sous MatLab Voir Vectorialisation sous Matlab Sommaire I. Le logiciel MatLab II. Configuration matérielle pour les tests III. Comment vectorialiser un calcul IV. Expérience sur un exemple concret IV.1. Exemple concret choisi IV.2. Programme non...
Représentation des courbes sous Matlab VoirLa fonction plot permet essentiellement de tracer des courbes sous Matlab. Dans cette astuce, nous allons essayer de détailler le fonctionnement de cette commande. Simple utilisation Vecteur Matrice Vecteur en fonction d'un autre Autres...
Exemples d'applications multilangage VoirExemples d’applications multilangage Le centre .NET Framework de Microsoft propose quantité d’exemples de code pour en savoir plus sur la création d’applications basées sur Microsoft Windows, d’applications web et de services Web XML. Consultez la...

1

mdr, le 11 mai 2008 à 12:51:11

Toi tu crois au pere noel ? Si t'espere obtenir quelque chose en demandant comme ca lol, ben t'es pas couché

Répondre à mdr

2

mergus, le 30 jun 2008 à 15:27:41

Salut tous ici mergus.
ce vrai ke fifi demande mal ls choses.moi aussi je suis curieux de voir l'algorithme d' ACP en Matlab. s'il vous plait est ce que a eu à le faire. je voudrais ben voir son code.MERCI

Répondre à mergus

3

BRAHIM, le 22 déc 2008 à 15:46:59
  • +1

Principal Component Analysis
Principal-component analysis(PCA) is a useful technique you can use to reduce the dimensionality of large data sets, such as those from microarray analysis. PCA can also be used to find signals in noisy data.

You can use the The function princomp in the Statistics Toolbox to calculate the principal components of a data set.

[pc, zscores, pcvars] = princomp(yeastvalues)
MATLAB displays

pc =

Columns 1 through 4

-0.0245 -0.3033 -0.1710 -0.2831
0.0186 -0.5309 -0.3843 -0.5419
0.0713 -0.1970 0.2493 0.4042
0.2254 -0.2941 0.1667 0.1705
0.2950 -0.6422 0.1415 0.3358
0.6596 0.1788 0.5155 -0.5032
0.6490 0.2377 -0.6689 0.2601

Columns 5 through 7

-0.1155 0.4034 0.7887
-0.2384 -0.2903 -0.3679
-0.7452 -0.3657 0.2035
-0.2385 0.7520 -0.4283
0.5592 -0.2110 0.1032
-0.0194 -0.0961 0.0667
-0.0673 -0.0039 0.0521
You can use the function cumsum to see the cumulative sum of the variances.

cumsum(pcvars./sum(pcvars) * 100)
MATLAB displays

ans =
78.3719
89.2140
93.4357
96.0831
98.3283
99.3203
100.0000
This shows that almost 90% of the variance is accounted for by the first two principal components.

A scatter plot of the scores of the first two principal components shows that there are two distinct regions. This is not unexpected, because the filtering process removed many of the genes with low variance or low information. These genes would have appeared in the middle of the scatter plot.

figure
scatter(zscores(:,1),zscores(:,2));
xlabel('First Principal Component');
ylabel('Second Principal Component');
title('Principal Component Scatter Plot');
MATLAB plots the figure.



The function gname from the Statistics Toolbox can be used to identify genes on a scatter plot. You can select as many points as you like on the scatter plot.

gname(genes);
When you have finished selecting points, press Enter.

An alternative way to create a scatter plot is with the function gscatter from the Statistics Toolbox. gscatter creates a grouped scatter plot where points from each group have a different color or marker. You can use clusterdata, or any other clustering function, to group the points.

figure
pcclusters = clusterdata(zscores(:,1:2),6);
gscatter(zscores(:,1),zscores(:,2),pcclusters)
xlabel('First Principal Component');
ylabel('Second Principal Component');
title('Principal Component Scatter Plot with Colored Clusters');
gname(genes) % Press enter when you finish selecting genes.
MATLAB plots the figure.

Répondre à BRAHIM

4

BRAHIM84, le 29 déc 2008 à 12:05:44
  • +2

Bon soir : voi ci UN EXEMPLE du code ACP



MATLAB

Résultats
x= [38.01 ---------43.78 ];
[nligne ncol] =size(x);

Lecture du tableau et calcul des dimensions
nligne =25
ncol =5
moy = mean(x)'

vecteur des moyennes
moy =
40.9544
108.0376
42.0076
268.3640
91.5688
ect=std(x)'

vecteur des ecarts-types
ect =
12.1300
170.7207
33.5872
151.5456
19.2988
vunit=linspace(1,1,nligne)'
y=x-vunit*moy';

Centrage des données
y =
-2.9444 -103.5476 -14.4576 -97.8140 -0.3588
-3.0644 -96.3076 32.2624 -119.2740 15.2712
-1.2844 -95.2076 -9.2476 -83.7340 7.1612
-4.3744 -81.9476 0.7624 -96.1740 -13.3988
-7.4944 -104.1776 3.0724 -85.2540 3.2412
-10.2744 -101.2376 -1.4576 -59.6040 -2.0888
-10.3744 395.1424 -16.3776 -98.0940 -14.8188
-6.3944 -105.3776 26.0224 -38.8840 7.3512
-11.4144 -101.4676 0.2024 -81.6040 -3.8888
-7.8744 -98.4076 -30.6576 -29.1540 -27.9988
-3.4244 -96.7576 120.3724 -81.3240 40.3812
-7.7144 175.0824 -7.6776 -114.3440 -2.3688
0.9656 -88.0376 -36.0576 -85.3540 -26.7388
-4.5744 -76.8876 6.0624 -40.3640 6.3212
-9.5844 191.4324 8.5824 -45.1140 24.6712
10.2756 -80.2776 -27.0176 -31.5240 9.7812
25.3656 -52.4976 68.8924 63.7860 29.3012
-4.3144 -52.4976 -9.7776 1.7660 -10.3188
23.6556 -70.1376 -25.8576 222.5860 0.0412
13.7056 13.6024 -24.4276 386.7760 -12.2888
4.7756 283.7924 -14.4476 150.6360 14.3812
11.4656 -72.9876 -6.9076 426.1660 -12.5688
26.7456 507.1724 -8.2676 92.4360 22.2712
-1.3944 -21.8176 -7.9576 25.9360 -5.5488
-20.4544 -66.6476 -25.6376 -182.4740 -47.7888



ds=diag(ect)^-1

Matrice diagonale des 1/ect
ds =
0.0824 0 0 0 0
0 0.0059 0 0 0
0 0 0.0298 0 0
0 0 0 0.0066 0
0 0 0 0 0.0518
z=y*ds

Matrice des données centrées et reduites
z =
-0.2427 -0.6065 -0.4305 -0.6454 -0.0186
-0.2526 -0.5641 0.9606 -0.7871 0.7913
-0.1059 -0.5577 -0.2753 -0.5525 0.3711
-0.3606 -0.4800 0.0227 -0.6346 -0.6943
-0.6178 -0.6102 0.0915 -0.5626 0.1679
-0.8470 -0.5930 -0.0434 -0.3933 -0.1082
-0.8553 2.3146 -0.4876 -0.6473 -0.7679
-0.5272 -0.6173 0.7748 -0.2566 0.3809
-0.9410 -0.5943 0.0060 -0.5385 -0.2015
-0.6492 -0.5764 -0.9128 -0.1924 -1.4508
-0.2823 -0.5668 3.5839 -0.5366 2.0924
-0.6360 1.0255 -0.2286 -0.7545 -0.1227
0.0796 -0.5157 -1.0736 -0.5632 -1.3855
-0.3771 -0.4504 0.1805 -0.2663 0.3275
-0.7901 1.1213 0.2555 -0.2977 1.2784
0.8471 -0.4702 -0.8044 -0.2080 0.5068
2.0911 -0.3075 2.0512 0.4209 1.5183
-0.3557 -0.3075 -0.2911 0.0117 -0.5347
1.9502 -0.4108 -0.7699 1.4688 0.0021
1.1299 0.0797 -0.7273 2.5522 -0.6368
0.3937 1.6623 -0.4302 0.9940 0.7452
0.9452 -0.4275 -0.2057 2.8121 -0.6513
2.2049 2.9708 -0.2462 0.6100 1.1540
-0.1150 -0.1278 -0.2369 0.1711 -0.2875
-1.6863 -0.3904 -0.7633 -1.2041 -2.4763
v=(z'*z)/nligne

Matrice des corrélations
v =
0.9600 0.2105 0.0413 0.6568 0.3738
0.2105 0.9600 -0.1478 0.1199 0.1857
0.0413 -0.1478 0.9600 -0.1437 0.6750
0.6568 0.1199 -0.1437 0.9600 0.0437
0.3738 0.1857 0.6750 0.0437 0.9600
[f h] = eig(v)
Vecteurs propres :
f =
0.5657 -0.4505 -0.1819 -0.2948 0.5976
-0.2261 -0.1674 0.8987 -0.2246 0.2506
-0.4433 -0.5125 -0.1319 0.6516 0.3145
-0.6158 0.2641 -0.3493 -0.4911 0.4334
0.2307 0.6607 0.1410 0.4438 0.5416

Valeurs propres :
h =
0.2809 0 0 0 0
0 0.1520 0 0 0
0 0 0.9216 0 0
0 0 0 1.5603 0
0 0 0 0 1.8852
coord=z*f

Coordonnées des individus sur les axes
coord =
0.5838 0.2488 -0.2213 0.2360 -0.7222
0.2261 0.0309 -0.2012 1.5647 0.0973
0.6141 0.3814 -0.2003 0.4131 -0.3281
0.1251 -0.3952 -0.2450 0.2324 -0.9797
0.1331 0.2960 -0.2279 0.7296 -0.6462
-0.1086 0.3277 -0.2510 0.4997 -0.8975
-0.5695 -0.4306 2.4178 -0.6082 -0.7809
-0.2562 0.1276 -0.4177 1.0939 -0.1309
-0.1155 0.2450 -0.2041 0.5898 -1.0519
-0.0485 -0.1526 -0.4169 -0.8233 -1.6886
-0.8069 -0.3740 -0.4481 3.7378 1.7172
-0.0540 -0.0484 1.3137 0.1243 -0.5884
0.6647 -0.4635 -0.3350 -0.9454 -1.4138
0.0481 0.2989 -0.2207 0.6061 -0.2195
-0.3355 0.8033 1.4020 0.8612 0.4526
1.1871 0.3893 -0.3265 -0.3412 0.3198
0.4343 -0.8275 -0.8602 1.2561 2.8224
-0.1332 0.0107 -0.2527 -0.2588 -0.6657
0.6332 -0.0259 -1.1352 -1.7047 1.4580
-0.7751 0.1037 -1.0193 -2.3608 1.2277
-0.4027 0.5197 1.2369 -0.9271 1.3510
-1.1595 0.0635 -1.6031 -1.9867 1.2591
0.5753 -0.4409 2.2508 -1.2650 2.8740
-0.1028 0.0498 -0.1630 -0.3034 -0.2568
-0.3570 -0.7379 0.1280 -0.4202 -3.2086

Répondre à BRAHIM84

6

 sari, le 12 jui 2009 à 11:34:27

Bonjour brahim, pouvez vous me donner plus de details sur la mehode acp a l'adresse : oukali_sari@msn.com
merci d'avance.

Répondre à sari

5

2009, le 14 mar 2009 à 10:59:22
  • +5

Calcule de acp avec MATLAB

Répondre à 2009