Documentation

beta_nmf_class.py

Contents

The beta_nmf_class module includes the ClassBetaNMF class, fit function and theano functions to compute updates and cost. The ClassBetaNMF class is used to perform group NMF with class and session similarity constraints [1] .

[1]R. Serizel, S. Essid, and G. Richard. “Group nonnegative matrix factorisation with speaker and session variability compensation for speaker identification”. In Proc. of 2016 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5470-5474, 2016.
class beta_nmf_class.ClassBetaNMF(data=array([[0, 0]]), cls_label=array([0]), ses_label=array([0]), buff_size=20000, n_components=(20, 4, 4), beta=1.0, NMF_updates='beta', n_iter=10, lambdas=[0, 0, 0], normalize=False, fixed_factors=None, verbose=0, dist_mode='segment', Wn=None)[source]

BetaNMF class

Performs group nonnegative matrix factorization with session and class similarity constraints. GPGPU implemenation based on Theano.

Parameters:

data : array

data to decompose

cls_label : array

the class labels for the data

ses_label : array

the session labels for the data

buff_size : intger

size of the buffers, adjust depending on the GPGPU memory

n_components : tuple composed of integers

the number of latent components for the NMF model (k_cls, k_ses, k_res)

beta : Float

the beta-divergence to consider Particular cases of interest are:

  • beta=2 : Euclidean distance
  • beta=1 : Kullback Leibler
  • beta=0 : Itakura-Saito

NMF_updates : String

multiplicatives rule to update NMF (default beta-NMF):

  • ‘beta’ : standard beta-NMF
  • ‘groupNMF’ : group NMF with class and session

similarity constraints

  • ‘noiseNMF’ : group NMF with a noise reference

n_iter : Positive integer

number of iterations

lambdas : Array

weighting factors for the constraint (default value [0, 0, 0])

  • lambda1 : constraint on class similarity
  • lambda2 : constraint on session similarity
  • lambda3 : constraint on class discrimination (not available yet)

normalize : Boolean

normalize the column of W (default False)

fixed_factors : array (default Null)

list of factors that are not updated

e.g. fixed_factors = [0] -> H is not updated

fixed_factors = [1] -> W is not updated

verbose : Integer

the frequence at which the score should be computed and displayed (number of iterations between each computation)

dist_mode : String (‘segment’ or ‘iter’)

  • ‘segment’ the constraint distance is computed locally for each new segment
  • ‘iter’ the constraint distances are computed once at the beginning of the iteration

Wn : Array

Basis for the noise reference.

Attributes

data_shape (shape of the data to approximate) tuple of intergers
iters (fixed iterators on class and sessions)
factors (list of arrays (theano shared variables)) The estimated factors
cst_dist (list of arrays (theano shared variable)) Contains the class distances and the session distances
X_buff (buffer for the data (theano shared variable))
trainW and trainH (update function for the factors W and H) (theano functions)

Methods

average_and_select(comp) Select basis related to class, sesssions and residual.
check_segments_length(data, cls_label, ses_label) Check that each segment corresponding to a unique (class, session) couple can fit in the buffer.
compute_Cs_Sc(cls_train, ses_train) Find the sessions and classes ensembles.
compute_sum_indices(ind, lbl) Compute various index and card related to specific Sc and Cs.
fit(X, cls_label, ses_label) Learns the group-NMF model
generate_buffer_from_lbl(X, cls_label, ses_label) Generate indexes to fill buffer depending and class and session labels.
get_div_function() Compile the theano-based divergence functions
get_norm_function() Compile the theano-based normalise function
get_sum_function() Compile the theano-based functions to sum over class basis
get_updates_functions() Compile the theano based update functions
normalize_W_H() Normalise the colmuns of W and scale the columns of H accordingly
save(factor_list[, fname]) Save selected factors in an h5fs file
score(ind, lbl) Compute factorisation score for the current segment
score_buffer(data, buff_ind) Compute factorisation score for the whole data.
select(comp) Select basis related to class, sesssions and residual.
transform(X[, comp, n_iter, buff_size, ...]) Project a data matrix an the new subspace defined by the concatenated dictionary.
update(ind, lbl) Update factorisation for the current segment
update_buffer(data, buff_ind, it) Update factorisation for the whole data.
update_iters(data, cls_label, ses_label) Update iterators related to classes and sessions
average_and_select(comp)[source]

