행렬 곱셈
행렬 곱셈을 직접 이해하기 위해, 행렬 연산을 손으로 직접 계산해 보겠습니다.
이 연습은 강의의 일부입니다
PySpark로 추천 엔진 만들기
연습 안내
a와b는 Pandas 데이터프레임입니다. 각 데이터프레임에.head()메서드를 사용하여 내용을 확인하세요.- 두 행렬의 곱을 직접 계산해 보세요.
np.array()로 생성된product배열에a와b행렬의 곱 결과값을 입력하세요.- 마지막 줄의 검증 코드를 실행하여 계산 결과를 확인하세요.
.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)