Genre recognition: experiment

Goal: What if we remove the majority voting ? Rational: we may get more certain about the genre of a song but ignore it.

Conclusion: It boosts the accuracy for the highest values of $\lambda_g$, others are similar. The variance greatly decreases as there is many more examples. This is good for comparison and allows for less Ncv (faster experiments).

Observations:

  • Accuracies have to be compared with experiment 13b_noise_lg.
  • Other results are meaningless (features were reused).
  • Accuracy boosted for $\lambda_g=100$ (3%) and $\lambda_g=1000$ (2%).
  • Note that for $\lambda_g=1000$ the sparsity was less enforced with $\lambda_s= 0.1$. Still not enough though.
  • Ran for 2h50.

Hyper-parameters

Parameter under test

In [1]:
Pname = 'lg'
Pvalues = [None, 0.1, 1, 10, 100, 1e3]

# Regenerate the graph or the features at each iteration.
regen_graph = False
regen_features = True

Model parameters

In [2]:
p = {}

# Preprocessing.

# Graph.
p['K'] = 10 + 1  # 5 to 10 + 1 for self-reference
p['dm'] = 'cosine'
p['Csigma'] = 1
p['diag'] = True
p['laplacian'] = 'normalized'

# Feature extraction.
p['m'] = 128  # 64, 128, 512
p['ls'] = 1
p['ld'] = 10
p['le'] = None
p['lg'] = 100

# Classification.
p['scale'] = None
p['Nvectors'] = 6
p['svm_type'] = 'C'
p['kernel'] = 'linear'
p['C'] = 1
p['nu'] = 0.5
p['majority_voting'] = False

Data parameters

In [3]:
# HDF5 data stores.
p['folder'] = 'data'
p['filename_gtzan'] = 'gtzan.hdf5'
p['filename_audio'] = 'audio.hdf5'
p['filename_graph'] = 'graph.hdf5'
p['filename_features'] = 'features.hdf5'

# Dataset (10,100,644 | 5,100,149 | 2,10,644).
p['Ngenres'] = 5
p['Nclips'] = 100
p['Nframes'] = 149

# Added white noise.
p['noise_std'] = 0.1

Numerical parameters

In [4]:
# Graph.
p['tol'] = 1e-5

# Feature extraction.
p['rtol'] = 1e-5  # 1e-3, 1e-5, 1e-7
p['N_inner'] = 500
p['N_outer'] = 50

# Classification.
p['Nfolds'] = 10
p['Ncv'] = 40
p['dataset_classification'] = 'Z'

Processing

In [5]:
import numpy as np
import time

texperiment = time.time()

# Result dictionary.
res = ['accuracy', 'accuracy_std']
res += ['sparsity', 'atoms']
res += ['objective_g', 'objective_h', 'objective_i', 'objective_j']
res += ['time_features', 'iterations_inner', 'iterations_outer']
res = dict.fromkeys(res)
for key in res.keys():
    res[key] = []

def separator(name, parameter=False):
    if parameter:
        name += ', {} = {}'.format(Pname, p[Pname])
    dashes = 20 * '-'
    print('\n {} {} {} \n'.format(dashes, name, dashes))
    # Fair comparison when tuning parameters.
    # Randomnesses: dictionary initialization, training and testing sets.
    np.random.seed(1)
In [6]:
#%run gtzan.ipynb
#%run audio_preprocessing.ipynb
if not regen_graph:
    separator('Graph')
    #%run audio_graph.ipynb
if not regen_features:
    separator('Features')
%run audio_features.ipynb

# Hyper-parameter under test.
for p[Pname] in Pvalues:

    if regen_graph:
        separator('Graph', True)
        %run audio_graph.ipynb
    if regen_features:
        separator('Features', True)
        p['filename_features'] = 'features_{}_{}.hdf5'.format(Pname, p[Pname])
        #%run audio_features.ipynb
    separator('Classification', True)
    %run audio_classification.ipynb
    
    # Collect results.
    for key in res:
        res[key].append(globals()[key])

# Baseline, i.e. classification with spectrograms.
p['dataset_classification'] = 'X'
p['scale'] = 'minmax'  # Todo: should be done in pre-processing.
if not regen_graph and not regen_features:
    # Classifier parameters are being tested.
    for p[Pname] in Pvalues:
        separator('Baseline', True)
        %run audio_classification.ipynb
else:
    separator('Baseline')
    %run audio_classification.ipynb
res['baseline'] = len(Pvalues) * [accuracy]
res['baseline_std'] = accuracy_std
 -------------------- Graph -------------------- 

Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  Xa: (10, 100, 644, 2, 1024) , float32
  Xs: (10, 100, 644, 2, 96)   , float32
Full dataset:
  size: N=1,288,000 x n=96 -> 123,648,000 floats
  dim: 123,648 features per clip
  shape: (10, 100, 644, 2, 96)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=96 -> 14,304,000 floats
  dim: 28,608 features per clip
  shape: (5, 100, 149, 2, 96)
<type 'numpy.ndarray'>
Data: (149000, 96), float32
Attributes:
  K = 11
  dm = cosine
  Csigma = 1
  diag = True
  laplacian = normalized
Datasets:
  L_data    : (2789250,), float32
  L_indices : (2789250,), int32
  L_indptr  : (149001,) , int32
  L_shape   : (2,)      , int64
  W_data    : (2789250,), float32
  W_indices : (2789250,), int32
  W_indptr  : (149001,) , int32
  W_shape   : (2,)      , int64
Size X: 13.6 M --> 54.6 MiB
Size Z: 18.2 M --> 72.8 MiB
Size D: 12.0 k --> 48.0 kiB
Size E: 12.0 k --> 48.0 kiB
Elapsed time: 639 seconds
Inner loop: 246 iterations
g(Z) = ||X-DZ||_2^2 = 7.462377e+05
rdiff: 0.000593498029647
i(Z) = ||Z||_1 = 7.127560e+04
j(Z) = tr(Z^TLZ) = 2.056625e+04
Global objective: 8.380796e+05
Outer loop: 4 iterations