Select basis related to class, sesssions and residual. Average the basis over sessions for each class

Parameters:

comp : Array

The basis to select
  • 0 : class related basis
  • 1 : session related basis
  • 2 : residual basis
Returns:

W_avg : Array

Selected basis averaged across session for each class

check_segments_length(data, cls_label, ses_label)[source]

Check that each segment corresponding to a unique (class, session) couple can fit in the buffer. Otherwise, display a warning and truncate to buffer size.

Parameters:

data : Array

data to decompose

cls_label : array

the class labels for the data

ses_label : array

the session labels for the data

Returns:

cls_ses : Array

indices for unique (class, session) couples

cls_ses_bnd : Array

new start and stop indices relative to each (class, session)

compute_Cs_Sc(cls_train, ses_train)[source]

Find the sessions and classes ensembles. Locate the sessions in which a particular class is active and the classes that are present in a particular session.

Parameters:

cls_label : array

the class labels for the data

ses_label : array

the session labels for the data

Returns:

Cs : Array

classes that are present in session s (for each sessions)

Sc : Array

session in which the class c is active (for each class)

compute_sum_indices(ind, lbl)[source]

Compute various index and card related to specific Sc and Cs. All the operation below are done for a particular (c, s) couple

Parameters:

ind : Integer

(class, session) index

lbl : Array

[ses, cls, rstrt, rstp, astrt, astp]
ses:session label
cls:class label
rstrt:relative index for block start

(only if the segment relative to (c, s) does not fit in the buffer, 0 otherwise)

rstp:relative index for block end

(only if the segment relative to (c, s) does not fit in the buffer, segment length otherwise)

astrt:absolute start index for (c, s) within the whole data
astp:absolute stop index for (c, s) within the whole data
Returns:

indices : array

[ind, rstrt, rstp, astrt, astp, ses, cls]

Csi : array of int

classes that are present in sessions s, remove current class c ([-1] if empty)

Sci : array of int

sessions in which class c is active, remove current session s ([-1] if empty)

card : array

number of element in Csi and Sci [card(Csi), card(Sci), card(tot)]

fit(X, cls_label, ses_label)[source]

Learns the group-NMF model

Parameters:

X : ndarray with nonnegative entries

The input array

cls_label : array

the class labels for the data

ses_label : array

the session labels for the data

generate_buffer_from_lbl(X, cls_label, ses_label, random=False, truncate=False)[source]

Generate indexes to fill buffer depending and class and session labels.

Parameters:

X : ndarray with nonnegative entries

The input array

cls_label : array

the class labels for the data

ses_label : array

the session labels for the data

random : Boolean

randomly pick the segment to fill the buffer (default False)

truncate : Boolean

truncate the segments that do fit in the buffer, split the segment otherwise (default False)

get_div_function()[source]

Compile the theano-based divergence functions

get_norm_function()[source]

Compile the theano-based normalise function

get_sum_function()[source]

Compile the theano-based functions to sum over class basis and sessions bases

get_updates_functions()[source]

Compile the theano based update functions

normalize_W_H()[source]

Normalise the colmuns of W and scale the columns of H accordingly

save(factor_list, fname='factors.h5')[source]

Save selected factors in an h5fs file

The following data is saved:
‘H’:H (if in the factor list)
‘W’:W (if in the factor list)
‘scores’:divergence, inter-class and inter-session scores.
‘n_components’:number of components in the decomposition
‘beta’:beta-parameter for the divergence
‘iters/cls’:class and session labels
‘iters/clsind’:class and session indices
Parameters:

factor_list : array

list of factors that are not updated * factor_list = [0] -> H is saved

  • factor_list = [1] -> W is saved
  • factor_list = [0, 1] -> H and W are saved

fname : String

name of the file where the data is saved (default ‘facotrs.h5’)

score(ind, lbl)[source]

Compute factorisation score for the current segment

Parameters:

ind : Integer

(class, session) index

lbl : Array

[ses, cls, rstrt, rstp, astrt, astp]
ses:session label
cls:class label
rstrt:relative index for block start

(only if the segment relative to (c, s) does not fit in the buffer, 0 otherwise)

rstp:relative index for block end

(only if the segment relative to (c, s) does not fit in the buffer, segment length otherwise)

astrt:absolute start index for (c, s) within the whole data
astp:absolute stop index for (c, s) within the whole data
Returns:

out : Float

factorisation score for the current segment

score_buffer(data, buff_ind)[source]

Compute factorisation score for the whole data. The data is split to fit the buffer size if need

Parameters:

data : Array

data to decompose

buff_ind : Array

for each segment i buff_ind[i] = [ses, cls, rstrt, rstp, astrt, astp]

ses:session label
cls:class label
rstrt:relative index for block start

(only if the segment relative to (c, s) does not fit in the buffer, 0 otherwise)

rstp:relative index for block end

(only if the segment relative to (c, s) does not fit in the buffer, segment length otherwise)

astrt:absolute start index for (c, s) within the whole data
astp:absolute stop index for (c, s) within the whole data
Returns:

score : Float

factorisation score for the whole data

select(comp)[source]

Select basis related to class, sesssions and residual.

Parameters:

comp : Array

The basis to select
  • 0 : class related basis
  • 1 : session related basis
  • 2 : residual basis
  • any combination of the above
Returns:

W_reshape : Array

Selected basis

transform(X, comp=[0, 1], n_iter=None, buff_size=None, fname='projection.h5', dataset='', average_comp=False, average_act=False, seg_length=625, l_sparse=0, sparse_idx=None)[source]

Project a data matrix an the new subspace defined by the concatenated dictionary. Projection with standard NMF and fixed dictionary, possibility to impose sparsity or group sparsity constraint.

Parameters:

X : Array with positive integers

data to project

comp : array

The basis to select
  • 0 : class related basis
  • 1 : session related basis
  • 2 : residual basis
  • any combination of the above

n_iter : integer (default = self.n_iter)

number of iterations

buff_size : integer (default = self.buff_size)

buffer size

fname : String (default=’projection.h5’)

name of the save whhere the projections are saved

dataset : String (default = ‘’)

name of the dataset to which the data belongs, e.g., ‘train’, ‘dev’

average_comp : Boolean (default = False)

average speaker basis across sessions

average_act : Boolean (default = False)

average activation time-wise over segments

seg_length : Integer

length of the segments used for activation averaging

l_sparse : Float (default 0.)

sparsity constraint

sparse_idx : Array

boundaries of the groups for group sparisty [start, stop]

update(ind, lbl)[source]

Update factorisation for the current segment

Parameters:

ind : Integer

(class, session) index

lbl : Array

[ses, cls, rstrt, rstp, astrt, astp]
ses:session label
cls:class label
rstrt:relative index for block start

(only if the segment relative to (c, s) does not fit in the buffer, 0 otherwise)

rstp:relative index for block end

(only if the segment relative to (c, s) does not fit in the buffer, segment length otherwise)

astrt:absolute start index for (c, s) within the whole data
astp:absolute stop index for (c, s) within the whole data
update_buffer(data, buff_ind, it)[source]

Update factorisation for the whole data. The data is split to fit the buffer size if need

Parameters:

data : Array

data to decompose

buff_ind : Array

for each segment i buff_ind[i] = [ses, cls, rstrt, rstp, astrt, astp]

ses:session label
cls:class label
rstrt:relative index for block start

(only if the segment relative to (c, s) does not fit in the buffer, 0 otherwise)

rstp:relative index for block end

(only if the segment relative to (c, s) does not fit in the buffer, segment length otherwise)

astrt:absolute start index for (c, s) within the whole data
astp:absolute stop index for (c, s) within the whole data

it : Integer

iteration number

update_iters(data, cls_label, ses_label)[source]

Update iterators related to classes and sessions

Parameters:

X : ndarray with nonnegative entries

The input array

cls_label : array

the class labels for the data

ses_label : array

the session labels for the data

beta_nmf_class.load(fname='factors.h5', updates='beta')[source]

Load a previous model.

Create a new ClassBetaNMF object with the parameters loaded from an h5fs file.

Parameters:

fname : String (default = “factors.h5”)

name of the file where the parameters are stored

updates : String (default = “beta”)

multiplicatives rule to update NMF:

  • ‘beta’ : standard beta-NMF
  • ‘groupNMF’ : group NMF with class and session

similarity constraints

  • ‘noiseNMF’ : group NMF with a noise reference
Returns:

nmf : ClasBetaNMF

NMF model constructed from the parameter loaded from file.

beta_nmf.py

Contents

The beta_nmf module includes the beta_nmf class, fit function and theano functions to compute updates and cost.

class beta_nmf.BetaNMF(data_shape, n_components=50, beta=2, n_iter=100, fixed_factors=None, verbose=0, l_sparse=0.0, sparse_idx=None)[source]

BetaNMF class

Performs nonnegative matrix factorization with Theano. L1-sparsity and group sparsity constraints can be applied on activations.

Parameters:

data_shape : tuple composed of integers

the shape of the data to approximate

n_components : positive integer (default 50)

the number of latent components for the NMF model

beta : arbitrary float (default 2)

the beta-divergence to consider, particular cases of interest are
  • beta=2 : Euclidean distance
  • beta=1 : Kullback Leibler
  • beta=0 : Itakura-Saito

n_iter : Positive integer (default 100)

number of iterations

fixed_factors : array (default Null)

list of factors that are not updated

e.g. fixed_factors = [0] -> H is not updated

fixed_factors = [1] -> W is not updated

l_sparse : Float (default 0.)

sparsity constraint

sparse_idx : Array

boundaries of the groups for group sparisty [start, stop]

verbose : Integer

the frequence at which the score should be computed and displayed (number of iterations between each computation)

Attributes

factors (list of arrays) The estimated factors (factors[0] = H)

Methods

fit(data) Learns NMF model
get_div_function() Compile the theano-based divergence function
get_updates_functions() Compile the theano based update functions
score() Compute factorisation score
fit(data)[source]

Learns NMF model

Parameters:

X : ndarray with nonnegative entries

The input array

get_div_function()[source]

Compile the theano-based divergence function

get_updates_functions()[source]

Compile the theano based update functions

score()[source]

Compute factorisation score

Returns:

out : Float

factorisation score

base.py

Contents

The base module includes the basic functions such as to load data, annotations, to normalize matrices and generate nonnegative random matrices

base.get_norm_col(w)[source]

returns the norm of a column vector

Parameters:

w: 1-dimensionnal array

vector to be normalised

Returns:

norm: scalar

norm-2 of w

base.load_all_data(f_name, scale=True, rnd=False)[source]

Get data from from all sets stored H5FS file.

Parameters:

f_name : String

file name

scale : Boolean (default True)

scale data to unit variance (scikit-learn function)

rnd : Boolean (default True)

randomize the data along time axis

Returns:

data_dic : Dictionnary

dictionary containing the data

x_train:

numpy array

train data matrix

x_test:

numpy array

test data matrix

x_dev:

numpy array

dev data matrix

base.load_all_data_labels(f_name, scale=True, rnd=False)[source]

Get data with labels, for all sets.

Parameters:

f_name : String

file name

scale : Boolean (default True)

scale data to unit variance (scikit-learn function)

rnd : Boolean (default True)

randomize the data along time axis

Returns:

data_dic : Dictionnary

dictionary containing the data

x_train:

numpy array

train data matrix

x_test:

numpy array

test data matrix

x_dev:

numpy array

dev data matrix

y_train:

numpy array

train labels vector

y_test:

numpy array

test labels vector

y_dev:

numpy array

dev labels vector

base.load_all_data_labels_fids(f_name, scale=True, rnd=False)[source]

Get data with labels and file ids for all sets.

Parameters:

f_name : String

file name

scale : Boolean (default True)

scale data to unit variance (scikit-learn function)

rnd : Boolean (default True)

randomize the data along time axis

Returns:

data_dic : Dictionnary

dictionary containing the data

x_train:

numpy array

train data matrix

x_test:

numpy array

test data matrix

x_dev:

numpy array

dev data matrix

y_train:

numpy array

train labels vector

y_test:

numpy array

test labels vector

y_dev:

numpy array

dev labels vector

f_train:

numpy array

train file ids vector

f_test:

numpy array

test file ids vector

f_dev:

numpy array

dev file ids vector

base.load_all_fids(f_name)[source]

Get file ids for all sets.

Parameters:

f_name : String

file name

Returns:

fids_dic : Dictionnary

dictionary containing the data

f_train:

numpy array

train file ids vector

f_test:

numpy array

test file ids vector

f_dev:

numpy array

dev file ids vector

base.load_all_labels(f_name)[source]

Get labels for all sets.

Parameters:

f_name : String

file name

Returns:

lbl_dic : Dictionnary

dictionary containing the data

y_train:

numpy array

train labels vector

y_test:

numpy array

test labels vector

y_dev:

numpy array

dev labels vector

base.load_data(f_name, dataset, scale=True, rnd=False)[source]

Get data from from a specific set stored H5FS file.

Parameters:

f_name : String

file name

dataset : String

name of the set to load (e.g., train, dev, test)

scale : Boolean (default True)

scale data to unit variance (scikit-learn function)

rnd : Boolean (default True)

randomize the data along time axis

Returns:

data_dic : Dictionnary

dictionary containing the data

data:

numpy array

data matrix

base.load_data_labels(f_name, dataset, scale=True, rnd=False)[source]

Get data with labels, for a particular set.

Parameters:

f_name : String

file name

dataset : String

name of the set to load (e.g., train, dev, test)

scale : Boolean (default True)

scale data to unit variance (scikit-learn function)

rnd : Boolean (default True)

randomize the data along time axis

Returns:

data_dic : Dictionnary

dictionary containing the data

x:

numpy array

data matrix

y:

numpy array

labels vector

base.load_data_labels_fids(f_name, dataset, scale=True, rnd=False)[source]

Get data with labels and file ids for a specific set.

Parameters:

f_name : String

file name

dataset : String

name of the set to load (e.g., train, dev, test)

scale : Boolean (default True)

scale data to unit variance (scikit-learn function)

rnd : Boolean (default True)

randomize the data along time axis

Returns:

data_dic : Dictionnary

dictionary containing the data

x:

numpy array

data matrix

y:

numpy array

labels vector

f:

numpy array

file ids vector

base.load_fids(f_name, dataset)[source]

Get file ids for a specific set.

Parameters:

f_name : String

file name

dataset : String

name of the set to load (e.g., train, dev, test)

Returns:

fids_dic : Dictionnary

dictionary containing the files ids

file_ids:

numpy array

file ids vector

base.load_labels(f_name, dataset)[source]

Get labels for a specific set.

Parameters:

f_name : String

file name

dataset : String

name of the set to load (e.g., train, dev, test)

Returns:

lbl_dic : Dictionnary

dictionary containing the labels

labels:

numpy array

labels vector

base.nnrandn(shape)[source]

generates randomly a nonnegative ndarray of given shape

Parameters:

shape : tuple

The shape

Returns:

out : array of given shape

The non-negative random numbers

base.norm_col(w, h)[source]

normalize the column vector w (Theano function). Apply the invert normalization on h such that w.h does not change

Parameters:

w: Theano vector

vector to be normalised

h: Ttheano vector

vector to be normalised by the invert normalistation

Returns:

w : Theano vector with the same shape as w

normalised vector (w/norm)

h : Theano vector with the same shape as h

h*norm

base.reorder_cls_ses(data, cls, ses, with_index=False)[source]

reorder the data such that there is only one continuous bloc for each pair class/session

Parameters:

data : array

the data

cls : array

the class labels for the data

ses : array

the session label for the data

with_index : Boolean (default False)

if True, the function returns the reordered indexes together with data and labels

Returns:

data : array with the same shape as data

reordered data

cls : array with the same shape as cls

reordered class labels

ses : array with the same shape as ses

