資源簡介
下載的壓縮包里有兩個文件,里面的說明很清楚

代碼片段和文件信息
?function??bayes_classifier(feature1feature2p1p2);
?
%-----------------------------------------------------
%?bayes_classifier(class1class2p1p2);
%?BAYES_CLASSIFIER?function?calculates?the?discriminant?functions?for
%?two?classes.
%?INPUT?variables:
%?-?feature1?-?feature?vector?of?the?size?(m2)?for?the?first?class?(m?is?the?number?of?samples?in?the?1st?class)
%?-?feature2?-?feature?vector?of?the?size?(n2)?for?the?second?class?(n?is?the?number?of?samples?in?the?2nd?class)
%?-?p1?-?prior?probability?for?the?first?class
%?-?p2?-?prior?probability?for?the?second?class
%?OUTPUT:
%?Discriminant?functions?for?two?classes:?
%?g1(x)?=?A1*x1^2?+?B1*x1*x2?+?C1*x2^2?+?D1*x1?+?E1*x2?+?F1
%?g2(x)?=?A2*x1^2?+?B2*x1*x2?+?C2*x2^2?+?D2*x1?+?E2*x2?+?F2
%?--------------------------------------------------
%?Evgeny?Krestyannikov
%?krestyan@cs.tut.fi
%?Institute?of?Signal?Processing
%?Room?TE?313
web?-browser?http://www.ilovematlab.cn/thread-4403-1-1.html
syms?x1
syms?x2
cov1=cov(feature1);
cov2=cov(feature2);
mu1=mean(feature1);
mu2=mean(feature2);
detcov1=det(cov1);
detcov2=det(cov2);
invcov1=inv(cov1);
invcov2=inv(cov2);
W1=-0.5*invcov1;
w1=invcov1*mu1‘;
W2=-0.5*invcov2;
w2=invcov2*mu2‘;
omega1=-0.5*(mu1)*invcov1*mu1‘-0.5*log(detcov1)+log(p1);
omega2=-0.5*(mu2)*invcov2*mu2‘-0.5*log(detcov2)+log(p2);
omega=omega1-omega2;
X=[sym(x1);?sym(x2)];
X_t=[sym(x1)?sym(x2)];
digits(2);
a=X_t*(sym(W1‘d‘)*X);
a=simplify(a);
b=(sym(w1‘‘d‘)*X);
c=X_t*(sym(W2‘d‘)*X);
c=simplify(c);
d=sym(w2‘‘d‘)*X;
eq1=a+b+sym(omega1‘d‘);
eq2=c+d+sym(omega2‘d‘);
disp([‘Discriminant?function?for?the?first?class:‘]);
disp(eq1);
disp([‘Discriminant?function?for?the?second?class:‘]);
disp(eq2);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1778??2008-05-28?16:34??program\bayes_classifier.m
?????文件???????1238??2008-05-28?16:35??program\data_generator.m
?????目錄??????????0??2008-05-28?16:34??program
?????文件????????122??2008-05-14?18:20??Matlab中文論壇--助努力的人完成畢業設計.url
?????文件???????3434??2008-05-15?08:26??使用幫助:新手必看.htm
-----------?---------??----------?-----??----
?????????????????6572????????????????????5
- 上一篇:HFSS-MATLAB-sc
riptING-API - 下一篇:matlab等價類程序
評論
共有 條評論