IniziaInizia gratis

Matrix factorization

Matrix G is provided here as a Pandas dataframe. View it to understand what it looks like. Look at the possible factor matrices H, I, and J (also Pandas dataframes), and determine which two matrices will produce the matrix G when multiplied together.

Questo esercizio fa parte del corso

Building Recommendation Engines with PySpark

Visualizza il corso

Istruzioni dell'esercizio

  • Take a look at matrix G using the print command
  • Take a look at the matrices H, I, and J and determine which pair of those matrices will produce G when multiplied together.
  • Input your answer into the np.matmul() code provided.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Take a look at Matrix G using the following print function
print("Matrix G:")
print(____)

# Take a look at the matrices H, I, and J and determine which pair of those matrices will produce G when multiplied together. 
print("Matrix H:")
print(____)
print("Matrix I:")
print(____)
print("Matrix J:")
print(____)

# Multiply the two matrices that are factors of the matrix G
prod = np.matmul(____, ____)
print(G == prod)
Modifica ed esegui il codice