Last active
October 13, 2018 01:07
-
-
Save tanjuntao/12112af1586fc7144897874f03931ffa to your computer and use it in GitHub Desktop.
MatLab中如何mapFeature,即:将少数的特征扩展出众多的高次项特征。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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