How can we build a mixture of mixtures?

Thanks a lot !! The problem is solved on the master…

But now (with the master) a problem occurs on the mixture of mixture…

import sys
import pymc3 as pm, theano.tensor as tt
import numpy as np

import matplotlib.pyplot as plt

# simulated data 
data = np.concatenate( (
    np.random.normal(loc=1,scale=1,size=1000),
    np.random.lognormal(mean=1,sigma=1,size=1000)) )


with pm.Model() as model:
    nbr = 5
    # mixtures components
    g_components = pm.Normal.dist(mu=pm.Exponential('mu_g', lam=1.0,shape=nbr)
    , sd=1,shape=nbr) #pm.HalfNormal('sd_g', sd=1.0,shape=nbr)
    l_components = pm.Lognormal.dist(mu=pm.Exponential('mu_l', lam=1.0,shape=nbr)
    , sd=1,shape=nbr) #pm.HalfNormal('sd_l', sd=1.0,shape=nbr)
    # weight vector for the mixtures
    g_w = pm.Dirichlet('g_w',a=np.array([0.0000001]*nbr))
    l_w = pm.Dirichlet('l_w',a=np.array([0.0000001]*nbr))
    mix_w = pm.Dirichlet('mix_w',a=np.array([1]*2))
    # mixtures
    g_mix = pm.Mixture.dist(w=g_w,comp_dists=g_components)
    l_mix = pm.Mixture.dist(w=l_w,comp_dists=l_components)
    # mixture of mixture
    mix = pm.Mixture('mix',w=mix_w,comp_dists=[g_mix,l_mix], observed=data)
    # MCMC
    trace = pm.sample(1000, tune=1000, live_plot=True)

    # graphes
    pm.traceplot(trace)
    plt.show()

It says (without any link to my code.) :

AttributeError: 'list' object has no attribute 'logp'

And another error :

ValueError: Input dimension mis-match. (input[0].shape[1] = 2, input[1].shape[1] = 5)

This error occurs on the mixture of mixture :

mix = pm.Mixture.dist('mix',w=mix_w,comp_dists=[g_mix,l_mix], observed=data)

None of these two errors occurs when using the pymc3.3 version.

How can I have a version that is both able to handle mixture of mixtures, and handle correctly when given an array to the logp function (The preivous question you solved)?