강의

멘토링

커뮤니티

Inflearn Community Q&A

kjh9502134603's profile image
kjh9502134603

asked

[Revised Edition] The Complete Guide to Python Machine Learning

Understanding Polynomial Regression and Predicting Boston Housing Prices Using Polynomial Regression

def polynomial_func(X) 질문있습니다.

Written on

·

209

1

 여기서 [:,0] 과 [:,1]은

각각 [0,2], [1,3]값인데

어떻게 [5, 125]가 나오죠?

머신러닝 배워볼래요? 통계python

Answer 1

0

dooleyz3525님의 프로필 이미지
dooleyz3525
Instructor

numpy 연산이 직관적이지 않은 부분이 있습니다.

아래와 같이 순차적으로 print해보시면 계산이 가능하실 것 입니다.

X = np.arange(0,4).reshape(2,2)
print('X:',X)
print('X[:, 0]:', X[:, 0],'\n','X[:, 1]:', X[:, 1])
print(1 + 2 * X[:, 0])
print(3*X[:,0]**2)
print(1 + 2*X[:,0] + 3*X[:,0]**2)
print(4*X[:,1]**3)
print(1 + 2*X[:,0] + 3*X[:,0]**2 + 4*X[:,1]**3)

kjh9502134603's profile image
kjh9502134603

asked

Ask a question