⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mddm_linear.m

📁 MDDM是一种多类标分类降维算法
💻 M
字号:
function [P lambda] = mddm_linear(X, L, projtype, mu, dim_para)
% mddm_linear tackles linear dimensionality reduction of multi-label problem through the method proposed in [1].
%
%    Syntax
%
%       [P lambda] = mddm_linear(X, L, projtype, mu, dim_para)
%
%    Description
%
%       mcKLR takes,
%           X                - A DxN matrix, where D is the dimension of data and N is the number of data. Each column is a sample.
%           L                - A NxN matrix, the kernel matrix for label
%           projtype         - The type of projection, can take the value of:
%                                'proj':       the projection is uncorrelated
%                                'spc':        the feature is uncorrelated
%           mu               - The regularization parameter
%           dim_para         - The parameter for the final dimension, can takes:
%                                0:            keep the original dimension
%                                (0, 1):       dim_para is thr [1]
%                                [1, +\inf):   dim_para is d [1]
%
%      and returns,
%           P                - The obtained projection
%           lambda           - The predicted label of testing data
%
% [1] Y. Zhang and Z.-H. Zhou. Multi-label dimensionality reduction via dependency maximization. In: AAAI'08, Chicago, IL, 2008, pp.1503-1505.


[D N] = size(X);
tmpL = L - repmat(mean(L,1),N,1);
HLH = tmpL - repmat(mean(tmpL,2),1,N);

S = X * HLH * X';

if strcmp(projtype,'proj')
    B = eye(D);
else if strcmp(projtype,'spc')
        B = X * X' + mu * eye(D);
    else
        disp('The projtype can only takes proj and spc.');
        return;
    end
end

clear X L;

[tmp_P tmp_lambda] = eig(S, B);
tmp_P = real(tmp_P);
tmp_lambda = real(diag(tmp_lambda));
[lambda order] = sort(tmp_lambda, 'descend');
P = tmp_P(:,order);
clear tmp_P;

proper_dim = getProperDim(lambda, dim_para);
P = P(:,1:proper_dim);
lambda = lambda(1:proper_dim);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -