Factorisation de matrices
La matrice G est fournie ici sous forme de dataframe Pandas. Affichez-la pour voir à quoi elle ressemble. Examinez les matrices candidates H, I et J (elles aussi des dataframes Pandas), puis déterminez quelles deux matrices, multipliées ensemble, produisent la matrice G.
Cette activité fait partie du cours
Créer des moteurs de recommandation avec PySpark
Instructions de l’exercice
- Examinez la matrice
Gavec la commandeprint. - Consultez les matrices
H,IetJet déterminez quelle paire de ces matrices produiraGlorsqu'on les multiplie. - Saisissez votre réponse dans l'appel
np.matmul()fourni.
Exercice interactif pratique
Essayez cet exercice en complétant ce code d’exemple.
# 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)