nkululeko 0.81.7__py3-none-any.whl → 0.82.0__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 CHANGED
@@ -1,2 +1,2 @@
1
- VERSION="0.81.7"
1
+ VERSION="0.82.0"
2
2
  SAMPLING_RATE = 16000
nkululeko/multidb.py CHANGED
@@ -12,18 +12,15 @@ import numpy as np
12
12
  import pandas as pd
13
13
  import seaborn as sn
14
14
 
15
- import nkululeko.glob_conf as glob_conf
16
15
  from nkululeko.aug_train import doit as aug_train
17
- from nkululeko.experiment import Experiment
18
16
  from nkululeko.nkululeko import doit as nkulu
19
- from nkululeko.utils.util import Util
20
17
 
21
18
 
22
19
  def main(src_dir):
23
20
  parser = argparse.ArgumentParser(
24
- description="Call the nkululeko MULTIDB framework.")
25
- parser.add_argument("--config", default="exp.ini",
26
- help="The base configuration")
21
+ description="Call the nkululeko MULTIDB framework."
22
+ )
23
+ parser.add_argument("--config", default="exp.ini", help="The base configuration")
27
24
  args = parser.parse_args()
28
25
  if args.config is not None:
29
26
  config_file = args.config
@@ -58,8 +55,7 @@ def main(src_dir):
58
55
  dataset = datasets[i]
59
56
  print(f"running {dataset}")
60
57
  if extra_trains:
61
- extra_trains_1 = extra_trains.removeprefix(
62
- "[").removesuffix("]")
58
+ extra_trains_1 = extra_trains.removeprefix("[").removesuffix("]")
63
59
  config["DATA"]["databases"] = f"['{dataset}', {extra_trains_1}]"
64
60
  extra_trains_2 = ast.literal_eval(extra_trains)
65
61
  for extra_train in extra_trains_2:
@@ -72,8 +68,7 @@ def main(src_dir):
72
68
  test = datasets[j]
73
69
  print(f"running train: {train}, test: {test}")
74
70
  if extra_trains:
75
- extra_trains_1 = extra_trains.removeprefix(
76
- "[").removesuffix("]")
71
+ extra_trains_1 = extra_trains.removeprefix("[").removesuffix("]")
77
72
  config["DATA"][
78
73
  "databases"
79
74
  ] = f"['{train}', '{test}', {extra_trains_1}]"
nkululeko/nkuluflag.py ADDED
@@ -0,0 +1,95 @@
1
+ import argparse
2
+ import configparser
3
+ import os
4
+ import os.path
5
+
6
+ from nkululeko.nkululeko import doit as nkulu
7
+
8
+
9
+ def do_it(src_dir):
10
+ parser = argparse.ArgumentParser(description="Call the nkululeko framework.")
11
+ parser.add_argument("--config", help="The base configuration")
12
+ parser.add_argument("--data", help="The databases", nargs="*", action="append")
13
+ parser.add_argument(
14
+ "--label", nargs="*", help="The labels for the target", action="append"
15
+ )
16
+ parser.add_argument(
17
+ "--tuning_params", nargs="*", help="parameters to be tuned", action="append"
18
+ )
19
+ parser.add_argument(
20
+ "--layers",
21
+ nargs="*",
22
+ help="layer config for mlp, e.g. l1:128 ",
23
+ action="append",
24
+ )
25
+ parser.add_argument("--model", default="xgb", help="The model type")
26
+ parser.add_argument("--feat", default="['os']", help="The feature type")
27
+ parser.add_argument("--set", help="The opensmile set")
28
+ parser.add_argument("--with_os", help="To add os features")
29
+ parser.add_argument("--target", help="The target designation")
30
+ parser.add_argument("--epochs", help="The number of epochs")
31
+ parser.add_argument("--runs", help="The number of runs")
32
+ parser.add_argument("--learning_rate", help="The learning rate")
33
+ parser.add_argument("--drop", help="The dropout rate [0:1]")
34
+
35
+ args = parser.parse_args()
36
+
37
+ if args.config is not None:
38
+ config_file = args.config
39
+ else:
40
+ print("ERROR: need config file")
41
+ quit(-1)
42
+ # test if config is there
43
+ if not os.path.isfile(config_file):
44
+ print(f"ERROR: no such file {config_file}")
45
+
46
+ config = configparser.ConfigParser()
47
+ config.read(config_file)
48
+ # fill the config
49
+
50
+ if args.data is not None:
51
+ databases = []
52
+ for t in args.data:
53
+ databases.append(t[0])
54
+ print(f"got databases: {databases}")
55
+ config["DATA"]["databases"] = str(databases)
56
+ if args.label is not None:
57
+ labels = []
58
+ for label in args.label:
59
+ labels.append(label[0])
60
+ print(f"got labels: {labels}")
61
+ config["DATA"]["labels"] = str(labels)
62
+ if args.tuning_params is not None:
63
+ tuning_params = []
64
+ for tp in args.tuning_params:
65
+ tuning_params.append(tp[0])
66
+ config["MODEL"]["tuning_params"] = str(tuning_params)
67
+ if args.layers is not None:
68
+ config["MODEL"]["layers"] = args.layers[0][0]
69
+ if args.target is not None:
70
+ config["DATA"]["target"] = args.target
71
+ if args.epochs is not None:
72
+ config["EXP"]["epochs"] = args.epochs
73
+ if args.runs is not None:
74
+ config["EXP"]["runs"] = args.runs
75
+ if args.learning_rate is not None:
76
+ config["MODEL"]["learning_rate"] = args.learning_rate
77
+ if args.drop is not None:
78
+ config["MODEL"]["drop"] = args.drop
79
+ if args.model is not None:
80
+ config["MODEL"]["type"] = args.model
81
+ if args.feat is not None:
82
+ config["FEATS"]["type"] = f"['{args.feat}']"
83
+ if args.set is not None:
84
+ config["FEATS"]["set"] = args.set
85
+ tmp_config = "tmp.ini"
86
+ with open(tmp_config, "w") as tmp_file:
87
+ config.write(tmp_file)
88
+
89
+ result, last_epoch = nkulu(tmp_config)
90
+ return result, last_epoch
91
+
92
+
93
+ if __name__ == "__main__":
94
+ cwd = os.path.dirname(os.path.abspath(__file__))
95
+ do_it(cwd) # sys.argv[1])
nkululeko/nkululeko.py CHANGED
@@ -1,12 +1,14 @@
1
1
  # nkululeko.py
