def build_anti_testset_memory_managed(self, user_id, fill=None):
    """Return a list of ratings that can be used as a testset in the
    :meth:`test() <surprise.prediction_algorithms.algo_base.AlgoBase.test>`
    method.

    The ratings are all the ratings that are **not** in the trainset, i.e.
    all the ratings :math:`r_{ui}` where the user :math:`u` is known, the
    item :math:`i` is known, but the rating :math:`r_{ui}`  is not in the
    trainset. As :math:`r_{ui}` is unknown, it is either replaced by the
    :code:`fill` value or assumed to be equal to the mean of all ratings
    :meth:`global_mean <surprise.Trainset.global_mean>`.

    Optimised to work on very large datasets (>2GB)

    Args:
        fill(float): The value to fill unknown ratings. If :code:`None` the
            global mean of all ratings :meth:`global_mean
            <surprise.Trainset.global_mean>` will be used.
        user_id(numeric): The desired user whose predictions are to be
            calculated.

    Returns:
        A list of tuples ``(uid, iid, fill)`` where ids are raw ids.
    """
    fill = self.global_mean if fill is None else float(fill)

    user_id = self.to_inner_uid(int(user_id))
    anti_testset = []
    user_items = set([j for (j, _) in self.ur[user_id]])
    anti_testset += [(self.to_raw_uid(user_id), self.to_raw_iid(i), fill) for
                     i in self.all_items() if
                     i not in user_items]
    return anti_testset