행렬 곱셈
행렬 곱셈을 더 직관적으로 이해하기 위해, 일부 연산을 직접 손으로 해 보겠습니다.
이 연습은 강의의 일부입니다
PySpark로 추천 엔진 만들기
연습 안내
- 행렬
a와b는 Pandas 데이터프레임이에요. 각각에 대해.head()메서드를 사용해 내용을 확인하세요. - 두 행렬의 곱을 직접 계산해 보세요.
a와b행렬의 곱 결과 값을np.array()로 만든product배열에 입력하세요.- 마지막 줄의 검증 코드를 사용해 여러분의 계산을 확인하세요.
.dot()메서드는 두 행렬을 서로 곱합니다.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Use the .head() method to view the contents of matrices a and b
print("Matrix A: ")
print (a.____())
print("Matrix B: ")
print (b.____())
# Complete the matrix with the product of matrices a and b
product = np.array([[____,____], [____,____]])
# Run this validation to see how your estimate performs
product == np.dot(a,b)