nkululeko 0.88.5__py3-none-any.whl → 0.88.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nkululeko/constants.py +1 -1
- nkululeko/data/dataset.py +24 -0
- nkululeko/experiment.py +4 -5
- nkululeko/multidb.py +21 -5
- nkululeko/utils/util.py +5 -6
- {nkululeko-0.88.5.dist-info → nkululeko-0.88.7.dist-info}/METADATA +9 -1
- {nkululeko-0.88.5.dist-info → nkululeko-0.88.7.dist-info}/RECORD +10 -10
- {nkululeko-0.88.5.dist-info → nkululeko-0.88.7.dist-info}/WHEEL +1 -1
- {nkululeko-0.88.5.dist-info → nkululeko-0.88.7.dist-info}/LICENSE +0 -0
- {nkululeko-0.88.5.dist-info → nkululeko-0.88.7.dist-info}/top_level.txt +0 -0
nkululeko/constants.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
VERSION="0.88.
|
1
|
+
VERSION="0.88.7"
|
2
2
|
SAMPLING_RATE = 16000
|
nkululeko/data/dataset.py
CHANGED
@@ -423,9 +423,20 @@ class Dataset:
|
|
423
423
|
self.util.debug(f"{self.name}: trying to reuse data splits")
|
424
424
|
self.df_test = pd.read_pickle(storage_test)
|
425
425
|
self.df_train = pd.read_pickle(storage_train)
|
426
|
+
elif isinstance(ast.literal_eval(split_strategy), list):
|
427
|
+
# treat this as a list of test speakers
|
428
|
+
self.assign_speakers(ast.literal_eval(split_strategy))
|
426
429
|
else:
|
427
430
|
self.util.error(f"unknown split strategy: {split_strategy}")
|
428
431
|
|
432
|
+
# check if train or test set should be ignored
|
433
|
+
as_test = eval(self.util.config_val_data(self.name, "as_test", "False"))
|
434
|
+
if as_test:
|
435
|
+
self.df_train = pd.DataFrame()
|
436
|
+
as_train = eval(self.util.config_val_data(self.name, "as_train", "False"))
|
437
|
+
if as_train:
|
438
|
+
self.df_test = pd.DataFrame()
|
439
|
+
|
429
440
|
if self.df_test.shape[0] > 0:
|
430
441
|
self.df_test = self.finish_up(self.df_test, storage_test)
|
431
442
|
if self.df_train.shape[0] > 0:
|
@@ -515,6 +526,19 @@ class Dataset:
|
|
515
526
|
# because this generates new train/test sample quantaties, the feature extraction has to be done again
|
516
527
|
glob_conf.config["FEATS"]["needs_feature_extraction"] = "True"
|
517
528
|
|
529
|
+
def assign_speakers(self, speakers):
|
530
|
+
"""One way to split train and eval sets: Specify test speaker names."""
|
531
|
+
self.df_test = self.df[self.df.speaker.isin(speakers)]
|
532
|
+
if len(self.df_test) == 0:
|
533
|
+
self.util.error(f"no speakers found in {speakers}")
|
534
|
+
self.df_train = self.df[~self.df.index.isin(self.df_test.index)]
|
535
|
+
self.util.debug(
|
536
|
+
f"{self.name} (speakers assigned): [{self.df_train.shape[0]}/{self.df_test.shape[0]}]"
|
537
|
+
" samples in train/test"
|
538
|
+
)
|
539
|
+
# because this generates new train/test sample quantaties, the feature extraction has to be done again
|
540
|
+
glob_conf.config["FEATS"]["needs_feature_extraction"] = "True"
|
541
|
+
|
518
542
|
def split_speakers(self):
|
519
543
|
"""One way to split train and eval sets: Specify percentage of evaluation speakers"""
|
520
544
|
test_percent = int(self.util.config_val_data(self.name, "test_size", 20))
|
nkululeko/experiment.py
CHANGED
@@ -5,13 +5,13 @@ import pickle
|
|
5
5
|
import random
|
6
6
|
import time
|
7
7
|
|
8
|
-
import audeer
|
9
|
-
import audformat
|
10
8
|
import numpy as np
|
11
9
|
import pandas as pd
|
12
10
|
from sklearn.preprocessing import LabelEncoder
|
13
11
|
|
14
|
-
import
|
12
|
+
import audeer
|
13
|
+
import audformat
|
14
|
+
|
15
15
|
from nkululeko.data.dataset import Dataset
|
16
16
|
from nkululeko.data.dataset_csv import Dataset_CSV
|
17
17
|
from nkululeko.demo_predictor import Demo_predictor
|
@@ -19,6 +19,7 @@ from nkululeko.feat_extract.feats_analyser import FeatureAnalyser
|
|
19
19
|
from nkululeko.feature_extractor import FeatureExtractor
|
20
20
|
from nkululeko.file_checker import FileChecker
|
21
21
|
from nkululeko.filter_data import DataFilter
|
22
|
+
import nkululeko.glob_conf as glob_conf
|
22
23
|
from nkululeko.plots import Plots
|
23
24
|
from nkululeko.reporting.report import Report
|
24
25
|
from nkululeko.runmanager import Runmanager
|
@@ -185,9 +186,7 @@ class Experiment:
|
|
185
186
|
f"reusing previously stored {storage_test} and {storage_train}"
|
186
187
|
)
|
187
188
|
self.df_test = self._import_csv(storage_test)
|
188
|
-
# print(f"df_test: {self.df_test}")
|
189
189
|
self.df_train = self._import_csv(storage_train)
|
190
|
-
# print(f"df_train: {self.df_train}")
|
191
190
|
else:
|
192
191
|
self.df_train, self.df_test = pd.DataFrame(), pd.DataFrame()
|
193
192
|
for d in self.datasets.values():
|
nkululeko/multidb.py
CHANGED
@@ -36,6 +36,10 @@ def main(src_dir):
|
|
36
36
|
config.read(config_file)
|
37
37
|
datasets = config["EXP"]["databases"]
|
38
38
|
datasets = ast.literal_eval(datasets)
|
39
|
+
try:
|
40
|
+
use_splits = eval(config["EXP"]["use_splits"])
|
41
|
+
except KeyError:
|
42
|
+
use_splits = False
|
39
43
|
dim = len(datasets)
|
40
44
|
results = np.zeros(dim * dim).reshape([dim, dim])
|
41
45
|
last_epochs = np.zeros(dim * dim).reshape([dim, dim])
|
@@ -72,15 +76,23 @@ def main(src_dir):
|
|
72
76
|
config["DATA"][
|
73
77
|
"databases"
|
74
78
|
] = f"['{train}', '{test}', {extra_trains_1}]"
|
75
|
-
|
76
|
-
|
79
|
+
if use_splits:
|
80
|
+
config["DATA"][f"{test}.as_test"] = "True"
|
81
|
+
config["DATA"][f"{train}.as_train"] = "True"
|
82
|
+
else:
|
83
|
+
config["DATA"][f"{test}.split_strategy"] = "test"
|
84
|
+
config["DATA"][f"{train}.split_strategy"] = "train"
|
77
85
|
extra_trains_2 = ast.literal_eval(extra_trains)
|
78
86
|
for extra_train in extra_trains_2:
|
79
87
|
config["DATA"][f"{extra_train}.split_strategy"] = "train"
|
80
88
|
else:
|
81
89
|
config["DATA"]["databases"] = f"['{train}', '{test}']"
|
82
|
-
|
83
|
-
|
90
|
+
if use_splits:
|
91
|
+
config["DATA"][f"{test}.as_test"] = "True"
|
92
|
+
config["DATA"][f"{train}.as_train"] = "True"
|
93
|
+
else:
|
94
|
+
config["DATA"][f"{test}.split_strategy"] = "test"
|
95
|
+
config["DATA"][f"{train}.split_strategy"] = "train"
|
84
96
|
config["EXP"]["name"] = f"{train}_vs_{test}"
|
85
97
|
|
86
98
|
tmp_config = "tmp.ini"
|
@@ -116,6 +128,8 @@ def plot_heatmap(results, last_epochs, labels, name, config, datasets):
|
|
116
128
|
colsums = results.mean(axis=0)
|
117
129
|
vfunc = np.vectorize(trunc_to_three)
|
118
130
|
colsums = vfunc(colsums)
|
131
|
+
rowsums = results.mean(axis=1)
|
132
|
+
rowsums = vfunc(rowsums)
|
119
133
|
colsums_epochs = last_epochs.mean(axis=0)
|
120
134
|
colsums_epochs = vfunc(colsums_epochs)
|
121
135
|
res_dir = config["EXP"]["root"]
|
@@ -127,7 +141,9 @@ def plot_heatmap(results, last_epochs, labels, name, config, datasets):
|
|
127
141
|
data_s = ", ".join(datasets)
|
128
142
|
text_file.write(f"{data_s}\n")
|
129
143
|
colsums = np.array2string(colsums, separator=", ")
|
130
|
-
text_file.write(f"column
|
144
|
+
text_file.write(f"column means\n{colsums}\n")
|
145
|
+
rowsums = np.array2string(rowsums, separator=", ")
|
146
|
+
text_file.write(f"rows means\n{rowsums}\n")
|
131
147
|
text_file.write("all results\n")
|
132
148
|
text_file.write(repr(results))
|
133
149
|
text_file.write("\n")
|
nkululeko/utils/util.py
CHANGED
@@ -6,13 +6,12 @@ import os.path
|
|
6
6
|
import pickle
|
7
7
|
import sys
|
8
8
|
|
9
|
-
# from sysconfig import get_config_h_filename
|
10
|
-
# from turtle import setup
|
11
|
-
import audeer
|
12
|
-
import audformat
|
13
9
|
import numpy as np
|
14
10
|
import pandas as pd
|
15
11
|
|
12
|
+
import audeer
|
13
|
+
import audformat
|
14
|
+
|
16
15
|
|
17
16
|
class Util:
|
18
17
|
# a list of words that need not to be warned upon if default values are
|
@@ -116,8 +115,8 @@ class Util:
|
|
116
115
|
return dir_name
|
117
116
|
|
118
117
|
def config_val_data(self, dataset, key, default):
|
119
|
-
"""
|
120
|
-
|
118
|
+
"""Retrieve a configuration value for datasets.
|
119
|
+
|
121
120
|
If the value is present in the experiment configuration it will be used, else
|
122
121
|
we look in a global file specified by the root_folders value.
|
123
122
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nkululeko
|
3
|
-
Version: 0.88.
|
3
|
+
Version: 0.88.7
|
4
4
|
Summary: Machine learning audio prediction experiments based on templates
|
5
5
|
Home-page: https://github.com/felixbur/nkululeko
|
6
6
|
Author: Felix Burkhardt
|
@@ -360,6 +360,14 @@ F. Burkhardt, Johannes Wagner, Hagen Wierstorf, Florian Eyben and Björn Schulle
|
|
360
360
|
Changelog
|
361
361
|
=========
|
362
362
|
|
363
|
+
Version 0.88.7
|
364
|
+
--------------
|
365
|
+
* added use_splits for multidb
|
366
|
+
|
367
|
+
Version 0.88.6
|
368
|
+
--------------
|
369
|
+
* added test speaker assign
|
370
|
+
|
363
371
|
Version 0.88.5
|
364
372
|
--------------
|
365
373
|
* add a unique name to the uncertainty plot
|
@@ -2,12 +2,12 @@ nkululeko/__init__.py,sha256=62f8HiEzJ8rG2QlTFJXUCMpvuH3fKI33DoJSj33mscc,63
|
|
2
2
|
nkululeko/aug_train.py,sha256=YhuZnS_WVWnun9G-M6g5n6rbRxoVREz6Zh7k6qprFNQ,3194
|
3
3
|
nkululeko/augment.py,sha256=4MG0apTAG5RgkuJrYEjGgDdbodZWi_HweSPNI1JJ5QA,3051
|
4
4
|
nkululeko/cacheddataset.py,sha256=lIJ6hUo5LoxSrzXtWV8mzwO7wRtUETWnOQ4ws2XfL1E,969
|
5
|
-
nkululeko/constants.py,sha256=
|
5
|
+
nkululeko/constants.py,sha256=p-kvGUZX0J2JPXoROES9PcftVSZ1B1GfzkBt6d8MJhY,39
|
6
6
|
nkululeko/demo.py,sha256=bLuHkeEl5rOfm7ecGHCcWATiPK7-njNbtrGljxzNzFs,5088
|
7
7
|
nkululeko/demo_feats.py,sha256=sAeGFojhEj9WEDFtG3SzPBmyYJWLF2rkbpp65m8Ujo4,2025
|
8
8
|
nkululeko/demo_predictor.py,sha256=zs1bjhpnKuNCPLJeiyDm19ME1NEDOQT3QNeyVKJq9Yc,4882
|
9
9
|
nkululeko/ensemble.py,sha256=rUHg8YmD6L8Ktt2T5M6iwsWVWbpCnfiynhHdN22bLRQ,11873
|
10
|
-
nkululeko/experiment.py,sha256=
|
10
|
+
nkululeko/experiment.py,sha256=L4PzoScPLG2xTyniVy9evcBy_8CIe3RTeTEUVTqiuvQ,31186
|
11
11
|
nkululeko/explore.py,sha256=lDzRoW_Taa5u4BBABZLD89BcQWnYlrftJR4jgt1yyj0,2609
|
12
12
|
nkululeko/export.py,sha256=mHeEAAmtZuxdyebLlbSzPrHSi9OMgJHbk35d3DTxRBc,4632
|
13
13
|
nkululeko/feature_extractor.py,sha256=UnspIWz3XrNhKnBBhWZkH2bHvD-sROtrQVqB1JvkUyw,4088
|
@@ -15,7 +15,7 @@ nkululeko/file_checker.py,sha256=LoLnL8aHpW-axMQ46qbqrManTs5otG9ShpEZuz9iRSk,347
|
|
15
15
|
nkululeko/filter_data.py,sha256=w-X2mhKdYr5DxDIz50E5yzO6Jmzk4jjDBoXsgOOVtcA,7222
|
16
16
|
nkululeko/glob_conf.py,sha256=KL9YJQTHvTztxo1vr25qRRgaPnx4NTg0XrdbovKGMmw,525
|
17
17
|
nkululeko/modelrunner.py,sha256=cKYD9a7MRoBxfqUy3X8kf6rGTYho-33In8I9YkzMOo8,11196
|
18
|
-
nkululeko/multidb.py,sha256=
|
18
|
+
nkululeko/multidb.py,sha256=1X2vZwDHf6HuYKCoIGDP34FECMZ2mcGNZ6-cFYZFnIQ,6332
|
19
19
|
nkululeko/nkuluflag.py,sha256=PGWSmZz-PiiHLgcZJAoGOI_Y-sZDVI1ksB8p5r7riWM,3725
|
20
20
|
nkululeko/nkululeko.py,sha256=Kn3s2E3yyH8cJ7z6lkMxrnqtCxTu7-qfe9Zr_ONTD5g,1968
|
21
21
|
nkululeko/plots.py,sha256=WsI_dtPKfrYPsKymHRmIhqj33aZzTcE8fF_EwLkm_5A,22899
|
@@ -46,7 +46,7 @@ nkululeko/autopredict/ap_stoi.py,sha256=It0Lk-ki-gohA2AzD8nkLAN2WahYvD9rPDGTQuvd
|
|
46
46
|
nkululeko/autopredict/ap_valence.py,sha256=n-hctRKySzhmJtowuMOTUu0T_ld3uK5pnfOzWeWW4VM,1024
|
47
47
|
nkululeko/autopredict/estimate_snr.py,sha256=S-bpS0xFkwWc4Ch75UrjbS8y538lQ0U3g_iLRFXureY,5048
|
48
48
|
nkululeko/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
|
-
nkululeko/data/dataset.py,sha256=
|
49
|
+
nkululeko/data/dataset.py,sha256=xaawk5QthuVStWjHWTFBtorcIe71lbPQgC6mHzSXGeI,29286
|
50
50
|
nkululeko/data/dataset_csv.py,sha256=UGEpi__eT2KFS6Fop6N4HkMrzO-u5VP71gt44kwZavo,4588
|
51
51
|
nkululeko/feat_extract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
52
|
nkululeko/feat_extract/feats_agender.py,sha256=sHyvxxlWXv1QGYXHGHIYEQK7X39eifSVie0tu-zBG3M,3189
|
@@ -106,9 +106,9 @@ nkululeko/segmenting/seg_silero.py,sha256=lLytS38KzARS17omwv8VBw-zz60RVSXGSvZ5Ev
|
|
106
106
|
nkululeko/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
107
107
|
nkululeko/utils/files.py,sha256=UiGAtZRWYjHSvlmPaTMtzyNNGE6qaLaxQkybctS7iRM,4021
|
108
108
|
nkululeko/utils/stats.py,sha256=eC9dMO-by6CDnGLHDBQu-2B4-BudZNJ0nnWGhKYdUMA,2968
|
109
|
-
nkululeko/utils/util.py,sha256=
|
110
|
-
nkululeko-0.88.
|
111
|
-
nkululeko-0.88.
|
112
|
-
nkululeko-0.88.
|
113
|
-
nkululeko-0.88.
|
114
|
-
nkululeko-0.88.
|
109
|
+
nkululeko/utils/util.py,sha256=KMxPzb0HN3XuNzAd7Kn3M3Nq91-0sDrAAEBgDKryCdo,16688
|
110
|
+
nkululeko-0.88.7.dist-info/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
|
111
|
+
nkululeko-0.88.7.dist-info/METADATA,sha256=VKwlkHohr4PJezcmZ45fVykmKmh1T6d2LCDvjR8Ierw,40017
|
112
|
+
nkululeko-0.88.7.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
113
|
+
nkululeko-0.88.7.dist-info/top_level.txt,sha256=DPFNNSHPjUeVKj44dVANAjuVGRCC3MusJ08lc2a8xFA,10
|
114
|
+
nkululeko-0.88.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|