예제 #1
0
def logistic_mixture_norm_test():
    xscale = Scale(-50, 50)
    return LogisticMixture(
        components=[Logistic(-40, 1, xscale),
                    Logistic(50, 10, xscale)],
        probs=[0.5, 0.5],
    )
예제 #2
0
def normalized_logistic_mixture():
    return LogisticMixture(
        components=[
            Logistic(loc=0.15, s=0.037034005, scale=Scale(0, 1)),
            Logistic(loc=0.85, s=0.032395907, scale=Scale(0, 1)),
        ],
        probs=[0.6, 0.4],
    )
예제 #3
0
def logistic_mixture():
    return LogisticMixture(
        components=[
            Logistic(loc=10000, scale=1000),
            Logistic(loc=100000, scale=10000)
        ],
        probs=[0.8, 0.2],
    )
예제 #4
0
def logistic_mixture_p_overlapping():
    xscale = three_sd_scale(4000000.035555004, 200000.02)
    return LogisticMixture(
        components=[
            Logistic(4000000.035555004, 200000.02, xscale),
            Logistic(4000000.0329152746, 200000.0, xscale),
        ],
        probs=[0.5, 0.5],
    )
예제 #5
0
def logistic_mixture_p_uneven():
    xscale = Scale(-10, 20)
    return LogisticMixture(
        components=[
            Logistic(loc=10, s=3, scale=xscale),
            Logistic(loc=5, s=5, scale=xscale),
        ],
        probs=[1.8629593e-29, 1.0],
    )
예제 #6
0
def logistic_mixture10():
    xscale = Scale(-20, 40)
    return LogisticMixture(
        components=[
            Logistic(loc=15, s=2.3658268, scale=xscale),
            Logistic(loc=5, s=2.3658268, scale=xscale),
        ],
        probs=[0.5, 0.5],
    )
예제 #7
0
def logistic_mixture():
    xscale = Scale(0, 150000)
    return LogisticMixture(
        components=[
            Logistic(loc=10000, s=1000, scale=xscale),
            Logistic(loc=100000, s=10000, scale=xscale),
        ],
        probs=[0.8, 0.2],
    )
예제 #8
0
def logistic_mixture15():
    xscale = Scale(-10, 40)
    return LogisticMixture(
        components=[
            Logistic(loc=10, s=3.658268, scale=xscale),
            Logistic(loc=20, s=3.658268, scale=xscale),
        ],
        probs=[0.5, 0.5],
    )
예제 #9
0
def smooth_logistic_mixture():
    xscale = Scale(1, 1000000.0)
    return LogisticMixture(
        components=[
            Logistic(loc=400000, s=100000, scale=xscale),
            Logistic(loc=700000, s=50000, scale=xscale),
        ],
        probs=[0.8, 0.2],
    )
예제 #10
0
def truncated_logistic_mixture():
    xscale = Scale(5000, 120000)
    return LogisticMixture(
        components=[
            Truncate(
                Logistic(loc=10000, s=1000, scale=xscale), floor=5000, ceiling=500000
            ),
            Truncate(
                Logistic(loc=100000, s=10000, scale=xscale), floor=5000, ceiling=500000
            ),
        ],
        probs=[0.8, 0.2],
    )
예제 #11
0
def test_percentiles_from_mixture():
    xscale = Scale(-1, 4)
    mixture = LogisticMixture(
        components=[
            Logistic(loc=1, s=0.1, scale=xscale),
            Logistic(loc=2, s=0.1, scale=xscale),
        ],
        probs=[0.5, 0.5],
    )
    conditions = mixture.percentiles(percentiles=[0.1, 0.5, 0.9])
    for condition in conditions:
        if condition.max == 0.5:
            assert condition.p == pytest.approx(1.5, rel=0.01)
    return conditions
예제 #12
0
파일: linear.py 프로젝트: seanjtaylor/ergo
    def get_true_scale_logistic(self, normalized_dist: Logistic) -> Logistic:
        """
        Convert a normalized logistic distribution to a logistic on
        the true scale of the question.

        :param normalized_dist: normalized logistic distribution
        :return: logistic distribution on the true scale of the question
        """
        scale_loc = (normalized_dist.loc * self.question_range_width +
                     self.question_range["min"])

        true_scale = normalized_dist.scale * self.question_range_width
        return Logistic(scale_loc, true_scale)
예제 #13
0
def easyLogistic(loc, scale):
    return Logistic(loc, scale, three_sd_scale(loc, scale))