Commit eb9d22fb authored by Tomas Rokos's avatar Tomas Rokos

Update hyperparams in the dtw classifier

parent 9b092467
......@@ -2,9 +2,9 @@ from audio_classification.classifier.base_classifier import BaseClassifier
import numpy as np
import pandas as pd
from audio_classification.dtwclassifier.distances import euclid
from audio_classification.dtwclassifier.distances import euclid, minkowski
from audio_classification.dtwclassifier.dtw import dtw
from audio_classification.dtwclassifier.ranges import default_range
from audio_classification.dtwclassifier.ranges import default_range, itakura_range
def normalize_matrices(A, B):
......@@ -60,7 +60,8 @@ class DTWClassifier(BaseClassifier):
class DTWClassifierFactory:
@staticmethod
def create():
cls = DTWClassifier()
cls = DTWClassifier(mode=DTWClassifier.MODE_MEAN, range_fn=itakura_range,
dist_fn=lambda x, y: minkowski(x, y, 0), n_compared_songs=15)
df = pd.read_csv('preprocessed_nmfcc_13/data.csv')
cls.fit(df['file'], df['label'])
return cls
......@@ -655,7 +655,70 @@
"text": [
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 5, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 5, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 5, 'range_fn': <function default_range at 0x7fb15a283b00>}\n"
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 5, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 10, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 10, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 10, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 15, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 15, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 15, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 20, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 20, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 20, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 25, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 25, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 25, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 30, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 30, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 30, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 35, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 35, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 35, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 40, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 40, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MEAN', 'n_compared_songs': 40, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 5, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 5, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 5, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 10, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 10, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 10, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 15, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 15, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 15, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 20, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 20, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 20, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 25, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 25, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 25, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 30, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 30, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 30, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 35, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 35, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 35, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 40, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 40, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function manhattan at 0x7fb1335f6200>, 'mode': 'MIN', 'n_compared_songs': 40, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 5, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 5, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 5, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 10, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 10, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 10, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 15, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 15, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 15, 'range_fn': <function default_range at 0x7fb15a283b00>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 20, 'range_fn': <function sakoe_chiba_range at 0x7fb15a283ef0>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 20, 'range_fn': <function itakura_range at 0x7fb15a28f050>}\n",
"{'dist_fn': <function euclid at 0x7fb15a283b90>, 'mode': 'MEAN', 'n_compared_songs': 20, 'range_fn': <function default_range at 0x7fb15a283b00>}\n"
]
}
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment