MTG / gaia

C++ library to apply similarity measures and classifications on the results of audio analysis, including Python bindings. Together with Essentia it can be used to compute high-level descriptions of music.
http://essentia.upf.edu
GNU Affero General Public License v3.0
271 stars 66 forks source link

Division by zero in .lowlevel.melbands.var when all values are 0 #102

Closed alastair closed 4 years ago

alastair commented 4 years ago

If I take some data files from music extractor and change the precision of the floating point numbers, e.g. from 15dp to 8dp, some numbers are so small already that they get rounded to 0. When this happens, the following error periodically happens when training. Is cleaner automatically applied to all items before passing through other filters, or should we define it explicitly in the project file?

ERROR    ClassificationTask  |  While doing evaluation with param = {'kernel': 'RBF', 'C': -3, 'balanceClasses': False, 'preprocessing': 'normalized', 'type': 'C-SVC', 'classifier': 'svm', 'gamma': -7}
evaluation = [{'type': 'nfoldcrossvalidation', 'nfold': 5}]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gaia2/classification/classificationtask.py", line 204, in <module>
    task.run(*config)
  File "/usr/local/lib/python2.7/dist-packages/gaia2/classification/classificationtask.py", line 187, in run
    confusion = evaluateNfold(evalparam['nfold'], ds, gt, trainerFun, seed=seed, **trainingparam)
  File "/usr/local/lib/python2.7/dist-packages/gaia2/classification/evaluation.py", line 120, in evaluateNfold
    classifier = trainingFunc(trainds, traingt, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gaia2/classification/classifier_SVM.py", line 36, in train_SVM
    ds = transform(ds, 'normalize', { 'independent': True })
  File "/usr/local/lib/python2.7/dist-packages/gaia2/__init__.py", line 6151, in transform
    return analyzer.analyze(dataset).applyToDataSet(dataset)
  File "/usr/local/lib/python2.7/dist-packages/gaia2/__init__.py", line 2912, in analyze
    return _gaia2.Analyzer_analyze(self, *args)
Exception: Normalize: Apply "cleaner" transformation before normalization. Division by zero in .lowlevel.melbands.var
alastair commented 4 years ago

Perhaps this is the same as #47? The error message is different but that might be due to https://github.com/MTG/gaia/commit/a0e1d9f58f592c68e4b1692f023ac124ac78b61a

alastair commented 4 years ago

Duplicate of #47