Skip to content

Commit

Permalink
simplify tests for cumulants.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jli05 committed May 7, 2017
1 parent edecb43 commit 98449e7
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions test_cumulants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import scipy.sparse
import scipy.stats
from cumulants import moment1, prod_m2_x, whiten_m3
from cumulants import prod_m2_x, whiten_m3

def simulate_word_count_vectors(alpha, beta, n_docs,
min_total_word_count, max_total_word_count):
Expand Down Expand Up @@ -140,12 +140,6 @@ def test_random_product_m2_x():

assert np.linalg.norm(docs_m2.dot(test_x) - m2x) <= 1e-6

docs_m1 = moment1(word_count_vectors, n_partitions=3)
m2x = prod_m2_x(word_count_vectors, test_x, alpha0,
docs_m1=docs_m1, n_partitions=n_partitions)

assert np.linalg.norm(docs_m2.dot(test_x) - m2x) <= 1e-6

def test_whiten_m3():
''' Test whitening M3 by random test matrix X '''
k = 5
Expand Down Expand Up @@ -173,10 +167,3 @@ def test_whiten_m3():

diff = contract_m3(docs_m3, test_x) - whitened_m3.reshape((k, k, k))
assert np.linalg.norm(diff) <= 1e-6

docs_m1 = moment1(word_count_vectors, n_partitions=3)
whitened_m3 = whiten_m3(word_count_vectors, test_x, alpha0,
docs_m1=docs_m1, n_partitions=n_partitions)

diff = contract_m3(docs_m3, test_x) - whitened_m3.reshape((k, k, k))
assert np.linalg.norm(diff) <= 1e-6

0 comments on commit 98449e7

Please sign in to comment.