code: def testRegression(self):
      # This test tries several combinations of the parameters dctType,
      # logType, liftering and silenceThreshold.
      # The rest of the parameters are directly inherited by MelBands and have
      # their own unit tests. The expected values were recomputed from commit
      # fb1b32b716eee2dc23af8219d402fe0ce80f5ef1
      spectrum = [0.1 * i for i in range(8)] * 128 + [0.5]
  
      # MFCC with default parameters.
      mfccs = self.InitMFCC(13, log_type="dbamp", dct_type=2)(spectrum)[
          1
      ]
      expected = [
          -97.47665405,
          -2.33175659,
          -2.09009075,
          -1.78271627,
          -1.51546073,
          -1.2559967,
          -1.04854584,
          -0.83390617,
          -0.60241103,
          -0.44342852,
          -0.48855162,
          -0.5175457,
          -0.60503697,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with DCT type 3.
      mfccs = self.InitMFCC(13, log_type="dbamp", dct_type=3)(spectrum)[
          1
      ]
      expected = [
          -137.85279846,
          -2.33175659,
          -2.09009075,
          -1.78271627,
          -1.51546073,
          -1.2559967,
          -1.04854584,
          -0.83390617,
          -0.60241103,
          -0.44342852,
          -0.48855162,
          -0.5175457,
          -0.60503697,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with log type 'natural'.
      mfccs = self.InitMFCC(13, log_type="natural", dct_type=2)(
          spectrum
      )[1]
      expected = [
          1.10026228,
          -0.00906091,
          -0.00920506,
          -0.00904771,
          -0.00949879,
          -0.0093013,
          -0.00959581,
          -0.01000924,
          -0.01046225,
          -0.01158216,
          -0.01470083,
          -0.01487315,
          -0.01388442,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with log type 'natural' and DCT type 3.
      mfccs = self.InitMFCC(13, log_type="natural", dct_type=3)(
          spectrum
      )[1]
      expected = [
          1.55600595,
          -0.00906091,
          -0.00920506,
          -0.00904771,
          -0.00949879,
          -0.0093013,
          -0.00959581,
          -0.01000924,
          -0.01046225,
          -0.01158216,
          -0.01470083,
          -0.01487315,
          -0.01388442,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with log type 'dbpow'.
      mfccs = self.InitMFCC(13, log_type="dbpow", dct_type=2)(spectrum)[
          1
      ]
      expected = [
          -48.73832703,
          -1.1658783,
          -1.04504538,
          -0.89135814,
          -0.75773036,
          -0.62799835,
          -0.52427292,
          -0.41695309,
          -0.30120552,
          -0.22171426,
          -0.24427581,
          -0.25877285,
          -0.30251849,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with log type 'dbpow' and DCT type 3.
      mfccs = self.InitMFCC(13, log_type="dbpow", dct_type=3)(spectrum)[
          1
      ]
      expected = [
          -68.92639923,
          -1.1658783,
          -1.04504538,
          -0.89135814,
          -0.75773036,
          -0.62799835,
          -0.52427292,
          -0.41695309,
          -0.30120552,
          -0.22171426,
          -0.24427581,
          -0.25877285,
          -0.30251849,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with log type 'log'.
      mfccs = self.InitMFCC(13, log_type="log", dct_type=2)(spectrum)[1]
      expected = [
          -11.22241306,
          -0.26845309,
          -0.24063081,
          -0.20524287,
          -0.17447406,
          -0.1446017,
          -0.12071839,
          -0.09600687,
          -0.06935519,
          -0.05105186,
          -0.05624655,
          -0.05958462,
          -0.0696575,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with log type 'log' and DCT type 3.
      mfccs = self.InitMFCC(13, log_type="log", dct_type=3)(spectrum)[1]
      expected = [
          -15.87088871,
          -0.26845309,
          -0.24063081,
          -0.20524287,
          -0.17447406,
          -0.1446017,
          -0.12071839,
          -0.09600687,
          -0.06935519,
          -0.05105186,
          -0.05624655,
          -0.05958462,
          -0.0696575,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with 'silenceThreshold' = 1e-09.
      mfccs = self.InitMFCC(13, silenceThreshold=1e-9)(spectrum)[1]
      expected = [
          -97.47665405,
          -2.33175659,
          -2.09009075,
          -1.78271627,
          -1.51546073,
          -1.2559967,
          -1.04854584,
          -0.83390617,
          -0.60241103,
          -0.44342852,
          -0.48855162,
          -0.5175457,
          -0.60503697,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with 'silenceThreshold' = 1e-09 and 'liftering' = 22.
      mfccs = self.InitMFCC(13, silenceThreshold=1e-9, liftering=22)(
          spectrum
      )[1]
      expected = [
          -97.47665405,
          -5.98203564,
          -8.56740379,
          -9.92895412,
          -10.52797985,
          -10.30352879,
          -9.76536465,
          -8.55069828,
          -6.63010693,
          -5.12356043,
          -5.80791903,
          -6.2105484,
          -7.19270134,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
      # MFCC with 'liftering' = 22.
      mfccs = self.InitMFCC(13, liftering=22)(spectrum)[1]
      expected = [
          -97.47665405,
          -5.98203564,
          -8.56740379,
          -9.92895412,
          -10.52797985,
          -10.30352879,
          -9.76536465,
          -8.55069828,
          -6.63010693,
          -5.12356043,
          -5.80791903,
          -6.2105484,
          -7.19270134,
      ]
      self.assertAlmostEqualVector(mfccs, expected, 1.0e-6)
  
file_path: essentia/test/src/unittests/spectral/test_mfcc.py
imports: from essentia_test import *
  from math import *
  import numpy
label_desc: Use image node_id 3 for calling the TestMFCC obj's underlying member method code with example usage: obj.testRegression() without return types