• 大小: 119KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-17
  • 语言: Matlab
  • 标签: pso  

资源简介

现有的LSSVM工具箱,自带PSO优化,参数无需调整,Matlab编写的人工蜂群算法代码,含详细注释和测试函数,简短易懂,执行顺畅。可用于解决无约束优化问题。

资源截图

代码片段和文件信息

function [featureseigveceigvals] = AFEm(Xskernel kernel_parsXtypenbeigveceigvals)
% Automatic Feature Extraction by Nystrom method
%
%
% >> features = AFE(X kernel sig2 Xt)
%
% Description
% Using the Nystr�m approximation method the mapping of data to
% the feature space can be evaluated explicitly. This gives the
% features that one can use for a linear regression or
% classification. The decomposition of the mapping to the feature
% space relies on the eigenvalue decomposition of the kernel
% matrix. The Matlab (‘eigs‘) or Nystr�m‘s (‘eign‘) approximation
% using the nb most important eigenvectors/eigenvalues can be
% used. The eigenvalue decomposition is not re-calculated if it is
% passed as an extra argument. This routine internally calls a cmex file.
%
% Full syntax

% >> [features U lam] = AFE(X kernel sig2 Xt) 
% >> [features U lam] = AFE(X kernel sig2 Xt type) 
% >> [features U lam] = AFE(X kernel sig2 Xt type nb) 
% >> features          = AFE(X kernel sig2 Xt [][] U lam)

% Outputs    
%   features : Nt x nb matrix with extracted features
%   U(*)     : N x nb matrix with eigenvectors
%   lam(*)   : nb x 1 vector with eigenvalues
% Inputs    
%   X      : N x d matrix with input data
%   kernel : Name of the used kernel (e.g. ‘RBF_kernel‘)
%   sig2   : parameter of the used kernel
%   Xt     : Data from which the features are extracted
%   type(*): ‘eig‘(*) ‘eigs‘ or ‘eign‘
%   nb(*)  : Number of eigenvalues/eigenvectors used in the eigenvalue decomposition approximation
%   U(*)   : N x nb matrix with eigenvectors
%   lam(*) : nb x 1 vector with eigenvalues

% See also:
%   kernel_matrix RBF_kernel demo_fixedsize

% Copyright (c) 2011  KULeuven-ESAT-SCD License & help @ http://www.esat.kuleuven.be/sista/lssvmlab

N = size(X1);
Nc = size(Xs1);

eval(‘type;‘‘type=‘‘eig‘‘;‘);
if ~(strcmp(type‘eig‘) || strcmp(type‘eigs‘) || strcmp(type‘eign‘) )
  error(‘Type needs to be ‘‘eig‘‘ ‘‘eigs‘‘ or ‘‘eign‘‘...‘);
end
  

% eigenvalue decomposition to do..
if nargin<=7
  omega = kernel_matrix(Xs kernel kernel_pars);
  if strcmp(type‘eig‘)
    [eigveceigvals] = eig(omega+2*eye(size(omega1))); % + jitter factor
    eigvals = diag(eigvals); 
    clear omega
  elseif strcmp(type‘eigs‘)
    eval(‘nb;‘‘nb=min(size(omega1)10);‘); options.disp = 0;
    [eigveceigvals] = eigs(omega+2*eye(size(omega1))nb‘lm‘options); clear omega % + jitter factor
  elseif strcmp(type‘eign‘)
    eval(‘nb;‘‘nb=min(size(omega1)10);‘); 
    [eigveceigvals] = eign(omega+2*eye(size(omega1))nb); clear omega % + jitter factor
  end
  eigvals = (eigvals-2)/Nc;

  peff = eigvals>eps;
  eigvals = eigvals(peff);
  eigvec = eigvec(:peff); clear peff
  
end 

if strcmp(kernel‘RBF_kernel‘)
    omegaN = sum(X.^22)*ones(1Nc);
    omegaN = omegaN + ones(N1)*sum(Xs.^22)‘;
    omegaN = omegaN -2*X*Xs‘; clear X Xs
    omegaN = exp(-o

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-10-30 17:06  LSSVMlabv1_8_R2009b_R2011a\
     文件        3437  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\AFEm.m
     文件         603  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\MLP_kernel.m
     文件        1105  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\RBF_kernel.m
     文件        5785  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bay_errorbar.m
     文件        1998  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bay_initlssvm.m
     文件       10339  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bay_lssvm.m
     文件        8187  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bay_lssvmARD.m
     文件        9358  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bay_modoutClass.m
     文件        5843  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bay_optimize.m
     文件        4312  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bay_rr.m
     文件        1479  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\bitreverse32.m
     文件        5576  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\changelssvm.m
     文件        4744  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\cilssvm.m
     文件        4245  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\code.m
     文件        5194  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\code_ECOC.m
     文件         548  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\code_MOC.m
     文件         361  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\code_OneVsAll.m
     文件         576  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\code_OneVsOne.m
     文件        2107  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\codedist_bay.m
     文件         753  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\codedist_hamming.m
     文件        2015  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\codedist_loss.m
     文件        4126  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\codelssvm.m
     文件        5847  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\crossvalidate.m
     文件        3941  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\crossvalidatelssvm.m
     文件        3188  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\csa.m
     文件        2251  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\demo_fixedclass.m
     文件        3233  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\demo_fixedsize.m
     文件        3447  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\demo_yinyang.m
     文件        3461  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\democlass.m
     文件        2147  2015-09-29 17:30  LSSVMlabv1_8_R2009b_R2011a\democonfint.m
............此处省略52个文件信息

评论

共有 条评论