def trim_value(value):
    """
    Trims the value, so that abs(value)<20,
    Values bigger then 20 cause numerical instability when calculating logits,
    The result value dosen't change for 20 upwards
    :param value:
    :return:
    """
    if value>20:
        return 20
    if value<-20:
        return -20
    return value