📄 sampledata.m.svn-base
字号:
function [newX, newY] = sampleData(X, y, sampleSize);
%Take a random sample of the data
if (nargin ~= 3)
fprintf('%s\n', help(sprintf('%s', mfilename)));
error('Incorrect number of inputs - see above usage instructions.');
end
numExamples = size(X, 1);
sampleSize = min(sampleSize, numExamples);
permutationVector = randperm(numExamples);
sampleIndexVector = permutationVector(1:sampleSize);
newX = X(sampleIndexVector, :);
newY = y(sampleIndexVector, :);
fprintf('Subsampled data from %d to %d examples\n', numExamples, sampleSize);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -