矩陣相乘(二)
來測試一下你在矩陣相乘方面的功力。
本練習屬於課程
使用 PySpark 打造推薦引擎
練習說明
- 使用
.shape屬性查看矩陣C與D的維度,判斷這兩個矩陣是否可以相乘。 - 如果可以相乘,使用
np.matmul()來相乘;如果不行,將C_times_D設為None。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Print the dimensions of C
print(____.____)
# Print the dimensions of D
print(____.____)
# Can C and D be multiplied together?
C_times_D = ____