============================= test session starts ==============================
platform linux -- Python 3.7.7, pytest-5.4.3, py-1.8.2, pluggy-0.13.1
rootdir: /home/aryaman4/probflow, inifile: pytest.ini
collected 180 items

tests/examples/test_example_correlation.py .                             [  0%]
tests/examples/test_example_fully_connected.py FFFF                      [  2%]
tests/examples/test_example_gan.py .                                     [  3%]
tests/examples/test_example_gmm.py .                                     [  3%]
tests/examples/test_example_heteroscedastic.py .                         [  4%]
tests/examples/test_example_linear_regression.py FF                      [  5%]
tests/examples/test_example_ppca.py .                                    [  6%]
tests/stats/test_LinearRegression.py .                                   [  6%]
tests/stats/test_LogisticRegression.py F                                 [  7%]
tests/stats/test_distribution_fits.py .......                            [ 11%]
tests/unit/pytorch/test_applications_pytorch.py ..........               [ 16%]
tests/unit/pytorch/test_core_ops_pytorch.py ......................       [ 28%]
tests/unit/pytorch/test_distributions_pytorch.py .............           [ 36%]
tests/unit/pytorch/test_models_pytorch.py ........                       [ 40%]
tests/unit/pytorch/test_settings_pytorch.py .                            [ 41%]
tests/unit/pytorch/test_utils_initializers_pytorch.py ...                [ 42%]
tests/unit/tensorflow/test_applications_tensorflow.py ..........         [ 48%]
tests/unit/tensorflow/test_callbacks.py .                                [ 48%]
tests/unit/tensorflow/test_core_ops_tensorflow.py ..................     [ 58%]
tests/unit/tensorflow/test_core_settings.py .....                        [ 61%]
tests/unit/tensorflow/test_data.py ..                                    [ 62%]
tests/unit/tensorflow/test_distributions_tensorflow.py ..............    [ 70%]
tests/unit/tensorflow/test_models_tensorflow.py ........                 [ 75%]
tests/unit/tensorflow/test_modules_tensorflow.py .....                   [ 77%]
tests/unit/tensorflow/test_parameters_tensorflow.py .............        [ 85%]
tests/unit/tensorflow/test_utils_initializers_tensorflow.py ...          [ 86%]
tests/unit/tensorflow/test_utils_metrics_tensorflow.py ............      [ 93%]
tests/unit/tensorflow/test_utils_plotting.py ............                [100%]

=================================== FAILURES ===================================
____________________ test_example_fully_connected_manually _____________________

    def test_example_fully_connected_manually():
        """Tests example_fully_connected#manually"""
    
        # TODO: generate data
    
        class DenseLayer(pf.Module):
    
            def __init__(self, d_in, d_out):
                self.w = pf.Parameter([d_in, d_out])
                self.b = pf.Parameter([d_out, 1])
    
            def __call__(self, x):
                return x @ self.w() + self.b()
    
    
        class DenseNetwork(pf.Module):
    
            def __init__(self, dims):
                Nl = len(dims)-1
                self.layers = [DenseLayer(dims[i], dims[i+1]) for i in range(Nl)]
                self.activations = [tf.nn.relu for i in range(Nl)]
                self.activations[-1] = lambda x: x
    
    
            def __call__(self, x):
                for i in range(len(self.layers)):
                    x = self.layers[i](x)
                    x = self.activations[i](x)
                return x
    
    
        class DenseRegression(pf.Model):
    
            def __init__(self, dims):
                self.net = DenseNetwork(dims)
                self.s = pf.ScaleParameter()
    
            def __call__(self, x):
                return pf.Normal(self.net(x), self.s())
    
    
        # Create and fit the model
        model = DenseRegression([5, 128, 64, 1])
>       model.fit(x, y)
E       NameError: name 'x' is not defined