2
2
  # Entry script to do a Nkululeko experiment
3
- import numpy as np
4
- import os.path
5
- import configparser
6
3
  import argparse
4
+ import configparser
5
+ import os.path
6
+
7
+ import numpy as np
8
+
9
+ from nkululeko.constants import VERSION
7
10
  import nkululeko.experiment as exp
8
11
  from nkululeko.utils.util import Util
9
- from nkululeko.constants import VERSION
10
12
 
11
13
 
12
14
  def doit(config_file):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nkululeko
3
- Version: 0.81.7
3
+ Version: 0.82.0
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
@@ -42,6 +42,8 @@ Requires-Dist: umap-learn
42
42
  Requires-Dist: xgboost
43
43
  Requires-Dist: pylatex
44
44
 
45
+ usage: nkuluflag.py [-h] [--config CONFIG] [--data [DATA ...]] [--label [LABEL ...]] [--tuning_params [TUNING_PARAMS ...]] [--layers [LAYERS ...]] [--model MODEL] [--feat FEAT] [--set SET]
46
+ [--with_os WITH_OS] [--target TARGET] [--epochs EPOCHS] [--runs RUNS] [--learning_rate LEARNING_RATE] [--drop DROP]
45
47
  - [Overview](#overview)
46
48
  - [Confusion matrix](#confusion-matrix)
47
49
  - [Epoch progression](#epoch-progression)
@@ -203,6 +205,14 @@ All of them take *--config <my_config.ini>* as an argument.
203
205
  * **nkululeko.predict**: [predict features](http://blog.syntheticspeech.de/2023/08/16/nkululeko-how-to-predict-labels-for-your-data-from-existing-models-and-check-them/) like SNR, MOS, arousal/valence, age/gender, with DNN models
204
206
  * **nkululeko.segment**: [segment a database](http://blog.syntheticspeech.de/2023/07/14/nkululeko-segmenting-a-database/) based on VAD (voice activity detection)
205
207
  * **nkululeko.resample**: check on all [sampling rates and change](http://blog.syntheticspeech.de/2023/08/31/how-to-fix-different-sampling-rates-in-a-dataset-with-nkululeko/) to 16kHz
208
+ * **nkululeko.nkuluflag**: a convenient module to specify configuration parameters on the command-line.
209
+ * usage: nkuluflag.py [-h] [--config CONFIG] [--data [DATA ...]] [--label [LABEL ...]] [--tuning_params [TUNING_PARAMS ...]] [--layers [LAYERS ...]] [--model MODEL] [--feat FEAT] [--set SET]
210
+ [--with_os WITH_OS] [--target TARGET] [--epochs EPOCHS] [--runs RUNS] [--learning_rate LEARNING_RATE] [--drop DROP]
211
+
212
+
213
+
214
+
215
+
206
216
 
207
217
  There's my [blog](http://blog.syntheticspeech.de/?s=nkululeko) with tutorials:
208
218
  * [Introduction](http://blog.syntheticspeech.de/2021/08/04/machine-learning-experiment-framework/)
@@ -323,6 +333,10 @@ F. Burkhardt, Johannes Wagner, Hagen Wierstorf, Florian Eyben and Björn Schulle
323
333
  Changelog
324
334
  =========
325
335
 
336
+ Version 0.82.0
337
+ --------------
338
+ * added nkuluflag module
339
+
326
340
  Version 0.81.7
327
341
  --------------
328
342
  * bugfixes
@@ -2,7 +2,7 @@ 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=7yZ6tYUvMMX3FdTsBGzuH-Hgw5ALAhmDCAiKRrOESM0,39
5
+ nkululeko/constants.py,sha256=pJeMUKDoX39rCCwLSX0poKEE1FLIa6YngxfdeUqE_T0,39
6
6
  nkululeko/demo.py,sha256=55kNFA2helMhOxD4yZuKg1JWDtlUUpxm-6uAnroIydI,3264
7
7
  nkululeko/demo_feats.py,sha256=sAeGFojhEj9WEDFtG3SzPBmyYJWLF2rkbpp65m8Ujo4,2025
8
8
  nkululeko/demo_predictor.py,sha256=-ggSHc3DXxRzjzcGB4qFBOMvKsfUdTkkde50BDrS9dA,4755
@@ -14,8 +14,9 @@ nkululeko/file_checker.py,sha256=LoLnL8aHpW-axMQ46qbqrManTs5otG9ShpEZuz9iRSk,347
14
14
  nkululeko/filter_data.py,sha256=w-X2mhKdYr5DxDIz50E5yzO6Jmzk4jjDBoXsgOOVtcA,7222
15
15
  nkululeko/glob_conf.py,sha256=iHiVSxDYgmYwdx6z0HuGUMSWrfZfufPHxHb60q2dLRY,453
16
16
  nkululeko/modelrunner.py,sha256=GuYsmUGSmJ0QxXxR8k0TZ47IDMtdGIMbm5nMq4Ix6tU,9335
17
- nkululeko/multidb.py,sha256=b49C6HjywWgs-GBZgOPufTknL9zBnl5IofSJjUrOIuY,5825
18
- nkululeko/nkululeko.py,sha256=Ty8cdusXUec9BHml8Gsp1r7DXuvIBMFXUckMpzILBnQ,1966
17
+ nkululeko/multidb.py,sha256=fG3VukEWP1vreVN4gB1IRXxwwg4jLftsSEYtu0o1f78,5634
18
+ nkululeko/nkuluflag.py,sha256=FCetTfgH69u4AwENgeCKVi3vBIR10Di67SfbupGQqfc,3354
19
+ nkululeko/nkululeko.py,sha256=Kn3s2E3yyH8cJ7z6lkMxrnqtCxTu7-qfe9Zr_ONTD5g,1968
19
20
  nkululeko/plots.py,sha256=K88ZRPFGX_r03BT742H06Dde20xZYdltv7dxjgUiAFA,23025
20
21
  nkululeko/predict.py,sha256=sF091sSSLnEWcISx9ZcULLie3tY5XeFsQJd6b3vrxFg,2409
21
22
  nkululeko/reporter.py,sha256=mCy8er8z4e5hJ7XbOyy6BgZYZM6Lz-EKXHh4zlT0Zc8,12427
@@ -103,8 +104,8 @@ nkululeko/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
104
  nkululeko/utils/files.py,sha256=UiGAtZRWYjHSvlmPaTMtzyNNGE6qaLaxQkybctS7iRM,4021
104
105
  nkululeko/utils/stats.py,sha256=1yUq0FTOyqkU8TwUocJRYdJaqMU5SlOBBRUun9STo2M,2829
105
106
  nkululeko/utils/util.py,sha256=_Z6OMJ3f-8TdETW9eqJYY5hwNRS5XCt9azzRnqoTTZE,12330
106
- nkululeko-0.81.7.dist-info/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
107
- nkululeko-0.81.7.dist-info/METADATA,sha256=7P8gRtSvPadRGBsWRhT34-Xj8jwkbL7OcLJ__AGtoQs,34981
108
- nkululeko-0.81.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
109
- nkululeko-0.81.7.dist-info/top_level.txt,sha256=DPFNNSHPjUeVKj44dVANAjuVGRCC3MusJ08lc2a8xFA,10
110
- nkululeko-0.81.7.dist-info/RECORD,,
107
+ nkululeko-0.82.0.dist-info/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
108
+ nkululeko-0.82.0.dist-info/METADATA,sha256=TAI5xVQFphXFGnotP-tM4dNQ5GwthtvZbFdWtvYthfo,35801
109
+ nkululeko-0.82.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
110
+ nkululeko-0.82.0.dist-info/top_level.txt,sha256=DPFNNSHPjUeVKj44dVANAjuVGRCC3MusJ08lc2a8xFA,10
111
+ nkululeko-0.82.0.dist-info/RECORD,,