centres = ccl_math_gc(X, num_basis ) Generate the centres of the basis functions uniformly distributed over the range of the input data X Input: X Input data num_basis Number of basis functions Output: centres Centres of the basis functions
0001 function centres = ccl_math_gc(X, num_basis ) 0002 % centres = ccl_math_gc(X, num_basis ) 0003 % 0004 % Generate the centres of the basis functions uniformly distributed over 0005 % the range of the input data X 0006 % 0007 % Input: 0008 % 0009 % X Input data 0010 % num_basis Number of basis functions 0011 % 0012 % Output: 0013 % 0014 % centres Centres of the basis functions 0015 0016 0017 0018 0019 % CCL: A MATLAB library for Constraint Consistent Learning 0020 % Copyright (C) 2007 Matthew Howard 0021 % Contact: matthew.j.howard@kcl.ac.uk 0022 % 0023 % This library is free software; you can redistribute it and/or 0024 % modify it under the terms of the GNU Lesser General Public 0025 % License as published by the Free Software Foundation; either 0026 % version 2.1 of the License, or (at your option) any later version. 0027 % 0028 % This library is distributed in the hope that it will be useful, 0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0031 % Lesser General Public License for more details. 0032 % 0033 % You should have received a copy of the GNU Library General Public 0034 % License along with this library; if not, write to the Free 0035 % Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 0036 0037 if ~exist('num_basis') 0038 n = sqrt(floor(sqrt(size(X,2)/6))^2) ; 0039 else 0040 n = floor(sqrt(num_basis)); 0041 end 0042 xmin = min(X,[],2); 0043 xmax = max(X,[],2); 0044 0045 % allocate centres on a grid 0046 [xg,yg] = meshgrid( linspace(xmin(1)-0.1,xmax(1)+0.1,n),... 0047 linspace(xmin(2)-0.1,xmax(2)+0.1,n)); 0048 centres = [xg(:) yg(:)]'; 0049 end 0050