求Rankboost算法的Matlab版源代码,或者给我链接我去下也行 10

 我来答
小剑飞啊飞
2015-05-04
知道答主
回答量:16
采纳率:0%
帮助的人:7.6万
展开全部
function [ rbf ] = RankBoost( X,Y,D,T )
%RankBoost implemetation of RankBoost algoritm
% Input:
% X - train set.
% Y - train labels.
% D - distribution function over X times X, it the form of 2D matrix.
% T - number of iteration of the boosting.
% Output:
% rbf - Ranking Function.

rbf = RankBoostFunc(T);
% w - the current distribution in any iteration, initilize to D
w = D;
for t=1:T
tic;
fprintf('RankBoost: creating the function, iteration %d out of %d\n',t,T);
WL = getBestWeakLearner(X,Y,w);
rbf.addWeakLearner(WL,t);
rbf.addAlpha(WL.alpha,t);
alpha=WL.alpha;

%update the distribution
%eval the weak learnler on the set of X and Y
h=WL.eval(X);
[hlen, ~] = size(h);
% tmph = (repmat(h,1,hlen) - repmat(h',hlen,1));
% w=w.*exp(tmph.*alpha);
[rows, cols] = size(w);
sumw = 0;
for r=1:rows
for c=1:cols
w(r,c) = w(r,c)*exp((h(r)-h(c))*alpha);
sumw = sumw + w(r,c);
end
end

%normalize w
% w = w./sum(w(:));
w = w./sumw;
toc;
end
end
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式