def test_aa_t(): h = fl.aa(0.8) assert 1 == h([1.0, 1.0, 1.0, 1.0]) assert 0 == h([0.0, 0.0, 0.0, 0.0]) # 0.2, 0.6, 0.7, 0.9 # p = 0.8 # a = p / (1.0 - p) # a = 4 # 1.0 - ((((1.0-0.2)**(1.0/a)) + ((1.0-0.6)**(1.0/a)) + ((1.0-0.7)**(1.0/a)) + ((1.0-0.9)**(1.0/a))) / 4.0)**a # = 0.6649 diff = 0.6649 - h([0.2, 0.6, 0.7, 0.9]) assert diff < 0.0001
def test_aa_tco(): h = fl.aa(0.2) assert 1 == h([1.0, 1.0, 1.0, 1.0]) assert 0 == h([0.0, 0.0, 0.0, 0.0]) # 0.2, 0.6, 0.7, 0.9 # p = 0.2 # a = (1.0 - p) / p # a = 4 # (((0.2**a) + (0.6**a) + (0.7**a) + (0.9**a)) / 4.0)**(1.0/a) # = 0.7119 diff = 0.7119 - h([0.2, 0.6, 0.7, 0.9]) assert diff < 0.0001
def build_aiwa_operator(andness, m): return fl.aa(andness)
def test_aa_wrapper(): sut = fl.aa(0.00000001) assert isinstance(sut, fl.AndnessDirectedAveraging)