Z in [-0.056636184454, 0.14264112711]
Sparsity of Z: 8,786,613 non-zero entries out of 19,072,000 entries, i.e. 46.1%.
D in [-0.145910441875, 0.507630586624]
d in [0.999999761581, 1.00000023842]
Constraints on D: True
Datasets:
  D : (128, 96)             , float32
  X : (5, 100, 149, 2, 96)  , float32
  Z : (5, 100, 149, 2, 128) , float32
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Overall time: 648 seconds

 -------------------- Features, lg = None -------------------- 


 -------------------- Classification, lg = None -------------------- 

Software versions:
  numpy: 1.8.2
  sklearn: 0.14.1
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  D : (128, 96)               , float32
  X : (5, 100, 149, 2, 96)    , float32
  Z : (5, 100, 149, 2, 128)   , float32
Full dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<type 'numpy.ndarray'>
Flattened frames:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 298, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Feature vectors:
  size: N=6,000 x n=128 -> 768,000 floats
  dim: 1,536 features per clip
  shape: (5, 100, 6, 2, 128)
5 genres: blues, classical, country, disco, hiphop
Training data: (3600, 128), float64
Testing data: (2400, 128), float64
Training labels: (3600,), uint8
Testing labels: (2400,), uint8
Accuracy: 54.8 %
5 genres: blues, classical, country, disco, hiphop
Training data: (300, 1536), float64
Testing data: (200, 1536), float64
Training labels: (300,), uint8
Testing labels: (200,), uint8
Feature vectors accuracy: 48.4 %
Clips accuracy: 57.0 %
5 genres: blues, classical, country, disco, hiphop
Data: (6000, 128), float64
Labels: (6000,), uint8
  58 (+/- 1.8) <- [56 56 56 59 58 59 54 56 57 60]
  57 (+/- 1.4) <- [57 58 59 55 57 55 57 55 56 55]
  57 (+/- 1.8) <- [56 56 54 58 56 55 59 57 56 60]
  57 (+/- 2.0) <- [54 60 56 57 57 56 59 53 58 56]
  57 (+/- 1.4) <- [57 56 56 56 56 56 60 59 57 56]
  57 (+/- 1.8) <- [56 54 57 60 56 55 56 59 56 54]
  57 (+/- 1.4) <- [60 54 57 57 57 56 55 58 58 56]
  57 (+/- 1.7) <- [58 58 56 57 56 56 56 60 59 54]
  57 (+/- 2.2) <- [57 57 54 57 53 57 58 61 54 55]
  57 (+/- 1.7) <- [58 56 57 58 56 60 57 56 56 53]
  57 (+/- 2.1) <- [59 57 58 58 52 57 55 58 58 57]
  56 (+/- 1.9) <- [55 56 57 55 55 60 57 57 55 53]
  57 (+/- 1.5) <- [57 59 55 59 56 59 55 55 57 56]
  57 (+/- 2.0) <- [55 53 58 59 55 54 55 56 59 57]
  57 (+/- 2.6) <- [54 59 53 55 58 54 58 55 61 56]
  57 (+/- 2.1) <- [56 58 53 60 54 58 57 57 54 58]
  57 (+/- 2.0) <- [56 54 54 58 60 59 57 57 55 57]
  57 (+/- 2.9) <- [56 52 61 58 58 61 54 59 55 57]
  58 (+/- 2.2) <- [58 56 56 52 56 59 58 59 58 59]
  57 (+/- 2.1) <- [58 61 54 58 56 55 55 56 55 58]
  57 (+/- 1.9) <- [58 57 57 58 54 58 55 57 52 56]
  57 (+/- 2.0) <- [56 57 55 55 57 61 56 58 53 56]
  57 (+/- 2.1) <- [61 59 57 56 56 54 55 59 57 54]
  57 (+/- 1.5) <- [56 54 58 56 57 60 56 57 57 55]
  57 (+/- 1.9) <- [55 56 54 59 56 53 56 59 58 59]
  57 (+/- 1.7) <- [58 54 54 59 58 56 58 57 55 56]
  57 (+/- 1.8) <- [56 58 57 58 57 53 55 57 59 59]
  57 (+/- 2.0) <- [58 54 56 55 60 56 59 56 54 58]
  57 (+/- 1.8) <- [55 56 59 56 53 57 58 57 58 53]
  57 (+/- 1.2) <- [56 57 55 57 58 56 58 56 59 55]
  57 (+/- 1.8) <- [54 59 54 57 59 58 56 56 56 54]
  57 (+/- 1.4) <- [57 54 58 58 55 56 56 56 57 56]
  57 (+/- 1.7) <- [58 59 55 54 56 58 56 59 57 57]
  57 (+/- 1.6) <- [54 56 57 56 57 56 59 57 59 54]
  57 (+/- 1.8) <- [58 56 60 59 57 55 56 58 57 54]
  57 (+/- 2.3) <- [56 58 56 56 60 58 56 59 51 54]
  57 (+/- 1.8) <- [57 55 56 55 56 55 61 58 55 57]
  57 (+/- 2.0) <- [54 57 56 56 55 61 59 57 55 58]
  57 (+/- 1.7) <- [58 53 58 57 54 56 57 57 56 57]
  57 (+/- 2.1) <- [55 56 58 57 58 59 55 58 55 52]
Accuracy: 57.1 (+/- 1.92)
Mean time (40 cv): 45.99 seconds
Overall time: 1847.01 seconds

 -------------------- Features, lg = 0.1 -------------------- 


 -------------------- Classification, lg = 0.1 -------------------- 

Software versions:
  numpy: 1.8.2
  sklearn: 0.14.1
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  D : (128, 96)               , float32
  X : (5, 100, 149, 2, 96)    , float32
  Z : (5, 100, 149, 2, 128)   , float32
