twodlearn.GMM module

class twodlearn.GMM.GmmLayer(n_dim, n_kernels=1, diagonal=True, method='tf', name='')[source]

Bases: object

Defines a GMM layer, which consists of a GmmParamsLayer and a GmmModelLayer GmmParamsLayer takes unconstrained parameters and transform them into a set of valid Gmm parameters

GmmModelLayer computes the value of the pdf for a given dataset based on the valid set of parameters

evaluate(y, unc_params)[source]

y: dataset unc_params: 2d matrix containing the set of unconstrained parameters

class twodlearn.GMM.GmmMlpModel(n_inputs, n_outputs, n_hidden, n_kernels, afunction=None, diagonal=True, method='tf', name='')[source]

Bases: object

Defines a GMM model for conditional pdf’s, with mu, sigma and w parameters defined by a MLP network

loss_eval(net_out)[source]
setup(batch_size, inputs=None)[source]
class twodlearn.GMM.GmmModel(n_dim, n_kernels=1, diagonal=True, method='tf', name='')[source]

Bases: object

Evaluates the gaussian mixture probability density function given the parameters of the model mu, sigma, and w. sigma must be positive definite (at the moment only diagonal) w must be proper, i.e. sum to one and its elements must be positive

evaluate(y, mu, sigma, w)[source]
class twodlearn.GMM.GmmNetConf(inputs, labels, out, loss, mu, sigma, w)[source]

Bases: object

This is a wrapper to any network configuration, it contains the references to the placeholders for inputs and labels, and the reference of the computation graph for the network

inputs: placeholder for the inputs labels: placeholder for the labels y: output of the comptuation graph (logits) loss: loss for the network

class twodlearn.GMM.GmmParamsLayer(n_dim, n_kernels=1, diagonal=True, name='')[source]

Bases: object

This layer transforms a vector into a valid set of parameters that can be fed to a GMM model.

evaluate(x)[source]
class twodlearn.GMM.GmmSBoundedLayer(n_dim, n_kernels=1, diagonal=True, method='tf', name='')[source]

Bases: object

Defines a GMM layer, which consists of a GmmParamsLayer and a GmmModelLayer GmmParamsLayer takes unconstrained parameters and transform them into a set of valid Gmm parameters

GmmModelLayer computes the value of the pdf for a given dataset based on the valid set of parameters

This layer also implements a gaussian kernel over the inputs, whose reciprocal is used to specify to the network to give us big standard deviations (big uncertainty) on regions of the space that has not been explored.

evaluate(y, unc_params, x)[source]

y: dataset unc_params: 2d matrix containing the set of unconstrained

parameters

class twodlearn.GMM.GmmSBoundedMlpModel(n_inputs, n_outputs, n_hidden, n_kernels, afunction=None, diagonal=True, name='')[source]

Bases: object

Defines a GMM model for conditional pdf’s, with mu, sigma and w parameters defined by a MLP network

The values of sigma are

loss_eval(net_out)[source]
setup(batch_size, inputs=None)[source]
class twodlearn.GMM.GmmShallowModel(n_dim, n_kernels=1, diagonal=True, method='tf', name='')[source]

Bases: object

Defines an standard GMM model, with constant mu, sigma and w parameters The GMM models a pdf of the form x ~ sum_i( w_i*N_i(x| mu_i, sigma_i) )

loss_eval(net_out)[source]
setup(batch_size, x=None)[source]