Matrix Factorization Rating Prediction

~10 mincode completion

Implement predict_ratings(mu, user_bias, item_bias, P, Q, users, items) returning one prediction per (users[j], items[j]) pair.

Where this shows up

~10 min

8 employers weight this skill

4 quant funds, 2 defense companies, 2 autonomy companies. Top match scores 93.

Python
import numpy as np


def predict_ratings(mu, user_bias, item_bias, P, Q, users, items):
    """
    Biased matrix-factorization predictions for a list of user-item pairs.

    Args:
        mu:        global mean rating
        user_bias: (U,) bias of each user
        item_bias: (I,) bias of each item
        P:         (U, k) user embeddings
        Q:         (I, k) item embeddings
        users:     (m,) user id of each pair
        items:     (m,) item id of each pair

    Returns:
        (m,) array of predicted ratings
    """
    # YOUR CODE HERE
    pass
Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.