tests/examples/test_example_fully_connected.py:55: NameError
_____________________ test_example_fully_connected_modules _____________________

    def test_example_fully_connected_modules():
        """Tests example_fully_connected using Modules"""
    
        # TODO: generate data
    
        class DenseRegression(pf.Model):
    
            def __init__(self):
                self.net = pf.Sequential([
                    pf.Dense(5, 128),
                    tf.nn.relu,
                    pf.Dense(128, 64),
                    tf.nn.relu,
                    pf.Dense(64, 1),
                ])
                self.s = pf.ScaleParameter()
    
            def __call__(self, x):
                return pf.Normal(self.net(x), self.s())
    
        # Create and fit the model
>       model = DenseRegression([5, 128, 64, 1])
E       TypeError: __init__() takes 1 positional argument but 2 were given

tests/examples/test_example_fully_connected.py:80: TypeError
_________________ test_example_fully_connected_DenseRegression _________________

    def test_example_fully_connected_DenseRegression():
        """Tests example_fully_connected using DenseRegression"""
    
        # TODO: generate data
    
        # Create and fit the model
        model = pf.DenseRegression([5, 128, 64, 1])
>       model.fit(x, y)
E       NameError: name 'x' is not defined

tests/examples/test_example_fully_connected.py:92: NameError
_________________ test_example_fully_connected_DenseClassifier _________________

    def test_example_fully_connected_DenseClassifier():
        """Tests example_fully_connected using DenseClassifier"""
    
        # TODO: generate data
    
        # Create and fit the model
>       model = pf.DenseClassifier([5, 128, 64, 1])

tests/examples/test_example_fully_connected.py:102: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/probflow/applications.py:278: in __init__
    self.network = DenseNetwork(d, **kwargs)
src/probflow/applications.py:190: in __init__
    for i in range(len(d)-1)]
src/probflow/applications.py:190: in <listcomp>
    for i in range(len(d)-1)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <probflow.modules.Dense object at 0x7fbdb0768290>, d_in = 64, d_out = 0
name = 'Dense2'

    def __init__(self, d_in: int, d_out: int = 1, name: str = 'Dense'):
    
        # Check types
        if d_in < 1:
            raise ValueError('d_in must be >0')
        if d_out < 1:
>           raise ValueError('d_out must be >0')
E           ValueError: d_out must be >0

src/probflow/modules.py:158: ValueError
____________________ test_example_linear_regression_simple _____________________

    def test_example_linear_regression_simple():
        """Tests example_linear_regression simple linear regression"""
    
        # TODO: generate data
    
        class SimpleLinearRegression(pf.Model):
    
            def __init__(self):
                self.w = pf.Parameter()
                self.b = pf.Parameter()
                self.s = pf.ScaleParameter()
    
            def __call__(self, x):
                return pf.Normal(x*self.w()+self.b(), self.s())
    
        # Create and fit the model
        model = SimpleLinearRegression()
>       model.fit(x, y)
E       NameError: name 'x' is not defined

tests/examples/test_example_linear_regression.py:29: NameError
___________________ test_example_linear_regression_multiple ____________________

    def test_example_linear_regression_multiple():
        """Tests example_linear_regression multiple linear regression"""
    
        # TODO: generate data
    
        # Create and fit the model
>       model = pf.LinearRegression()
E       TypeError: __init__() missing 1 required positional argument: 'd'

tests/examples/test_example_linear_regression.py:63: TypeError
___________________________ test_logistic_regression ___________________________

    def test_logistic_regression():
        """Test that a logistic regression recovers the true parameters"""
    
        # Set random seed
        #np.random.seed(1234)
        #tf.random.set_seed(1234)
    
        # Generate data
        N = 1000
        D = 1
        x = np.random.randn(N, D).astype('float32')
        x_val = np.random.randn(N, D).astype('float32')
        w = np.random.randn(D, 1)
        b = np.random.randn()
        noise = 0.1*np.random.randn(N, 1)
        y = (1.0/(1.0+np.exp(-x@w + b + noise)) > 0.5).astype('float32')
        y_val = (1.0/(1.0+np.exp(-x@w + b + noise)) > 0.5).astype('float32')
    
        # Create and fit model
        model = pf.LogisticRegression(D)
        model.fit(x, y, batch_size=100, epochs=1000, lr=1e-3)
    
        # Compute and check confidence intervals on the weights
        lb, ub = model.posterior_ci('weights')
        assert np.all(lb < w)
        assert np.all(ub > w)
    
        # Compute and check confidence intervals on the bias
        lb, ub = model.posterior_ci('bias')
        assert lb < b
