[Show all top banners]

SRAM
Replies to this thread:

More by SRAM
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Anyone know abt Matlab and PCA
[VIEWED 4402 TIMES]
SAVE! for ease of future access.
Posted on 04-26-06 6:25 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

is there anyone that understands how to use matlab and PCA...because i am having probs with project so would be grateful for help recieved
thanks
 
Posted on 04-26-06 6:40 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

whats the problem on? I can try to help you out.
 
Posted on 04-26-06 7:20 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

well i have to build an expert system using four variables, in each of these variables there are six columns and 24000 rows and i need to use PCA to reduce the data.
the following code only allows me to reduce six rows of one variable at a time,

[pn,meanp,stdp] = prestd(p);
[ptrans,transMat] = prepca(pn,0.02);

do you have any suggestions in reducing the whole amount of data?

thanks
 
Posted on 04-26-06 7:45 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

[D,R,T] = dimred(X)

X = Original vector data. Each row is a data point. Each column is a dimension in the original space.
D = Reduced vector data. Each row is a data point. Each column is a dimension in the lower-dimensional space.
R = "rotation" matrix to convert data from the the reduced space back into the original data space . Convert D back to X by using X = D*R+T;
T = "translation" matrix

The narrowest dimension of the data is compressed to zero. you may wish to compute a dimensionality ratio r such as
>>g = svd(X); r = min(g) / max(g);
or,
g = abs(eig(cov(X))); r = min(g)/max(g);
and then proceed if r < 1e-6
>> To convert some function F of D back to a function G of X
in the higher dimnensional space as follows:
X = (original data)
[D,R,T] = dimred(X);
F = (result of some presumably linear operation perfomed on D)
G = F*R+T;

% C=round(rand(3)*100)/100;
% C=C'*C;
% [V,D]=eig(C);
% D=diag([0 1 2]);
% C=V*D*V';
% mu = [4 4 4];
% X=mvnrnd(mu,C,1000);
% mu=repmat(mu,[size(X,1) 1]);
% % condition inverse of covariance for plots:
% D(1,1)=D(2,2)*1e-6;
% CI=inv(V*D*V');
% d=sum((X-mu)'.*(CI*(X-mu)'));
% X(d>4,:)=[];
% figure
% subplot(2,1,1)
% hold on
% plot3(X(:,1),X(:,2),X(:,3),'b.')
% grid on
% view(45,10)
% axis equal
% axis vis3d
% [D,R,T]=dimred(X);
% k=convhulln(D);
% for n=1:length(k)
% plot3(X(k(n,:),1),X(k(n,:),2),X(k(n,:),3),'r-','linew',2);
% end
% title('Original Data (3D)')
% subplot(2,1,2)
% plot(D(:,1),D(:,2),'b.')
% grid on
% axis equal
% axis tight
% title('Transformed Data (2D)')

T = repmat(mean(X),[size(X,1),1]);
XX = X-T;
[R,N]=eig(XX'*XX);
D=XX*R;
D=D(:,2:end);
Q=[zeros(size(D,2),1) eye(size(D,2))];
R=Q*R';
return


does that work???
 
Posted on 04-26-06 8:46 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Jus to let u kno hyperthread, rather then writing loads of coding here, i have sent u an email abt it
 
Posted on 04-26-06 8:52 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I will look at it when I wake up later in the evening , will write you back if I think I can help you out.
 
Posted on 04-26-06 10:03 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Hyperthread's coding might help. I have little experiences with matlab though I found that everything seems simple to understand and to program, and generally undergrads and grad students with mathematics backgrounds using this software.

If you want to do programming for simulation or other purpose (more than just identifying the factor structures of particular data), I think using statistical softwares such as SAS, or SPSS or R/S-Plus is better for PCA as I have some experiences of such analyses using these softwares. It is always better using statistical softwares for statistical analyses as you can find many features on them.
 
Posted on 04-26-06 10:16 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

sram, you are saying that you want just four varibles (you might be meaning 'four factors') out of six from the data of 24000 subjects or what? PCA gives out important components or factors, not the individual variables. So,for example, if you identified 2 important factors from a possible combinations of 6 variables, these two factors can consist of 2 or more variables. It is not necessarily 4 varibles you want. Might be I understood the problem wrongly.
 
Posted on 04-26-06 12:29 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

hhmmm...well i think i should explain the project a little. Its basically predicting if a train is likely to derail from the tracks. So the four variables are linear displacement, vertical displacement, gauge and curvature. And i have been told that i have to use PCA in order to create an expert system.
 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 200 days
Recommended Popular Threads Controvertial Threads
ChatSansar.com Naya Nepal Chat
TPS Re-registration case still pending ..
Toilet paper or water?
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
ढ्याउ गर्दा दसैँको खसी गनाउच
Sajha Poll: Who is your favorite Nepali actress?
Problems of Nepalese students in US
TPS EAD auto extended to June 2025 or just TPS?
whats wrong living with your parents ?
Mamta kafle bhatt is still missing
Ajay Kumar Dev sentenced to 378 yrs
Why Americans reverse park?
Now Trump is a convicted criminal .
TPS advance parole Travel document i-131, Class of Admission ?
Tourist Visa - Seeking Suggestions and Guidance
Nepali Passport Renewal
मन भित्र को पत्रै पत्र!
Biden said he will issue new Employment visa for someone with college degree and job offers
To Sajha admin
TPS Renewal Reregistration
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters