def mapFeatures(X):
'''
MAPFEATURE Feature mapping function to polynomial features
MAPFEATURE(X1, X2) maps the two input features
to quadratic features used in the regularization exercise.
Returns a new feature array with more features, comprising of
X1, X2, X1.^2, X2.^2, X1*X2, X1*X2.^2, etc..
Inputs X1, X2 must be the same size
:param X:
:return: XTransform
'''
degree = 4
poly = PolynomialFeatures(degree)
XTransform = poly.fit_transform(X)
return XTransform
gradientDescent.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录