예제 #1
0
 def test_huber_huberT(self):
     n = scale.norms.HuberT()
     n.t = 1.5
     h = scale.Huber(norm=n)
     assert_almost_equal(scale.huber(self.chem)[0], h(self.chem)[0],
                         DECIMAL)
     assert_almost_equal(scale.huber(self.chem)[1], h(self.chem)[1],
                         DECIMAL)
예제 #2
0
 def test_huber_huberT(self):
     n = scale.norms.HuberT()
     n.t = 1.5
     h = scale.Huber(norm=n)
     assert_almost_equal(scale.huber(self.chem)[0], h(self.chem)[0],
                         DECIMAL)
     assert_almost_equal(scale.huber(self.chem)[1], h(self.chem)[1],
                         DECIMAL)
예제 #3
0
def get_location_estimator(estimator):
    if hasattr(estimator, "__call__"):
        f = estimator
    elif type(estimator) == str:
        if estimator == "HL" or estimator == "hl" or estimator == "hodges_lehmann":
            f = hodges_lehmann_mean
        elif estimator == "median":
            f = np.median
        elif estimator == "Huber" or estimator == "huber":
            f = lambda x: np.asscalar(huber(x)[0])
        else:
            f = np.mean
    else:
        f = np.mean

    return f
예제 #4
0
def get_scale_estimator(estimator):
    if hasattr(estimator, "__call__"):
        f = estimator
    elif type(estimator) == str:
        if estimator == "Huber" or estimator == "huber":
            f = lambda x: np.asscalar(huber(x)[1])
        elif estimator == "MAD" or estimator == "mad" or estimator == "mean_absolute_deviation":
            f = median_absolute_deviation
        elif estimator == "apdS" or estimator == "S":
            f = lambda x: absolute_pairwise_difference(x, "S")
        elif estimator == "apdQ" or estimator == "Q":
            f = lambda x: absolute_pairwise_difference(x, "Q")
        elif estimator == "biweight_midvariance" or estimator == "bmv":
            f = biweight_midvariance
        else:
            f = np.var
    else:
        f = np.var

    return f
 def test_huber_location(self):
     assert_almost_equal(scale.huber(self.chem)[1], 0.67365, DECIMAL)
 def test_huber_scale(self):
     assert_almost_equal(scale.huber(self.chem)[0], 3.20549, DECIMAL)
예제 #7
0
 def test_huber_location(self):
     assert_almost_equal(scale.huber(self.chem)[1], 0.67365, DECIMAL)
예제 #8
0
 def test_huber_scale(self):
     assert_almost_equal(scale.huber(self.chem)[0], 3.20549, DECIMAL)