def second_order_nic(x):
"""
transform
x1 x2 ---> 1 x1 x2 x1x2 x1**2 x2**2
nic : no initial constant
"""
ones = np.ones(len(x))
x1 = x[:, 0]
x2 = x[:, 1]
x1_sqr = x1**2
x2_sqr = x2**2
x1x2 = x1 * x2
return np.stack([ones, x1, x2, x1x2, x1_sqr, x2_sqr], axis=1)
# STOCHASTIC GRADIENT DESCENT
评论列表
文章目录