simnets.unsupervised package

simnets.unsupervised.similarity_unsupervised_init(kind, sim_op, templates_var, weights_var)[source]

Initialize a similarity layer using unsupervised learning

Initializes the templates and weights using k-means or gmm (in k-means case the weights are just ones). The function returns two ops. The first is used to initialize the learning and the second should be run iteratively

with all the data.
Parameters:
  • kind ({'kmeans', 'gmm'}) – type of unsupervised algorithm to use
  • sim_op (tf.Operation | tf.Tensor) – the similarity operation (or the tensor which is the output of the similarity)
  • templates_var (tf.Variable) – the templates variable for this similarity layer
  • weights_var (tf.Variable) – the weights variable for this similarity layer
Returns:

  • A tuple (init_op, update_op) where init_op must be executed by a session before using the update op
  • and the update_op is the operation that performs the learning.

Submodules

simnets.unsupervised.gmm module

simnets.unsupervised.gmm.gmm_unsupervised_init(sim_op, templates_var, weights_var)[source]

Initialize a similarity layer using gmm unsupervised learning

Initializes the templates and weights using gmm The function returns two ops. The first is used to initialize the learning and the second should be run iteratively

with all the data.
Parameters:
  • sim_op (tf.Operation | tf.Tensor) – the similarity operation (or the tensor which is the output of the similarity)
  • templates_var (tf.Variable) – the templates variable for this similarity layer
  • weights_var (tf.Variable) – the weights variable for this similarity layer
Returns:

  • A tuple (init_op, update_op) where init_op must be executed by a session before using the update op
  • and the update_op is the operation that performs the learning.

simnets.unsupervised.kmeans module

simnets.unsupervised.kmeans.kmeans_unsupervised_init(sim_op, templates_var, weights_var)[source]

Initialize a similarity layer using k-means unsupervised learning

Initializes the templates using k-means. The function returns two ops. The first is used to initialize the learning and the second should be run iteratively

with all the data.
Parameters:
  • sim_op (tf.Operation | tf.Tensor) – the similarity operation (or the tensor which is the output of the similarity)
  • templates_var (tf.Variable) – the templates variable for this similarity layer
  • weights_var (tf.Variable) – the weights variable for this similarity layer
Returns:

  • A tuple (init_op, update_op) where init_op must be executed by a session before using the update op
  • and the update_op is the operation that performs the learning.

simnets.unsupervised.pca module

simnets.unsupervised.pca.pca_unsupervised_init(conv_op)[source]

Initialize a convolutional layer using pca unsupervised learning

Initializes the filters as the first k eigen vectors of the data covariance. The function returns two ops. The first is used to initialize the learning and the second should be run iteratively

with all the data.
Parameters:
  • conv_op (tf.Operation | tf.Tensor) – the convolution operation (or the tensor which is the output of the convolution)
  • filters_var (tf.Variable) – the filters variable for this convolution layer
Returns:

  • A tuple (init_op, update_op) where init_op must be executed by a session before using the update op
  • and the update_op is the operation that performs the learning.