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 (également des dataframes Pandas) et déterminez quelles deux matrices donneront la matrice G lorsqu’on les multiplie.
Cet exercice fait partie du cours
<cours>Créer des moteurs de recommandation avec PySpark</cours>Instructions de l’exercice
- Affichez la matrice
Gavec la commandeprint - Examinez les matrices
H,IetJet déterminez quelle paire de ces matrices permet d’obtenirGlorsqu’on les multiplie. - Saisissez votre réponse dans le code
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)