Full dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<type 'numpy.ndarray'>
Flattened frames:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 298, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Feature vectors:
  size: N=6,000 x n=128 -> 768,000 floats
  dim: 1,536 features per clip
  shape: (5, 100, 6, 2, 128)
5 genres: blues, classical, country, disco, hiphop
Training data: (3600, 128), float64
Testing data: (2400, 128), float64
Training labels: (3600,), uint8
Testing labels: (2400,), uint8
Accuracy: 54.9 %
5 genres: blues, classical, country, disco, hiphop
Training data: (300, 1536), float64
Testing data: (200, 1536), float64
Training labels: (300,), uint8
Testing labels: (200,), uint8
Feature vectors accuracy: 48.8 %
Clips accuracy: 57.5 %
5 genres: blues, classical, country, disco, hiphop
Data: (6000, 128), float64
Labels: (6000,), uint8
  59 (+/- 1.4) <- [60 58 59 59 55 58 57 60 59 59]
  59 (+/- 2.1) <- [56 61 61 56 57 55 60 61 58 57]
  58 (+/- 1.5) <- [58 56 56 58 57 57 60 60 56 59]
  59 (+/- 1.8) <- [55 60 58 60 57 58 61 56 60 57]
  59 (+/- 1.5) <- [60 56 56 58 57 57 59 59 58 61]
  58 (+/- 2.4) <- [55 56 57 62 60 56 58 60 59 54]
  59 (+/- 1.7) <- [61 55 58 58 60 57 56 59 60 58]
  59 (+/- 2.6) <- [61 56 55 58 59 56 55 61 63 58]
  58 (+/- 3.5) <- [62 57 55 56 51 57 63 62 57 54]
  59 (+/- 2.0) <- [58 57 57 60 60 62 59 58 56 54]
  58 (+/- 1.4) <- [58 59 59 56 56 60 57 58 59 56]
  58 (+/- 1.8) <- [57 59 58 56 56 61 58 59 55 56]
  58 (+/- 1.7) <- [55 60 58 60 55 57 59 56 56 56]
  58 (+/- 2.9) <- [55 53 59 61 56 59 56 56 63 61]
  59 (+/- 2.1) <- [58 60 53 58 59 56 61 58 60 59]
  59 (+/- 2.0) <- [60 56 55 59 55 59 58 61 59 60]
  58 (+/- 1.1) <- [58 57 56 58 56 57 56 59 58 58]
  58 (+/- 2.6) <- [59 54 60 56 58 61 53 58 55 59]
  58 (+/- 2.2) <- [58 57 57 53 58 56 61 59 58 61]
  58 (+/- 1.3) <- [58 58 59 59 61 56 57 56 56 58]
  58 (+/- 1.4) <- [60 58 59 56 58 59 57 56 56 56]
  58 (+/- 2.2) <- [57 57 56 55 59 61 57 60 54 59]
  58 (+/- 1.2) <- [60 59 57 57 57 56 57 59 58 57]
  58 (+/- 1.1) <- [57 56 58 57 59 60 56 59 57 57]
  58 (+/- 1.4) <- [56 59 57 59 59 57 56 60 56 59]
  58 (+/- 2.3) <- [63 54 56 59 59 58 56 60 58 57]
  59 (+/- 2.2) <- [58 60 59 59 57 54 58 60 63 59]
  58 (+/- 1.9) <- [57 56 55 56 61 60 58 59 55 60]
  58 (+/- 2.5) <- [56 59 59 63 53 60 59 57 58 56]
  58 (+/- 2.2) <- [57 59 56 56 60 54 61 58 60 56]
  59 (+/- 1.9) <- [56 59 55 60 59 61 61 58 58 56]
  59 (+/- 1.8) <- [58 55 58 62 58 60 60 59 58 57]
  58 (+/- 2.4) <- [59 61 55 52 57 58 57 57 59 58]
  59 (+/- 2.1) <- [61 57 58 57 59 56 62 62 59 55]
  58 (+/- 1.3) <- [60 57 58 58 59 56 56 59 58 57]
  58 (+/- 1.7) <- [56 58 59 60 59 59 55 60 57 54]
  58 (+/- 1.4) <- [60 57 58 55 58 57 60 58 57 57]
  58 (+/- 1.8) <- [56 58 55 55 57 58 60 57 60 59]
  58 (+/- 1.8) <- [59 55 59 59 54 59 57 59 60 58]
  58 (+/- 2.1) <- [60 59 58 60 60 59 55 58 56 54]
Accuracy: 58.3 (+/- 2.02)
Mean time (40 cv): 47.32 seconds
Overall time: 1900.22 seconds

 -------------------- Features, lg = 1 -------------------- 


 -------------------- Classification, lg = 1 -------------------- 

Software versions:
  numpy: 1.8.2
  sklearn: 0.14.1
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  D : (128, 96)               , float32
  X : (5, 100, 149, 2, 96)    , float32
  Z : (5, 100, 149, 2, 128)   , float32
Full dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<type 'numpy.ndarray'>
Flattened frames:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 298, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Feature vectors:
  size: N=6,000 x n=128 -> 768,000 floats
  dim: 1,536 features per clip
  shape: (5, 100, 6, 2, 128)
5 genres: blues, classical, country, disco, hiphop
Training data: (3600, 128), float64
Testing data: (2400, 128), float64
Training labels: (3600,), uint8
Testing labels: (2400,), uint8
Accuracy: 55.6 %
5 genres: blues, classical, country, disco, hiphop
Training data: (300, 1536), float64
Testing data: (200, 1536), float64
Training labels: (300,), uint8
Testing labels: (200,), uint8
Feature vectors accuracy: 48.5 %
Clips accuracy: 59.0 %
5 genres: blues, classical, country, disco, hiphop
Data: (6000, 128), float64
Labels: (6000,), uint8
  58 (+/- 1.6) <- [56 56 57 60 59 58 54 57 58 59]
  58 (+/- 1.7) <- [56 59 61 57 58 56 60 55 57 57]
  58 (+/- 1.6) <- [57 56 54 59 56 57 58 58 57 61]
  57 (+/- 2.3) <- [53 60 57 58 58 55 59 54 59 55]
  58 (+/- 1.4) <- [57 55 56 56 56 57 59 60 57 57]
  58 (+/- 1.8) <- [56 56 57 60 57 54 57 61 56 56]
  58 (+/- 1.8) <- [61 55 58 56 59 57 56 57 60 58]
  58 (+/- 1.6) <- [57 60 57 56 56 56 55 59 59 56]
  57 (+/- 2.0) <- [57 56 55 57 53 57 59 60 56 55]
  58 (+/- 2.0) <- [59 57 57 58 57 61 57 57 56 53]
  58 (+/- 1.9) <- [60 58 57 59 53 57 55 59 58 58]
  57 (+/- 1.7) <- [56 56 59 56 55 61 57 57 56 56]
  58 (+/- 1.2) <- [57 59 57 59 56 59 56 55 57 57]
  57 (+/- 2.3) <- [55 54 59 61 56 54 56 57 60 58]
  58 (+/- 3.0) <- [55 61 53 55 59 54 57 56 63 58]
  57 (+/- 1.8) <- [56 58 52 59 56 58 59 57 56 58]
  58 (+/- 1.6) <- [57 55 55 59 60 59 57 56 55 57]
  58 (+/- 2.7) <- [57 52 61 56 58 62 54 58 56 57]
  58 (+/- 2.3) <- [59 55 57 52 56 60 59 59 58 59]
  58 (+/- 1.4) <- [58 61 56 59 59 57 57 58 56 58]
  58 (+/- 1.4) <- [59 58 58 59 56 57 56 59 54 57]
  57 (+/- 1.9) <- [57 57 56 55 59 61 57 58 53 56]
  57 (+/- 2.3) <- [61 59 58 58 57 54 55 56 57 53]
  58 (+/- 1.5) <- [57 55 59 56 57 61 57 57 56 56]
  57 (+/- 2.0) <- [54 57 54 60 57 54 54 59 56 57]
  58 (+/- 2.0) <- [60 56 54 62 58 56 57 57 57 56]
  58 (+/- 2.0) <- [57 60 57 60 56 54 56 58 60 60]
  58 (+/- 2.7) <- [58 52 57 55 62 57 59 57 54 60]
  57 (+/- 1.4) <- [56 57 59 56 54 57 56 57 57 54]
  58 (+/- 1.5) <- [57 57 56 57 60 56 59 55 60 58]
  57 (+/- 1.7) <- [54 59 55 57 59 59 56 56 56 55]
  58 (+/- 1.5) <- [58 55 59 59 56 59 57 56 58 55]
  58 (+/- 1.8) <- [57 60 55 54 55 58 59 59 57 59]
  57 (+/- 1.7) <- [55 56 58 57 56 57 59 57 59 54]
  58 (+/- 1.6) <- [59 56 59 60 57 55 56 57 58 55]
  57 (+/- 2.3) <- [56 59 56 58 61 58 57 59 52 55]
  58 (+/- 1.9) <- [57 54 57 56 56 55 61 59 57 58]
  57 (+/- 1.5) <- [55 58 55 57 56 60 58 56 57 58]
  57 (+/- 1.6) <- [58 53 59 57 55 56 58 56 57 57]
  57 (+/- 2.0) <- [57 56 58 59 57 59 56 58 55 52]
Accuracy: 57.6 (+/- 1.92)
Mean time (40 cv): 42.40 seconds
Overall time: 1702.70 seconds

 -------------------- Features, lg = 10 -------------------- 


 -------------------- Classification, lg = 10 -------------------- 

Software versions:
  numpy: 1.8.2
  sklearn: 0.14.1
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  D : (128, 96)               , float32
  X : (5, 100, 149, 2, 96)    , float32
  Z : (5, 100, 149, 2, 128)   , float32
Full dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<type 'numpy.ndarray'>
Flattened frames:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 298, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Feature vectors:
  size: N=6,000 x n=128 -> 768,000 floats
  dim: 1,536 features per clip
  shape: (5, 100, 6, 2, 128)
5 genres: blues, classical, country, disco, hiphop
Training data: (3600, 128), float64
Testing data: (2400, 128), float64
Training labels: (3600,), uint8
Testing labels: (2400,), uint8
Accuracy: 59.2 %
5 genres: blues, classical, country, disco, hiphop
Training data: (300, 1536), float64
Testing data: (200, 1536), float64
Training labels: (300,), uint8
Testing labels: (200,), uint8
Feature vectors accuracy: 50.6 %
Clips accuracy: 61.0 %
5 genres: blues, classical, country, disco, hiphop
Data: (6000, 128), float64
Labels: (6000,), uint8
  61 (+/- 1.0) <- [61 61 59 61 62 61 59 60 62 62]
  61 (+/- 1.6) <- [58 63 63 60 59 60 62 60 59 60]
  61 (+/- 1.8) <- [60 60 59 62 60 60 63 59 59 64]
  61 (+/- 2.2) <- [57 62 59 63 61 60 63 57 63 60]
  60 (+/- 1.7) <- [61 57 60 60 58 60 62 63 59 60]
  61 (+/- 2.1) <- [61 60 61 63 62 56 59 64 59 59]
  61 (+/- 1.2) <- [63 60 61 60 61 59 59 61 61 61]
  61 (+/- 1.7) <- [60 61 60 62 61 60 60 64 63 58]
  60 (+/- 1.8) <- [60 59 60 59 57 58 64 62 61 59]
  61 (+/- 1.9) <- [62 60 60 63 61 63 60 59 62 56]
  60 (+/- 1.2) <- [60 61 60 61 59 63 58 58 59 60]
  60 (+/- 1.4) <- [60 59 62 60 60 62 59 61 57 60]
  60 (+/- 1.3) <- [61 61 61 59 60 60 60 58 57 61]
  61 (+/- 2.4) <- [55 58 62 63 61 59 59 58 63 63]
  61 (+/- 2.6) <- [59 64 59 59 63 56 61 59 65 61]
  61 (+/- 1.6) <- [60 61 58 64 60 62 60 60 59 61]
  61 (+/- 1.7) <- [59 57 60 64 61 62 58 60 59 61]
  61 (+/- 2.5) <- [60 56 65 59 61 64 60 62 57 62]
  61 (+/- 1.9) <- [60 58 60 56 61 61 63 61 60 62]
  61 (+/- 1.5) <- [59 62 58 63 63 61 59 61 59 62]
  61 (+/- 0.5) <- [61 60 61 60 60 61 61 60 60 61]
  61 (+/- 2.5) <- [61 59 57 59 62 63 61 64 56 60]
  60 (+/- 1.7) <- [63 61 61 61 61 57 57 60 59 59]
  61 (+/- 1.5) <- [61 59 62 60 61 62 59 63 59 60]
  61 (+/- 1.4) <- [60 61 58 61 61 58 59 63 61 61]
  61 (+/- 1.7) <- [64 60 58 62 60 59 59 62 60 60]
  61 (+/- 2.2) <- [60 61 60 62 58 56 57 62 63 62]
  60 (+/- 1.8) <- [58 59 60 56 64 60 61 61 60 61]
  60 (+/- 1.6) <- [60 61 61 61 56 61 59 61 60 58]
  61 (+/- 2.0) <- [60 62 60 61 61 56 63 59 64 61]
  61 (+/- 1.7) <- [59 61 60 62 62 64 60 59 61 59]
  61 (+/- 1.4) <- [62 58 61 62 59 61 61 62 62 59]
  61 (+/- 1.8) <- [60 62 60 57 60 60 64 60 61 59]
  61 (+/- 1.5) <- [58 59 61 61 60 61 62 61 61 57]
  61 (+/- 2.1) <- [60 60 65 62 61 58 60 60 61 57]
  61 (+/- 2.1) <- [59 59 61 63 63 63 58 62 57 60]
  60 (+/- 1.2) <- [61 59 60 60 59 60 61 62 59 59]
  61 (+/- 2.0) <- [59 61 58 58 60 64 64 60 62 62]
  60 (+/- 1.5) <- [60 58 59 61 58 62 59 59 62 61]
  61 (+/- 1.9) <- [63 61 60 60 61 62 58 62 61 56]
Accuracy: 60.8 (+/- 1.81)
Mean time (40 cv): 31.37 seconds
Overall time: 1260.58 seconds

 -------------------- Features, lg = 100 -------------------- 


 -------------------- Classification, lg = 100 -------------------- 

Software versions:
  numpy: 1.8.2
  sklearn: 0.14.1
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  D : (128, 96)               , float32
  X : (5, 100, 149, 2, 96)    , float32
  Z : (5, 100, 149, 2, 128)   , float32
Full dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<type 'numpy.ndarray'>
Flattened frames:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 298, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Feature vectors:
  size: N=6,000 x n=128 -> 768,000 floats
  dim: 1,536 features per clip
  shape: (5, 100, 6, 2, 128)
5 genres: blues, classical, country, disco, hiphop
Training data: (3600, 128), float64
Testing data: (2400, 128), float64
Training labels: (3600,), uint8
Testing labels: (2400,), uint8
Accuracy: 63.2 %
5 genres: blues, classical, country, disco, hiphop
Training data: (300, 1536), float64
Testing data: (200, 1536), float64
Training labels: (300,), uint8
Testing labels: (200,), uint8
Feature vectors accuracy: 57.2 %
Clips accuracy: 62.0 %
5 genres: blues, classical, country, disco, hiphop
Data: (6000, 128), float64
Labels: (6000,), uint8
  64 (+/- 1.9) <- [63 64 59 66 66 65 65 63 65 64]
  64 (+/- 2.7) <- [59 68 65 65 61 64 67 62 62 66]
  64 (+/- 1.5) <- [64 64 60 65 65 62 65 63 63 65]
  64 (+/- 1.8) <- [62 62 61 66 61 64 66 62 64 65]
  64 (+/- 2.3) <- [60 61 65 64 62 63 65 69 63 66]
  64 (+/- 2.6) <- [62 62 64 68 66 63 64 68 61 61]
  64 (+/- 1.5) <- [63 62 66 64 64 64 61 61 63 65]
  64 (+/- 1.3) <- [64 63 63 63 63 63 62 65 66 62]
  64 (+/- 1.7) <- [66 64 65 63 61 60 65 65 64 65]
  64 (+/- 2.2) <- [67 64 63 67 63 65 63 62 65 59]
  64 (+/- 2.4) <- [65 65 66 64 65 67 62 62 63 58]
  64 (+/- 2.1) <- [60 63 63 66 62 67 62 65 61 64]
  64 (+/- 1.5) <- [65 65 65 63 64 62 64 61 62 65]
  64 (+/- 2.1) <- [62 62 63 64 64 61 61 62 66 69]
  64 (+/- 2.8) <- [63 66 60 62 67 59 65 67 67 61]
  64 (+/- 1.9) <- [63 65 60 67 63 65 61 64 62 61]
  64 (+/- 1.7) <- [63 61 65 63 65 67 62 63 64 65]
  64 (+/- 2.6) <- [63 59 64 65 65 67 61 63 61 67]
  64 (+/- 1.7) <- [61 63 66 61 64 65 64 66 66 64]
  64 (+/- 1.6) <- [62 64 62 66 64 65 63 61 62 65]
  64 (+/- 1.5) <- [64 66 63 62 64 66 63 63 64 61]
  64 (+/- 2.3) <- [66 64 59 65 63 67 63 66 61 64]
  64 (+/- 1.9) <- [65 62 63 67 65 60 62 65 64 63]
  64 (+/- 1.7) <- [66 62 64 64 63 66 61 66 63 62]
  64 (+/- 2.0) <- [63 64 62 65 67 61 61 63 64 67]
  64 (+/- 1.8) <- [67 64 63 64 65 63 61 65 64 61]
  64 (+/- 1.3) <- [65 64 64 62 63 62 66 64 65 64]
  64 (+/- 1.2) <- [62 63 65 63 63 65 63 63 62 66]
  64 (+/- 1.5) <- [63 62 64 64 61 65 62 64 66 63]
  64 (+/- 2.0) <- [62 65 64 64 64 60 67 65 65 60]
  64 (+/- 1.6) <- [63 64 62 64 66 65 65 63 61 63]
  64 (+/- 1.5) <- [64 62 64 65 66 63 62 65 65 61]
  64 (+/- 1.7) <- [65 64 62 61 60 63 66 65 64 64]
  64 (+/- 1.9) <- [63 59 63 64 66 65 65 66 64 61]
  64 (+/- 1.0) <- [64 63 63 62 65 62 63 63 64 62]
  64 (+/- 2.6) <- [62 66 62 67 69 64 62 63 59 63]
  64 (+/- 1.0) <- [64 62 63 63 64 63 65 65 63 64]
  64 (+/- 1.9) <- [61 65 63 60 62 67 64 63 64 65]
  64 (+/- 1.4) <- [65 63 62 62 64 65 63 63 67 65]
  64 (+/- 2.4) <- [69 63 63 61 66 65 61 64 62 62]
