nussl/separation/base/nmf_mixin.py
def transform(audio_signal, model):
        """
        Use an already fit model to transform the magnitude spectrogram of an 
        audio signal into components and activations. These can be multiplied to 
        reconstruct the original matrix, or used to separate out sounds that correspond
        to components in the model.
        
        Args:
            audio_signal (AudioSignal): AudioSignal object to transform with model.
            model (NMF): NMF model to separate with. Must be fitted prior to this call.
            

        Returns:
            components (np.ndarray): Spectral templates (n_components, n_features)
            activations (np.ndarray): Activations (n_components, n_time, n_channels)
              The shape here is as if it was like an STFT but with components as the
              features rather than frequencies of the STFT.
        """
        data = np.abs(audio_signal.stft())

        shape = data.shape
        data = data.transpose()
        data = data.reshape(-1, data.shape[-1])
        activations = model.transform(data).T

        activations = activations.reshape((model.n_components,) + shape[1:])
        return model.components_, activations

        Use an already fit model to transform the magnitude spectrogram of an 
        audio signal into components and activations. These can be multiplied to 
        reconstruct the original matrix, or used to separate out sounds that correspond
        to components in the model.
        
        Args:
            audio_signal (AudioSignal): AudioSignal object to transform with model.
            model (NMF): NMF model to separate with. Must be fitted prior to this call.
            

        Returns:
            components (np.ndarray): Spectral templates (n_components, n_features)
            activations (np.ndarray): Activations (n_components, n_time, n_channels)
              The shape here is as if it was like an STFT but with components as the
              features rather than frequencies of the STFT.
        
Use an already fit model to transform the magnitude spectrogram of an
audio signal into components and activations. These can be multiplied to
reconstruct the original matrix, or used to separate out sounds that correspond
to components in the model.
Use an already fit model to transform the magnitude spectrogram of an audio signal into components and activations . These can be multiplied to reconstruct the original matrix or used to separate out sounds that correspond to components in the model .
def transform(audio_signal, model):
        data = np.abs(audio_signal.stft())
        shape = data.shape
        data = data.transpose()
        data = data.reshape(-1, data.shape[-1])
        activations = model.transform(data).T
        activations = activations.reshape((model.n_components,) + shape[1:])
        return model.components_, activations
def transform ( audio_signal , model ) : data = np . abs ( audio_signal . stft ( ) ) shape = data . shape data = data . transpose ( ) data = data . reshape ( - 1 , data . shape [ - 1 ] ) activations = model . transform ( data ) . T activations = activations . reshape ( ( model . n_components , ) + shape [ 1 : ] ) return model . components_ , activations
Use an already fit model to transform the magnitude spectrogram of an
audio signal into components and activations.
Use an already fit model to transform the magnitude spectrogram of an audio signal into components and activations .
"""
        Use an already fit model to transform the magnitude spectrogram of an 
        audio signal into components and activations. These can be multiplied to 
        reconstruct the original matrix, or used to separate out sounds that correspond
        to components in the model.
        
        Args:
            audio_signal (AudioSignal): AudioSignal object to transform with model.
            model (NMF): NMF model to separate with. Must be fitted prior to this call.
            

        Returns:
            components (np.ndarray): Spectral templates (n_components, n_features)
            activations (np.ndarray): Activations (n_components, n_time, n_channels)
              The shape here is as if it was like an STFT but with components as the
              features rather than frequencies of the STFT.
        """
components (np.ndarray): Spectral templates (n_components, n_features)
activations (np.ndarray): Activations (n_components, n_time, n_channels)
The shape here is as if it was like an STFT but with components as the
features rather than frequencies of the STFT.
components ( np . ndarray ) : Spectral templates ( n_components n_features ) activations ( np . ndarray ) : Activations ( n_components n_time n_channels ) The shape here is as if it was like an STFT but with components as the features rather than frequencies of the STFT .
audio_signal
AudioSignal object to transform with model.
AudioSignal object to transform with model .
model
NMF model to separate with. Must be fitted prior to this call.
NMF model to separate with . Must be fitted prior to this call .