reordered session labels

ind : array with the same shape as data.shape[1]

reordered indexes (only if with_index==True)

base.truncate(data, cls_label, ses_label, ind)[source]

Truncate data and labels to the legnth specified in ind

Parameters:

data : array

cls_label : array

the class labels for the data

ses_label : array

the session label for the data

ind: array

start and stop indices for the truncation

Returns:

data_trunc : array, same shape as (ind[1]-ind[0], data.shape.[1])

truncateded data

cls_ordered : array, same shape as (ind[1]-ind[0], cls_label.shape.[1])

truncated class labels

ses_ordered : array, same shape as (ind[1]-ind[0], ses_label.shape.[1])

truncated session labels

ind : array

truncation indices

cost.py

Contents

The cost module regroups the cost functions used for the group NMF

costs.beta_div(X, W, H, beta)[source]

Compute beta divergence D(X|WH)

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

Returns:

div : Theano scalar

beta divergence D(X|WH)

costs.cls_sum(W, params)[source]

Compute summ of basis for a particular class. To be used in the constrained multiplicative update rules [1].

Parameters:

W : Theano tensor

Bases

params : Theano tensor

Matrix of parameter related to class/session.
params[0][0]:number of vector basis related to class
params[1]:sessions in which class c appears
Returns:

sum_cls : Theano scalar

sum of the basis for the class

costs.eucl_dist(X, Y)[source]

Compute Euclidean distance between X and Y

Parameters:

X : Theano tensor

Y : Theano tensor

Returns:

out : Theano scalar

Euclidean distance

costs.group_div(X, W, H, beta, params)[source]

Compute beta divergence D(X|WH), intra-class distance and intra-session distance for a particular (class, session) couple [1].

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

params : Theano tensor

Matrix of parameter related to class/session.
params[0][0]:index for the (class, session) couple
params[1][0]:number of vector basis related to class
params[1][1]:number of vector basis related to session
params[2]:weight on the class/session similarity constraints
params[3]:sessions in which class c appears
params[4]:classes present in session s
Returns:

cost : Theano scalar

total cost

div : Theano scalar

beta divergence D(X|WH)

sum_cls : Theano scalar

intra-class distance

sum_ses : Theano scalar

intra-session distance

costs.noise_div(X, W, Wn, H, beta, params)[source]

Compute beta divergence D(X|WH) noise-related distance (distance to a noise reference) and intra-speaker distance for a particular class (only one noise session considered here).

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

params : Theano tensor

Matrix of parameter related to class/session.
params[0][0]:index for the (class, session) couple
params[1][0]:number of vector basis related to class
params[1][1]:number of vector basis related to session
params[2]:weight on the class/session similarity constraints
params[3]:sessions in which class c appears
Returns:

cost : Theano scalar

total cost

div : Theano scalar

beta divergence D(X|WH)

sum_cls : Theano scalar

intra-class distance

sum_ses : Theano scalar

distance to noise reference

costs.ses_sum(W, params)[source]

Compute sum of basis for a particular session. To be used in the constrained multiplicative update rules [1].

Parameters:

W : Theano tensor

Bases

params : Theano tensor

Matrix of parameter related to class/session.
params[0][0]:number of vector basis related to class
params[1]:class that appear in session s
Returns:

sum_ses : Theano scalar

sum of the basis for the session

updates.py

Contents

The update module regroupse the update functions used for the group NMF

updates.H_beta_sub(X, W, Wsub, H, Hsub, beta)[source]

Update group activation with beta divergence

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

Wsub : Theano tensor

group Bases

H : Theano tensor

activation matrix

Hsub : Theano tensor

group activation matrix

beta : Theano scalar

Returns:

H : Theano tensor

Updated version of the activations

updates.W_beta_sub(X, W, Wsub, H, Hsub, beta)[source]

Update group activation with beta divergence

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

Wsub : Theano tensor

group Bases

H : Theano tensor

activation matrix

Hsub : Theano tensor

group activation matrix

beta : Theano scalar

Returns:

H : Theano tensor

Updated version of the activations

