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

📄 sampledata.m.svn-base

📁 a function inside machine learning
💻 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 + -