Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ppc_w
Browse files Browse the repository at this point in the history
Merge branch master to fix text env.
  • Loading branch information
AlexAndorra committed Aug 10, 2020
2 parents 9e03e4d + 92ff9e9 commit 5ebb03b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
stage: test
install:
- . ./scripts/create_testenv.sh
- conda uninstall arviz -y
# replace ArviZ with the lastest master
- conda activate testenv
# replace ArviZ with the latest master
- pip install git+git://github.com/arviz-devs/arviz.git
- pip install codecov
- conda list && pip freeze
Expand Down
3 changes: 3 additions & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ dependencies:
- ipywidgets
- dataclasses # python_version < 3.7
- contextvars # python_version < 3.7
- mkl-service
- libblas=*=*mkl
- pip:
- black_nbconvert
- dill
2 changes: 1 addition & 1 deletion pymc3/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def strict_float32():
yield


@pytest.fixture('function', autouse=False)
@pytest.fixture(scope='function', autouse=False)
def seeded_test():
# TODO: use this instead of SeededTest
np.random.seed(42)
Expand Down
2 changes: 1 addition & 1 deletion pymc3/tests/test_minibatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __next__(self):
next = __next__


@pytest.fixture('module')
@pytest.fixture(scope='module')
def datagen():
return _DataSampler(np.random.uniform(size=(1000, 10)))

Expand Down
24 changes: 12 additions & 12 deletions pymc3/tests/test_variational_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_tracker_callback():
tracker(None, None, 1)


@pytest.fixture('module')
@pytest.fixture(scope='module')
def three_var_model():
with pm.Model() as model:
pm.HalfNormal('one', shape=(10, 2), total_size=100)
Expand Down Expand Up @@ -573,7 +573,7 @@ def test_elbo_beta_kl(aux_total_size):


@pytest.fixture(
'module',
scope='module',
params=[True, False],
ids=['mini', 'full']
)
Expand Down Expand Up @@ -617,7 +617,7 @@ def simple_model(simple_model_data):
return model


@pytest.fixture('module', params=[
@pytest.fixture(scope='module', params=[
dict(cls=NFVI, init=dict(flow='scale-loc')),
dict(cls=ADVI, init=dict()),
dict(cls=FullRankADVI, init=dict()),
Expand All @@ -642,13 +642,13 @@ def init_(**kw):
return init_


@pytest.fixture('function')
@pytest.fixture(scope='function')
def inference(inference_spec, simple_model):
with simple_model:
return inference_spec()


@pytest.fixture('function')
@pytest.fixture(scope='function')
def fit_kwargs(inference, use_minibatch):
_select = {
(ADVI, 'full'): dict(
Expand Down Expand Up @@ -709,7 +709,7 @@ def test_fit_oo(inference,
mu_post = simple_model_data['mu_post']
d = simple_model_data['d']
np.testing.assert_allclose(np.mean(trace['mu']), mu_post, rtol=0.05)
np.testing.assert_allclose(np.std(trace['mu']), np.sqrt(1. / d), rtol=0.1)
np.testing.assert_allclose(np.std(trace['mu']), np.sqrt(1. / d), rtol=0.2)


def test_profile(inference):
Expand Down Expand Up @@ -747,7 +747,7 @@ def test_clear_cache():
assert all(len(c) == 0 for c in inference_new.approx._cache.values())


@pytest.fixture('module')
@pytest.fixture(scope='module')
def another_simple_model():
_model = models.simple_model()[1]
with _model:
Expand Down Expand Up @@ -798,7 +798,7 @@ def test_fit_fn_text(method, kwargs, error, another_simple_model):
fit(10, method=method, **kwargs)


@pytest.fixture('module')
@pytest.fixture(scope='module')
def aevb_model():
with pm.Model() as model:
pm.HalfNormal('x', shape=(2,), total_size=5)
Expand Down Expand Up @@ -871,7 +871,7 @@ def test_pickle_approx_aevb(three_var_aevb_approx):
assert new.sample(1000)


@pytest.fixture('module')
@pytest.fixture(scope='module')
def binomial_model():
n_samples = 100
xs = intX(np.random.binomial(n=1, p=0.2, size=n_samples))
Expand All @@ -881,7 +881,7 @@ def binomial_model():
return model


@pytest.fixture('module')
@pytest.fixture(scope='module')
def binomial_model_inference(binomial_model, inference_spec):
with binomial_model:
return inference_spec()
Expand Down Expand Up @@ -980,10 +980,10 @@ def test_var_replacement():
def test_empirical_from_trace(another_simple_model):
with another_simple_model:
step = pm.Metropolis()
trace = pm.sample(100, step=step, chains=1)
trace = pm.sample(100, step=step, chains=1, tune=0)
emp = Empirical(trace)
assert emp.histogram.shape[0].eval() == 100
trace = pm.sample(100, step=step, chains=4)
trace = pm.sample(100, step=step, chains=4, tune=0)
emp = Empirical(trace)
assert emp.histogram.shape[0].eval() == 400

Expand Down
5 changes: 2 additions & 3 deletions scripts/create_testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ if [ -z ${GLOBAL} ]; then
else
conda config --add channels conda-forge
conda config --set channel_priority strict
conda env create -f environment-dev.yml
conda install -c conda-forge mamba --yes
mamba env create -f environment-dev.yml
fi
source activate ${ENVNAME}
fi

conda update --yes --all

# Install editable using the setup.py
if [ -z ${NO_SETUP} ]; then
python setup.py build_ext --inplace
Expand Down

0 comments on commit 5ebb03b

Please sign in to comment.