เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Decomposing your matrix

Now that you have prepped your data by centering it and filling in the remaining empty values with 0, you can get around to finding your data's factors. In this exercise, you will break the user_ratings_centered data you generated in the last exercise into 3 factors: U, sigma, and Vt.

  • U is a matrix with a row for each user
  • Vt has a column for each movie
  • sigma is an array of weights that you will need to convert to a diagonal matrix

The user_ratings_centered that you created in the last lesson has been loaded for you.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Building Recommendation Engines in Python

ดูคอร์ส

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Import the required libraries 
from scipy.sparse.linalg import ____
import numpy as np

# Decompose the matrix
U, sigma, Vt = ____(user_ratings_centered)
แก้ไขและรันโค้ด