Skip to content

Instantly share code, notes, and snippets.

@tanjuntao
Last active October 13, 2018 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanjuntao/12112af1586fc7144897874f03931ffa to your computer and use it in GitHub Desktop.
Save tanjuntao/12112af1586fc7144897874f03931ffa to your computer and use it in GitHub Desktop.
MatLab中如何mapFeature,即:将少数的特征扩展出众多的高次项特征。
function out = mapFeature(X1, X2)
degree = 6;
out = ones(size(X1(:,1)));
for i = 1:degree
for j = 0:i
out(:, end+1) = (X1.^(i-j)).*(X2.^j);
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment