def get_weights(predictions, ratings, alpha=1.0):
    assert predictions.shape[0] > predictions.shape[1]
    number_of_models = predictions.shape[1]
    gamma = np.eye(number_of_models) * alpha ** 2
    ptp_plus_gamma = predictions.T * predictions + gamma
    weights = np.dot(np.linalg.inv(ptp_plus_gamma) * predictions.T, ratings)
    return np.ravel(weights)
dataset/ETHPy150Open jvanbrug/netflix/scripts/blend.py/get_weights/original