def _filter_points_to_get_convex_hull(roc_sorted):
    """Find the convex hull.

    Uses a simplified version of Andrew's monotone chain convex hull algorithm
    https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain
    to get the convex hull. Since we can assume the points (0,0) and (1,1) to be part
    of the convex hull the problem is simpler and we only need to make a single pass
    through the data.

    :param roc_sorted: DataFrame with ROC curve points sorted by 'x'
    :type roc_sorted: pandas.DataFrame
    :return: the list of points that make up the convex hull
    :rtype: list of named tuples
    """
    selected = []
    for r2 in roc_sorted.itertuples():
        while len(selected) >= 2:
            r1 = selected[-1]
            r0 = selected[-2]
            if (r1.y - r0.y) * (r2.x - r0.x) <= (r2.y - r0.y) * (r1.x - r0.x):
                selected.pop()
            else:
                break
        selected.append(r2)
    return selected
