center2data.m.svn-base

来自「a function inside machine learning」· SVN-BASE 代码 · 共 13 行

SVN-BASE
13
字号
function [cX1, cX2] = center2Data(X1, X2) 
%Centers a matrix by taking the mean of each column (feature) of X1 and X2 and 
%subtracting the mean from feature value. 
%
%inputs 
% M is the matrix to be centered
%
%outputs 
% cM is the centered matrix 

meanX = mean([X1; X2]);
cX1 = X1 - ones(size(X1,1),1)*meanX;
cX2 = X2 - ones(size(X2,1),1)*meanX;

⌨️ 快捷键说明

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