def test_psi_returns_zero():
    x = np.random.normal(size=1000)
    myBucketer = binning.QuantileBucketer(bin_count=10)
    myBucketer.fit(x)
    d1 = myBucketer.counts_
    d2 = d1
    psi_test, p_value_test = psi(d1, d2, verbose=False)
    assert psi_test == 0.0
Esempio n. 2
0
def test_psi_returns_large():
    """
    Test.
    """
    d1 = np.histogram(np.random.normal(size=1000), 10)[0]
    d2 = np.histogram(np.random.weibull(1, size=1000) - 1, 10)[0]
    psi_test, p_value_test = psi(d1, d2, verbose=False)
    assert psi_test > 1.0
def test_distribution_statistics_attributes_psi():
    a = np.random.normal(size=1000)
    b = np.random.normal(size=1000)
    d1 = np.histogram(a, 10)[0]
    d2 = np.histogram(b, 10)[0]
    myTest = DistributionStatistics('psi', binning_strategy=None)
    _ = myTest.compute(d1, d2, verbose=False)
    psi_value_test, p_value_test = psi(d1, d2, verbose=False)
    assert myTest.statistic == psi_value_test
Esempio n. 4
0
def test_psi_returns_large():
    '''Population Stability Index returns large value (>1.0)'''
    d1 = np.histogram(np.random.normal(size=1000), 10)[0]
    d2 = np.histogram(np.random.weibull(1, size=1000) - 1, 10)[0]
    psi_test, p_value_test = psi(d1, d2, verbose=False)
    assert psi_test > 1.0