Added demo for Transformer NMF and documentation for NMF/Transformer NMF.
MODIFY
demos/demo_transformer_nmf.py
demos/demo_transformer_nmf.py
import time
import numpy as np
import nussl
-
import nimfa
def simple_example():
@@ -19,7 +18,7 @@ def simple_example():
# Set up NU NMF
n_bases = 2
n_iter = 100
- nussl_nmf = nussl.TransformerNMF(mixture, n_bases)
+ nussl_nmf = nussl.transformer_nmf(mixture, n_bases)
nussl_nmf.should_use_epsilon = False
nussl_nmf.max_num_iterations = n_iter
nussl_nmf.distance_measure = nussl.DistanceType.DIVERGENCE

MODIFY
nussl/Nmf.py
nussl/Nmf.py
@@ -80,8 +80,21 @@ class NMF(separation_base.SeparationBase):
No inputs. do_STFT and N must be set prior to calling this function.
- Returns an activation matrix (in a 2d numpy array)
- and a set of template vectors (also 2d numpy array).
+ Returns:
+ * **activation_matrix** (*np.array*) - a 2D numpy matrix containing the estimated activation matrix
+ * **templates** (*np.array*) - a 2D numpy matrix containing the estimated templates
+
+ Example:
+ ::
+ input_file_name = '../Input/mix1.wav'
+ signal = AudioSignal(path_to_input_file=input_file_name)
+
+ nussl_nmf = nussl.NMF(signal, num_templates=2,
+ activation_matrix=None, templates=None, distance_measure="euclidean",
+ should_update_template=None, should_update_activation=None)
+
+ nussl_nmf.run()
+ signals = nussl_nmf.recombine_calculated_matrices()
"""
if self.stft is None or self.stft.size == 0:

MODIFY
nussl/transformer_nmf.py
nussl/transformer_nmf.py
@@ -95,7 +95,6 @@ class TransformerNMF(object):
nussl_nmf.run()
signals = nussl_nmf.recombine_calculated_matrices()
-
"""
if self.input_matrix is None or self.input_matrix.size == 0:

Added demo for Transformer NMF and documentation for NMF/Transformer NMF.