>       assert ub > b
E       assert array([[-3.85657263]]) > 1.2553320122920233

tests/stats/test_LogisticRegression.py:41: AssertionError
============================ slowest test durations ============================
599.11s call     tests/stats/test_distribution_fits.py::test_fit_poisson
139.21s call     tests/stats/test_LinearRegression.py::test_linear_regression
108.04s call     tests/stats/test_distribution_fits.py::test_fit_studentt
103.62s call     tests/stats/test_distribution_fits.py::test_fit_normal
101.71s call     tests/stats/test_distribution_fits.py::test_fit_cauchy
92.81s call     tests/stats/test_LogisticRegression.py::test_logistic_regression
92.52s call     tests/stats/test_distribution_fits.py::test_fit_gamma
68.64s call     tests/stats/test_distribution_fits.py::test_fit_categorical
59.57s call     tests/stats/test_distribution_fits.py::test_fit_bernoulli
22.44s call     tests/unit/tensorflow/test_callbacks.py::test_Callback[False]
11.51s call     tests/examples/test_example_ppca.py::test_gmm
9.84s call     tests/examples/test_example_gmm.py::test_gmm
9.56s call     tests/examples/test_example_correlation.py::test_correlation[False]
4.68s call     tests/unit/tensorflow/test_data.py::test_DataGenerator_workers
3.29s call     tests/unit/tensorflow/test_models_tensorflow.py::test_ContinuousModel[False]
2.21s call     tests/unit/tensorflow/test_models_tensorflow.py::test_DiscreteModel[False]
2.03s call     tests/examples/test_example_heteroscedastic.py::test_correlation[False]
1.83s call     tests/unit/tensorflow/test_models_tensorflow.py::test_CategoricalModel[False]
1.30s call     tests/examples/test_example_gan.py::test_gmm
1.21s call     tests/unit/tensorflow/test_utils_plotting.py::test_plot_by[False]
1.17s call     tests/unit/tensorflow/test_models_tensorflow.py::test_Model_ArrayDataGenerators
1.09s call     tests/unit/tensorflow/test_models_tensorflow.py::test_Model_0D
0.91s call     tests/unit/tensorflow/test_models_tensorflow.py::test_Model_nesting
0.87s call     tests/unit/tensorflow/test_models_tensorflow.py::test_Model_1D
0.81s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_DenseRegression
0.69s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_DenseRegression_heteroscedastic
0.67s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_DenseNetwork
0.66s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_MultinomialDenseClassifier
0.66s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_DenseClassifier
0.44s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_LinearRegression
0.41s call     tests/unit/tensorflow/test_models_tensorflow.py::test_generative_Model
0.31s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_LinearRegression_heteroscedastic
0.30s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_PoissonRegression
0.29s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_LogisticRegression
0.29s call     tests/unit/tensorflow/test_applications_tensorflow.py::test_MultinomialLogisticRegression
0.26s call     tests/unit/tensorflow/test_utils_plotting.py::test_prior_plot[False]
0.21s call     tests/unit/tensorflow/test_utils_plotting.py::test_posterior_plot[False]
0.16s call     tests/unit/pytorch/test_models_pytorch.py::test_Model_ArrayDataGenerators
0.15s call     tests/unit/pytorch/test_models_pytorch.py::test_Model_0D
0.14s call     tests/unit/pytorch/test_models_pytorch.py::test_Model_nesting
0.13s call     tests/unit/pytorch/test_models_pytorch.py::test_Model_1D
0.12s call     tests/unit/pytorch/test_applications_pytorch.py::test_DenseRegression
0.12s call     tests/unit/pytorch/test_applications_pytorch.py::test_DenseClassifier
0.12s call     tests/unit/pytorch/test_applications_pytorch.py::test_MultinomialDenseClassifier
0.12s call     tests/unit/pytorch/test_applications_pytorch.py::test_DenseRegression_heteroscedastic
0.12s call     tests/unit/tensorflow/test_utils_plotting.py::test_fill_between[False]
0.11s call     tests/unit/pytorch/test_applications_pytorch.py::test_DenseNetwork
0.07s call     tests/unit/pytorch/test_applications_pytorch.py::test_LogisticRegression
0.06s call     tests/unit/pytorch/test_applications_pytorch.py::test_LinearRegression
0.06s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_HiddenMarkovModel
0.06s call     tests/unit/pytorch/test_applications_pytorch.py::test_MultinomialLogisticRegression
0.06s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_MultivariateNormal
0.05s call     tests/unit/pytorch/test_applications_pytorch.py::test_LinearRegression_heteroscedastic
0.05s call     tests/unit/pytorch/test_models_pytorch.py::test_generative_Model
0.05s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_MultivariateNormalParameter
0.05s call     tests/unit/pytorch/test_applications_pytorch.py::test_PoissonRegression
0.05s call     tests/unit/tensorflow/test_utils_plotting.py::test_plot_dist[False]
0.03s call     tests/unit/tensorflow/test_utils_plotting.py::test_plot_categorical_dist[False]
0.03s call     tests/unit/tensorflow/test_modules_tensorflow.py::test_Sequential
0.03s call     tests/unit/tensorflow/test_modules_tensorflow.py::test_Module
0.02s call     tests/unit/tensorflow/test_utils_plotting.py::test_plot_discrete_dist[False]
0.02s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_Categorical
0.02s call     tests/unit/tensorflow/test_modules_tensorflow.py::test_BatchNormalization
0.02s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_Mixture
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_Parameter_posterior_ci
0.01s call     tests/unit/tensorflow/test_modules_tensorflow.py::test_Dense
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_ScaleParameter
0.01s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_OneHotCategorical
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_Parameter_scalar
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_Parameter_2D
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_Parameter_1D
0.01s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_Dirichlet
0.01s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_Deterministic
0.01s call     tests/unit/tensorflow/test_modules_tensorflow.py::test_Embedding
0.01s call     tests/examples/test_example_fully_connected.py::test_example_fully_connected_manually
0.01s call     tests/examples/test_example_fully_connected.py::test_example_fully_connected_DenseRegression
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_BoundedParameter
0.01s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_Gamma
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_PositiveParameter
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_DirichletParameter
0.01s call     tests/unit/tensorflow/test_utils_plotting.py::test_plot_line[False]
0.01s call     tests/unit/tensorflow/test_parameters_tensorflow.py::test_CategoricalParameter
0.01s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_Poisson
0.01s call     tests/unit/tensorflow/test_distributions_tensorflow.py::test_StudentT
0.01s call     tests/examples/test_example_fully_connected.py::test_example_fully_connected_DenseClassifier

(0.00 durations hidden.  Use -vv to show these durations.)
=========================== short test summary info ============================
FAILED tests/examples/test_example_fully_connected.py::test_example_fully_connected_manually
FAILED tests/examples/test_example_fully_connected.py::test_example_fully_connected_modules
FAILED tests/examples/test_example_fully_connected.py::test_example_fully_connected_DenseRegression
FAILED tests/examples/test_example_fully_connected.py::test_example_fully_connected_DenseClassifier
FAILED tests/examples/test_example_linear_regression.py::test_example_linear_regression_simple
FAILED tests/examples/test_example_linear_regression.py::test_example_linear_regression_multiple
FAILED tests/stats/test_LogisticRegression.py::test_logistic_regression - ass...
================== 7 failed, 173 passed in 1448.71s (0:24:08) ==================
