C3_W2_Collaborative_RecSys_Assignment Issue

What to do here?

It appears that your cofi_cost_func() is returning None for the cost value.

What to do now? I cant understand


A function is returning a None when we return a variable that contains a None, or when we don’t return anything. Apparently, your code was missing the return statement. Below is what the exercise looks at the beginning, and there is the return J in the last line and that line is not supposed to be edited nor removed, but it seems that you had removed it.

# GRADED FUNCTION: cofi_cost_func
# UNQ_C1

def cofi_cost_func(X, W, b, Y, R, lambda_):
    Returns the cost for the content-based filtering
      X (ndarray (num_movies,num_features)): matrix of item features
      W (ndarray (num_users,num_features)) : matrix of user parameters
      b (ndarray (1, num_users)            : vector of user parameters
      Y (ndarray (num_movies,num_users)    : matrix of user ratings of movies
      R (ndarray (num_movies,num_users)    : matrix, where R(i, j) = 1 if the i-th movies was rated by the j-th user
      lambda_ (float): regularization parameter
      J (float) : Cost
    nm, nu = Y.shape
    J = 0
    ### START CODE HERE ###  
    ### END CODE HERE ### 

    return J


Thanks Mate! Really Appriciate