Accuracy: 64.0 (+/- 1.92)
Mean time (40 cv): 22.69 seconds
Overall time: 912.58 seconds

 -------------------- Features, lg = 1000.0 -------------------- 


 -------------------- Classification, lg = 1000.0 -------------------- 

Software versions:
  numpy: 1.8.2
  sklearn: 0.14.1
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  D : (128, 96)               , float32
  X : (5, 100, 149, 2, 96)    , float32
  Z : (5, 100, 149, 2, 128)   , float32
Full dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 149, 2, 128)
<type 'numpy.ndarray'>
Flattened frames:
  size: N=149,000 x n=128 -> 19,072,000 floats
  dim: 38,144 features per clip
  shape: (5, 100, 298, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Truncated and grouped:
  size: N=135,000 x n=128 -> 17,280,000 floats
  dim: 34,560 features per clip
  shape: (5, 100, 6, 45, 128)
Feature vectors:
  size: N=6,000 x n=128 -> 768,000 floats
  dim: 1,536 features per clip
  shape: (5, 100, 6, 2, 128)
5 genres: blues, classical, country, disco, hiphop
Training data: (3600, 128), float64
Testing data: (2400, 128), float64
Training labels: (3600,), uint8
Testing labels: (2400,), uint8
Accuracy: 57.5 %
5 genres: blues, classical, country, disco, hiphop
Training data: (300, 1536), float64
Testing data: (200, 1536), float64
Training labels: (300,), uint8
Testing labels: (200,), uint8
Feature vectors accuracy: 53.2 %
Clips accuracy: 56.0 %
5 genres: blues, classical, country, disco, hiphop
Data: (6000, 128), float64
Labels: (6000,), uint8
  58 (+/- 1.8) <- [58 58 54 59 56 60 57 55 57 57]
  58 (+/- 2.1) <- [55 59 59 59 55 55 60 58 55 59]
  58 (+/- 2.6) <- [59 54 52 60 59 58 56 56 56 61]
  57 (+/- 1.6) <- [56 56 54 56 55 58 59 58 59 58]
  58 (+/- 2.3) <- [54 58 55 55 55 56 60 62 56 59]
  58 (+/- 2.1) <- [57 57 56 60 60 56 59 60 55 53]
  57 (+/- 1.5) <- [58 55 59 60 58 56 56 55 57 57]
  57 (+/- 2.0) <- [61 55 56 56 57 56 58 59 58 53]
  57 (+/- 1.4) <- [58 55 59 56 55 57 58 59 57 56]
  57 (+/- 1.6) <- [59 57 57 59 56 60 56 56 56 54]
  58 (+/- 2.0) <- [56 59 57 57 58 62 57 55 55 55]
  58 (+/- 1.5) <- [56 55 60 57 58 58 55 56 58 57]
  58 (+/- 2.2) <- [58 63 57 58 56 55 57 54 56 56]
  58 (+/- 1.7) <- [56 56 55 58 57 55 57 57 58 61]
  57 (+/- 2.2) <- [56 56 53 57 59 54 55 59 60 58]
  57 (+/- 2.0) <- [58 57 56 58 54 59 54 58 60 55]
  58 (+/- 1.6) <- [58 56 55 58 60 60 55 57 56 58]
  57 (+/- 1.3) <- [59 55 58 55 57 58 56 57 57 58]
  57 (+/- 1.4) <- [57 56 57 56 57 59 54 56 58 59]
  58 (+/- 1.5) <- [57 58 55 60 58 57 56 57 55 60]
  57 (+/- 1.8) <- [55 59 54 59 59 57 57 54 57 57]
  57 (+/- 2.1) <- [60 58 54 57 57 61 59 56 56 54]
  57 (+/- 1.7) <- [58 56 57 57 57 54 59 56 61 56]
  57 (+/- 1.7) <- [56 56 56 57 57 60 57 59 55 55]
  58 (+/- 2.3) <- [56 58 56 60 62 56 54 58 55 59]
  57 (+/- 1.6) <- [57 56 56 57 58 60 55 57 57 54]
  58 (+/- 1.3) <- [58 56 60 58 57 57 55 55 58 57]
  58 (+/- 1.6) <- [57 56 56 56 59 57 59 57 55 59]
  57 (+/- 1.9) <- [58 57 57 58 55 60 54 56 59 55]
  57 (+/- 2.0) <- [56 56 54 58 58 55 61 59 58 55]
  57 (+/- 2.0) <- [57 57 55 56 61 60 56 57 54 56]
  57 (+/- 1.5) <- [56 57 58 60 55 56 56 58 57 55]
  58 (+/- 2.6) <- [60 60 56 52 56 55 58 60 58 58]
  58 (+/- 1.5) <- [55 55 56 57 58 58 60 58 55 58]
  58 (+/- 1.6) <- [59 55 59 57 58 54 58 57 58 55]
  57 (+/- 3.2) <- [56 62 52 61 61 58 57 55 54 56]
  58 (+/- 1.8) <- [58 57 60 54 57 56 57 56 56 60]
  58 (+/- 2.1) <- [54 60 56 54 57 61 58 57 58 58]
  58 (+/- 2.5) <- [59 53 57 60 56 57 53 58 61 58]
  58 (+/- 1.9) <- [59 58 56 60 59 56 54 56 58 55]
Accuracy: 57.5 (+/- 1.93)
Mean time (40 cv): 26.15 seconds
Overall time: 1051.47 seconds

 -------------------- Baseline -------------------- 

Software versions:
  numpy: 1.8.2
  sklearn: 0.14.1
Attributes:
  sr = 22050
  labels = ['blues' 'classical' 'country' 'disco' 'hiphop' 'jazz' 'metal' 'pop'
 'reggae' 'rock']
Datasets:
  D : (128, 96)               , float32
  X : (5, 100, 149, 2, 96)    , float32
  Z : (5, 100, 149, 2, 128)   , float32
Full dataset:
  size: N=149,000 x n=96 -> 14,304,000 floats
  dim: 28,608 features per clip
  shape: (5, 100, 149, 2, 96)
<class 'h5py._hl.dataset.Dataset'>
Reduced dataset:
  size: N=149,000 x n=96 -> 14,304,000 floats
  dim: 28,608 features per clip
  shape: (5, 100, 149, 2, 96)
<type 'numpy.ndarray'>
Flattened frames:
  size: N=149,000 x n=96 -> 14,304,000 floats
  dim: 28,608 features per clip
  shape: (5, 100, 298, 96)
Truncated and grouped:
  size: N=135,000 x n=96 -> 12,960,000 floats
  dim: 25,920 features per clip
  shape: (5, 100, 6, 45, 96)
Truncated and grouped:
  size: N=135,000 x n=96 -> 12,960,000 floats
  dim: 25,920 features per clip
  shape: (5, 100, 6, 45, 96)
Feature vectors:
  size: N=6,000 x n=96 -> 576,000 floats
  dim: 1,152 features per clip
  shape: (5, 100, 6, 2, 96)
5 genres: blues, classical, country, disco, hiphop
Training data: (3600, 96), float64
Testing data: (2400, 96), float64
Training labels: (3600,), uint8
Testing labels: (2400,), uint8
Accuracy: 59.3 %
5 genres: blues, classical, country, disco, hiphop
Training data: (300, 1152), float64
Testing data: (200, 1152), float64
Training labels: (300,), uint8
Testing labels: (200,), uint8
Feature vectors accuracy: 54.8 %
Clips accuracy: 62.5 %
5 genres: blues, classical, country, disco, hiphop
Data: (6000, 96), float64
Labels: (6000,), uint8
  58 (+/- 1.5) <- [57 59 55 59 59 59 57 55 59 59]
  59 (+/- 2.7) <- [52 61 62 58 59 58 63 58 57 58]
  59 (+/- 2.4) <- [60 57 53 61 59 58 59 58 56 62]
  59 (+/- 1.8) <- [57 60 56 61 56 59 60 60 59 56]
  59 (+/- 2.2) <- [55 57 56 58 57 59 60 62 58 61]
  59 (+/- 1.7) <- [56 59 57 61 60 56 59 59 58 55]
  59 (+/- 1.0) <- [59 57 58 61 58 58 59 57 59 59]
  59 (+/- 2.1) <- [57 57 57 57 57 58 59 61 63 55]
  59 (+/- 2.3) <- [59 56 57 57 55 55 59 61 59 62]
  59 (+/- 1.9) <- [59 58 60 62 56 62 58 59 59 56]
  59 (+/- 2.5) <- [57 61 58 60 55 64 56 56 58 55]
  59 (+/- 1.5) <- [60 59 61 59 56 60 59 59 57 56]
  59 (+/- 2.8) <- [59 62 57 58 52 62 60 55 59 58]
  59 (+/- 2.0) <- [59 55 58 58 56 59 57 57 62 60]
  58 (+/- 2.6) <- [57 60 54 59 60 54 58 57 62 58]
  59 (+/- 2.1) <- [56 61 55 61 56 61 57 59 57 58]
  59 (+/- 1.8) <- [58 57 59 61 60 61 55 59 60 56]
  59 (+/- 1.4) <- [59 58 60 58 58 57 58 57 55 60]
  58 (+/- 1.3) <- [57 57 56 57 58 59 59 60 59 59]
  59 (+/- 2.4) <- [58 60 57 61 62 61 56 54 58 59]
  58 (+/- 1.3) <- [57 60 57 58 57 60 59 57 57 56]
  58 (+/- 2.4) <- [60 59 53 56 58 60 61 58 54 58]
  58 (+/- 1.2) <- [59 57 57 58 60 56 59 57 58 56]
  59 (+/- 2.0) <- [58 57 57 59 57 63 58 62 57 59]
  59 (+/- 2.4) <- [59 59 60 59 60 55 54 62 56 60]
  59 (+/- 1.9) <- [58 57 59 60 59 57 57 58 62 55]
  59 (+/- 1.5) <- [57 59 61 59 61 59 56 60 56 58]
  59 (+/- 2.5) <- [55 56 60 57 57 62 61 61 54 59]
  59 (+/- 2.2) <- [59 61 60 59 54 57 57 58 62 55]
  58 (+/- 2.1) <- [57 58 58 61 57 56 59 59 59 53]
  59 (+/- 1.5) <- [59 58 60 57 60 61 59 58 56 56]
  59 (+/- 1.6) <- [60 55 57 58 60 57 58 60 59 59]
  59 (+/- 2.9) <- [62 62 56 52 58 58 61 61 57 57]
  59 (+/- 1.3) <- [56 58 58 58 58 60 60 59 58 56]
  59 (+/- 1.5) <- [59 58 59 60 60 58 56 60 56 56]
  59 (+/- 1.9) <- [58 61 58 61 62 58 57 57 56 56]
  59 (+/- 1.7) <- [58 57 56 56 58 59 58 58 58 62]
  58 (+/- 1.9) <- [56 61 57 57 57 59 56 57 60 60]
  59 (+/- 2.1) <- [60 58 57 60 54 56 58 58 62 58]
  59 (+/- 1.7) <- [60 59 59 58 61 59 54 59 58 58]
Accuracy: 58.7 (+/- 2.01)
Mean time (40 cv): 19.82 seconds
Overall time: 797.31 seconds

Results

In [7]:
print('{} = {}'.format(Pname, Pvalues))
for key, value in res.items():
    if key is not 'atoms':
        print('res[\'{}\'] = {}'.format(key, value))

def plot(*args, **kwargs):
    plt.figure(figsize=(8,5))
    x = range(len(Pvalues))
    log = 'log' in kwargs and kwargs['log'] is True
    pltfunc = plt.semilogy if log else plt.plot
    params = {}
    params['linestyle'] = '-'
    params['marker'] = '.'
    params['markersize'] = 10
    for i, var in enumerate(args):
        if 'err' in kwargs:
            pltfunc = plt.errorbar
            params['yerr'] = res[kwargs['err'][i]]
            params['capsize'] = 5
        pltfunc(x, res[var], label=var, **params)
        for i,j in zip(x, res[var]):
            plt.annotate('{:.2f}'.format(j), xy=(i,j), xytext=(5,5), textcoords='offset points')
    margin = 0.25
    params['markersize'] = 10
    plt.xlim(-margin, len(Pvalues)-1+margin)
    if 'ylim' in kwargs:
        plt.ylim(kwargs['ylim'])
    plt.title('{} vs {}'.format(', '.join(args), Pname))
    plt.xlabel(Pname)
    plt.ylabel(' ,'.join(args))
    plt.xticks(x, Pvalues)
    plt.grid(True); plt.legend(loc='best'); plt.show()

def div(l):
    div = Pvalues if Pname is l else [p[l]]
    return np.array([1 if v is None else v for v in div])

# Classification results.
res['chance'] = len(Pvalues) * [100./p['Ngenres']]
res['chance_std'] = 0
err=['accuracy_std', 'baseline_std', 'chance_std']
plot('accuracy', 'baseline', 'chance', err=err, ylim=[0,100])

# Features extraction results.
if regen_features:
    plot('objective_g', 'objective_i', 'objective_j', log=True)
    # Unweighted objectives.
    print('g(Z) = ||X-DZ||_2^2, h(Z) = ||Z-EX||_2^2, i(Z) = ||Z||_1, j(Z) = tr(Z^TLZ)')
    res['objective_g_un'] = res['objective_g'] / div('ld')
    res['objective_i_un'] = res['objective_i'] / div('ls')
    res['objective_j_un'] = res['objective_j'] / div('lg')
    plot('objective_g_un', 'objective_i_un', 'objective_j_un', log=True)
    plot('sparsity', ylim=[0,100])
    plot('time_features')
    plot('iterations_inner')
    plot('iterations_outer')

    for i, fig in enumerate(res['atoms']):
        print('Dictionary atoms for {} = {}'.format(Pname, Pvalues[i]))
        fig.show()

print('Experiment time: {:.0f} seconds'.format(time.time() - texperiment))
lg = [None, 0.1, 1, 10, 100, 1000.0]
res['accuracy_std'] = [1.9160245301143717, 2.0150868036858589, 1.9187624411467814, 1.8084254488827196, 1.9215625423510598, 1.9294211495218514]
res['objective_j'] = [20566.252136230469, 20566.252136230469, 20566.252136230469, 20566.252136230469, 20566.252136230469, 20566.252136230469]
res['objective_i'] = [71275.6015625, 71275.6015625, 71275.6015625, 71275.6015625, 71275.6015625, 71275.6015625]
res['objective_h'] = [0, 0, 0, 0, 0, 0]
res['objective_g'] = [746237.734375, 746237.734375, 746237.734375, 746237.734375, 746237.734375, 746237.734375]
res['baseline'] = [58.700000000000053, 58.700000000000053, 58.700000000000053, 58.700000000000053, 58.700000000000053, 58.700000000000053]
res['time_features'] = [639.2638561725616, 639.2638561725616, 639.2638561725616, 639.2638561725616, 639.2638561725616, 639.2638561725616]
res['baseline_std'] = 2.01042422278
res['sparsity'] = [46.07074769295302, 46.07074769295302, 46.07074769295302, 46.07074769295302, 46.07074769295302, 46.07074769295302]
res['iterations_inner'] = [246, 246, 246, 246, 246, 246]
res['iterations_outer'] = [4, 4, 4, 4, 4, 4]
res['accuracy'] = [57.073333333333331, 58.34041666666667, 57.587499999999956, 60.767083333333375, 64.012916666666641, 57.515833333333354]
g(Z) = ||X-DZ||_2^2, h(Z) = ||Z-EX||_2^2, i(Z) = ||Z||_1, j(Z) = tr(Z^TLZ)
Dictionary atoms for lg = None
Dictionary atoms for lg = 0.1
Dictionary atoms for lg = 1
Dictionary atoms for lg = 10
Dictionary atoms for lg = 100
Dictionary atoms for lg = 1000.0
Experiment time: 10125 seconds
/usr/lib/pymodules/python2.7/matplotlib/figure.py:371: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
  "matplotlib is currently using a non-GUI backend, "