# Path: tribeflow/dataio.py
# def save_model(out_fpath, model):
# def initialize_trace(trace_fpath, num_topics, num_iter, \
#         from_=0, to=np.inf, initial_assign=None):
# 
# Path: tribeflow/dynamic.py
# def finalize_splits(nz, n_splits, splitted, Dts, Trace, nh, ns, kernel):
# def split(Dts, Trace, previous_stamps, Count_zh, Count_sz, \
#         count_h, count_z, alpha_zh, beta_zs, ll_per_z, kernel, \
#         perc=0.05, min_stamps=50):
# def correlate_counts(Count_zh, Count_sz, count_h, count_z, \
#         alpha_zh, beta_zs):
# def finalize_merge(nz, to_merge, Dts, Trace, nh, ns, kernel):
# def merge(Dts, Trace, previous_stamps, Count_zh, Count_sz, \
#         count_h, count_z, alpha_zh, beta_zs, ll_per_z, kernel):
# def fit(trace_fpath, num_topics, alpha_zh, beta_zs, kernel, \
#         residency_priors, num_iter, num_batches, mpi_mode, from_=0, to=np.inf):
#     C = np.cov(Theta_hz.T) + np.cov(Psi_sz.T)
#     C = np.triu(C, 1)
#     C = correlate_counts(Count_zh, Count_sz, count_h, count_z, \
#             alpha_zh, beta_zs)


from tribeflow import dataio
from tribeflow import dynamic
from tribeflow.tests import files
from tribeflow.kernels import ECCDFKernel
from tribeflow._eval import quality_estimate
from tribeflow._learn import fast_populate
from numpy.testing import assert_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
import numpy as np
#-*- coding: utf8
'''
Unit tests for the dynamic learning model.
'''
from __future__ import division, print_function






def test_correlate_all():
    tstamps, Trace, previous_stamps, Count_zh, Count_sz, count_h, count_z, \
            prob_topics_aux, Theta_zh, Psi_sz, hyper2id, source2id = \
            dataio.initialize_trace(files.SIZE10, 2, 10)
 
    C = dynamic.correlate_counts(Count_zh, Count_sz, count_h, count_z, .1, \
            .1)

    assert_equal((2, 2), C.shape)
    assert C[0, 1] != 0
    assert (np.tril(C) == 0).all()

def test_merge():
    tstamps, Trace, previous_stamps, Count_zh, Count_sz, count_h, count_z, \
            prob_topics_aux, Theta_zh, Psi_sz, hyper2id, source2id = \

# Path: tribeflow/dataio.py
# def save_model(out_fpath, model):
# def initialize_trace(trace_fpath, num_topics, num_iter, \
#         from_=0, to=np.inf, initial_assign=None):
# 
# Path: tribeflow/dynamic.py
# def finalize_splits(nz, n_splits, splitted, Dts, Trace, nh, ns, kernel):
# def split(Dts, Trace, previous_stamps, Count_zh, Count_sz, \
#         count_h, count_z, alpha_zh, beta_zs, ll_per_z, kernel, \
#         perc=0.05, min_stamps=50):
# def correlate_counts(Count_zh, Count_sz, count_h, count_z, \
#         alpha_zh, beta_zs):
# def finalize_merge(nz, to_merge, Dts, Trace, nh, ns, kernel):
# def merge(Dts, Trace, previous_stamps, Count_zh, Count_sz, \
#         count_h, count_z, alpha_zh, beta_zs, ll_per_z, kernel):
# def fit(trace_fpath, num_topics, alpha_zh, beta_zs, kernel, \
#         residency_priors, num_iter, num_batches, mpi_mode, from_=0, to=np.inf):
#     C = np.cov(Theta_hz.T) + np.cov(Psi_sz.T)
#     C = np.triu(C, 1)
#     C = correlate_counts(Count_zh, Count_sz, count_h, count_z, \
#             alpha_zh, beta_zs)


# Path: tribeflow/tests/test_dynamic.py
from tribeflow import dataio
from tribeflow import dynamic
from tribeflow.tests import files
from tribeflow.kernels import ECCDFKernel
from tribeflow._eval import quality_estimate
from tribeflow._learn import fast_populate
from numpy.testing import assert_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
import numpy as np

#-*- coding: utf8
'''
Unit tests for the dynamic learning model.
'''
from __future__ import division, print_function






def test_correlate_all():
    tstamps, Trace, previous_stamps, Count_zh, Count_sz, count_h, count_z, \
            prob_topics_aux, Theta_zh, Psi_sz, hyper2id, source2id = \
            dataio.initialize_trace(files.SIZE10, 2, 10)
 
    C = dynamic.correlate_counts(Count_zh, Count_sz, count_h, count_z, .1, \
            .1)

    assert_equal((2, 2), C.shape)
    assert C[0, 1] != 0
    assert (np.tril(C) == 0).all()

def test_merge():
    tstamps, Trace, previous_stamps, Count_zh, Count_sz, count_h, count_z, \
            prob_topics_aux, Theta_zh, Psi_sz, hyper2id, source2id = \

            dataio.initialize_trace(files.SIZE10, 2, 10)