updates.W_beta_sub_withcst(X, W, Wsub, H, Hsub, beta, sum_grp, lambda_grp, card_grp)[source]

Update group activation with beta divergence and similarity constraints [1].

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

Wsub : Theano tensor

group Bases

H : Theano tensor

activation matrix

Hsub : Theano tensor

group activation matrix

beta : Theano scalar

Returns:

H : Theano tensor

Updated version of the activations

updates.beta_H(X, W, H, beta)[source]

Update activation with beta divergence

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

Returns:

H : Theano tensor

Updated version of the activations

updates.beta_H_Sparse(X, W, H, beta, l_sp)[source]

Update activation with beta divergence

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

l_sp : Theano scalar

sparsity constraint

Returns:

H : Theano tensor

Updated version of the activations

updates.beta_H_groupSparse(X, W, H, beta, l_sp, start, stop)[source]

Update activation with beta divergence

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

l_sp : Theano scalar

group sparsity constraint

start : Theano vector

beginning indexes for the sparsity groups

stop : Theano vector

stop indexes for the sparsity groups

Returns:

H : Theano tensor

Updated version of the activations

updates.beta_W(X, W, H, beta)[source]

Update bases with beta divergence

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

Returns:

W : Theano tensor

Updated version of the bases

updates.group_H(X, W, H, beta, params)[source]

Group udpate for the activation with beta divergence.

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

params : Array

params[1][0]:k_cls number of vectors in the spk bases
params[1][1]:k_ses number of vectors in the session bases
params[0][3]:begining of the group (couple (spk, ses)) in the activation matrix
params[0][4]:end of the group (couple (spk, ses)) in the activation matrix
Returns:

W : Theano tensor

Updated version of the bases

updates.group_W(X, W, H, beta, params)[source]

Group udpate for the bases with beta divergence and similarity constraints [1].

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

params : array

params[0][0]:indice of the group to update (corresponding to a unique couple (spk,ses))
params[1][0]:k_cls number of vectors in the spk bases
params[2]:[lambda1, lambda2] wieght applied on the constraints
params[3]:Sc, ensemble of session in which speaker c is present
params[4]:Cs, ensemble of speakers active in session s
params[1][1]:k_ses number of vectors in the session bases
params[5][0]:cardSc number of elements in Sc
params[5][1]:cardCs number of elements in Cs
Returns:

W : Theano tensor

Updated version of the bases

updates.group_W_nosum(X, W, H, sum_cls, sum_ses, beta, params)[source]

Group udpate for the bases with beta divergence The contribution for the class similiraity constraint and the session similarity constraint are computed externally. This could be used for example to distribute the porcessing. The constraint are computed centrally once per epoch and the rest of the processing can be distributed.

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

H : Theano tensor

activation matrix

beta : Theano scalar

sum_cls : Theano scalar

contribution from the class similarity constraint

sum_ses : Theano scalar

contribution from the session similarity constraint

params : array

params[0][0]:indice of the group to update (corresponding to a unique couple (spk,ses))
params[1][0]:k_cls number of vectors in the spk bases
params[1][1]:k_ses number of vectors in the session bases
params[2]:[lambda1, lambda2] wieght applied on the constraints
params[3]:Class distance
params[4]:session distance
params[5][0]:cardSc number of elements in Sc
params[5][1]:cardCs number of elements in Cs
Returns:

W : Theano tensor

Updated version of the bases

updates.noise_W(X, W, Wn, H, beta, params)[source]

Group udpate for the bases with beta divergence in the noise reference case. Only the one session case is considered here.

Parameters:

X : Theano tensor

data

W : Theano tensor

Bases

Wn : Theano tensor

noise bases

H : Theano tensor

activation matrix

beta : Theano scalar

params : array

:params[0][0]
: indice of the group to update

(corresponding to a unique couple (spk,ses))

params[1][0]:k_cls number of vectors in the spk bases
params[1][1]:k_ses number of vectors in the session bases
params[2]:[lambda1, lambda2] wieght applied on the constraints
params[3]:Sc, ensemble of session in which speaker c is present
params[5][0]:cardSc number of elements in Sc
Returns:

W : Theano tensor

Updated version of the bases