def to_rating(value):
    """
    Converts the given value to a valid numerical skill rating.

    Args:
        value (str, int, or float): The value to convert.

    Returns:
        float: The converted value.

    Raises:
        ValueError: If ``value`` cannot be converted to a float, or if the converted value is less than zero.
    """
    if type(value) not in [int, float, str]:
        raise ValueError("Cannot convert %s value '%s' to a rating. Only str and numerical types are allowed."
                         % (type(value), value))
    try:
        rating = float(value)
    except ValueError as e:
        raise ValueError("Failed to convert '%s' to a numerical rating" % value, e)
    if rating < 0:
        raise ValueError("Invalid rating: '%s'. Ratings must be larger than or equal to zero." % value)
    return rating