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

📄 centersparsedata.m.svn-base

📁 a function inside machine learning
💻 SVN-BASE
字号:
function cX = centerSparseData(X) 
%Centers a sparse matrix by taking the mean of each column (feature) of M and 
%subtracting the mean from feature value. NOTE: This often makes it non
%sparse!
%
%inputs 
% M is the matrix to be centered
%
%outputs 
% cX is the centered matrix 

[numExamples, numFeatures] = size(X); 
cX = sparse(numExamples, numFeatures); 

meanX = mean(X);

for i=1:numFeatures 
    cX(:, i) = X(:, i) - meanX(i); 
end 

⌨️ 快捷键说明

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