資源簡介
局部保持投影算法 LPP 有數(shù)據(jù)mat 可以實現(xiàn)

代碼片段和文件信息
function?W?=?constructW(Xoptions)
% Usage:
% W?2=?constructW(Xoptions)
%
% X:?Rows?of?vectors?of?data?points.?Each?row?is?x_i
%???options:?Struct?value?in?Matlab.?The?fields?in?options?that?can?be?set:
%???????????Metric?-??Choices?are:
%???????????????‘Euclidean‘?-?Will?use?the?Euclidean?distance?of?two?data?
%?????????????????????????????points?to?evaluate?the?“closeness“?between?
%?????????????????????????????them.?[Default?One]
%??????????????????
%???????????NeighborMode?-??Indicates?how?to?construct?the?graph.?Choices
%???????????????????????????are:?
%????????????????‘KNN‘????????????-??Put?an?edge?between?two?nodes?if?and
%????????????????????????????????????only?if?they?are?among?the?k?nearst
%????????????????????????????????????neighbors?of?each?other.?You?are
%????????????????????????????????????required?to?provide?the?parameter?k?in
%????????????????????????????????????the?options.?[Default?One]
%??????????????????????????????????????????????
%???????????WeightMode???-??Indicates?how?to?assign?weights?for?each?edge
%???????????????????????????in?the?graph.?Choices?are:
%???????????????‘HeatKernel‘???-?If?nodes?i?and?j?are?connected?put?weight
%????????????????????????????????W_ij?=?exp(-norm(x_i?-?x_j)/t).?This
%????????????????????????????????weight?mode?can?only?be?used?under
%????????????????????????????????‘Euclidean‘?metric?and?you?are?required?to
%????????????????????????????????provide?the?parameter?t.
%???????????????
%????????????k?????????-???The?parameter?needed?under?‘KNN‘?NeighborMode.
%??????????????????????????Default?will?be?5.
%????????????t?????????-???The?parameter?needed?under?‘HeatKernel‘
%??????????????????????????WeightMode.?Default?will?be?1
%
%????Examples:
%
%???????X?=?rand(5015);
%???????options?=?[];
%???????options.Metric?=?‘Euclidean‘;
%???????options.NeighborMode?=?‘KNN‘;
%???????options.k?=?5;
%???????options.WeightMode?=?‘HeatKernel‘;
%???????options.t?=?1;
%???????W?=?constructW(Xoptions);
%???????
%???????
%???????
%????
%
%????Written?by?Qiuqiu?Li(qiuqium11@163.com)?April/2013
%?
%%??define?parameters‘?Default-value
if?(~exist(‘options‘‘var‘))
???options?=?[];
else
???if?~isstruct(options)?
???????error(‘parameter?error!‘);
???end
end
%?define?options.Metric=================================================
if?~isfield(options‘Metric‘)
????options.Metric?=?‘Euclidean‘;
end
%?define?options.NeighborMode?=================================================
if?~isfield(options‘NeighborMode‘)
????options.NeighborMode?=?‘KNN‘;
end
?if?~isfield(options‘k‘)
?????options.k?=?5;
?else?if?options.k?1
?????????options.k?=?1;
?????end
end
%?define?options.WeightMode?=================================================
if?~isfield(options‘t‘)
????options.t?=?1000000;
end
%%??constructW
[nSmp?~]?=?size(X);
?????%%??constructing?the?difference?in?value?between??two?samples?matrix[(‘Euclidean‘?and?‘Cosine‘)‘s?D]
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-10-11?21:22??LPP\
?????文件?????2784549??2013-10-09?16:50??LPP\AR1D_data.mat
?????文件????????4519??2013-10-09?20:58??LPP\LPP.m
?????文件????????1313??2013-10-11?21:22??LPP\LPP_knn.asv
?????文件????????1542??2013-10-19?15:26??LPP\LPP_knn.m
?????文件?????3764043??2013-10-09?16:51??LPP\ORL1D_data.mat
?????文件????????6215??2013-06-28?22:10??LPP\PCA.m
?????文件?????1541529??2013-10-09?16:49??LPP\Yale1D_data.mat
?????文件????????3744??2013-07-06?21:57??LPP\constructW.asv
?????文件????????3691??2013-08-02?08:04??LPP\constructW.m
?????文件?????????398??2013-06-28?22:10??LPP\knn.m
評論
共有 條評論