Example #1
0
    def test_copies(self):
        x = np.random.uniform(low=0, high=1, size=(2, 100))
        x0 = np.copy(x[0])
        x1 = np.copy(x[1])

        entropy.sampen(x0, 2, 0.1)
        assert_equal(x0, x[0])

        entropy.fuzzyen(x0, 2, 0.1, 2)
        assert_equal(x0, x[0])

        entropy.cross_sampen(x0, x1, 2, 0.1)
        assert_equal(x0, x[0])
        assert_equal(x1, x[1])

        entropy.cross_fuzzyen(x0, x1, 2, 0.1, 2)
        assert_equal(x0, x[0])
        assert_equal(x1, x[1])
Example #2
0
def main():
    N = 100
    rs = np.logspace(-3, 0, 10)

    fig, ax = plt.subplots()

    es = []
    for r in rs:
        runs = []
        for i in range(50):
            x = np.random.uniform(0, 1, N)
            runs.append(entropy.fuzzyen(x, 2, r, 2))
        es.append(np.mean(runs))

    ax.semilogx(rs, es, 'o')
    ax.set_ylim(0, 6)

    plt.show()
Example #3
0
 def test_fuzzyen_1d(self):
     e = entropy.fuzzyen(self.data_1d, 2, 0.1, 2)
     assert_almost_equal(e, 0.20953354)