nkululeko 0.95.6__py3-none-any.whl → 0.95.8__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.95.6"
1
+ VERSION="0.95.8"
2
2
  SAMPLING_RATE = 16000
nkululeko/data/dataset.py CHANGED
@@ -294,12 +294,21 @@ class Dataset:
294
294
  # try to get the gender values
295
295
  if "gender" in source_df:
296
296
  df_local["gender"] = source_df["gender"]
297
- got_gender = True
297
+ else:
298
+ # try to get the gender via the speaker description
299
+ gender_map = db['speaker'].get().to_dict()['gender']
300
+ df_local['gender'] = df_local['speaker'].map(gender_map).astype(str)
301
+ got_gender = True
298
302
  except (KeyError, ValueError, audformat.errors.BadKeyError):
299
303
  pass
300
304
  try:
301
305
  # try to get the age values
302
- df_local["age"] = source_df["age"].astype(int)
306
+ if "age" in source_df:
307
+ df_local["age"] = source_df["age"].astype(int)
308
+ else:
309
+ # try to get the age via the speaker description
310
+ age_map = db['speaker'].get().to_dict()['age']
311
+ df_local['age'] = df_local['speaker'].map(age_map).astype(int)
303
312
  got_age = True
304
313
  except (KeyError, ValueError, audformat.errors.BadKeyError):
305
314
  pass
nkululeko/explore.py CHANGED
@@ -65,6 +65,7 @@ def main():
65
65
  try:
66
66
  # load the experiment
67
67
  expr.load(f"{util.get_save_name()}")
68
+ expr.util.set_config(config)
68
69
  needs_feats = True
69
70
  experiment_loaded = True
70
71
  except FileNotFoundError:
nkululeko/plots.py CHANGED
@@ -9,6 +9,7 @@ from scipy import stats
9
9
  import seaborn as sns
10
10
  from sklearn.manifold import TSNE
11
11
 
12
+ import audeer
12
13
  from audmetric import concordance_cc as ccc
13
14
 
14
15
  import nkululeko.glob_conf as glob_conf
@@ -27,7 +28,10 @@ class Plots:
27
28
  self.with_ccc = eval(self.util.config_val("PLOT", "ccc", "False"))
28
29
  self.type_s = "samples"
29
30
 
30
- def plot_distributions_speaker(self, df):
31
+ def plot_distributions_speaker(self, df: pd.DataFrame):
32
+ if df.empty:
33
+ self.util.warn("plot_distributions_speaker: empty DataFrame, nothing to plot")
34
+ return
31
35
  self.type_s = "speaker"
32
36
  df_speakers = pd.DataFrame()
33
37
  pd.options.mode.chained_assignment = None # default='warn'
@@ -86,7 +90,10 @@ class Plots:
86
90
 
87
91
  self.plot_distributions(df_speakers, type_s="speakers")
88
92
 
89
- def plot_distributions(self, df, type_s="samples"):
93
+ def plot_distributions(self, df: pd.DataFrame, type_s: str = "samples"):
94
+ if df.empty:
95
+ self.util.warn("plot_distributions: empty DataFrame, nothing to plot")
96
+ return
90
97
  class_label, df = self._check_binning("class_label", df)
91
98
  value_counts_conf = self.util.config_val("EXPL", "value_counts", False)
92
99
  if not isinstance(value_counts_conf, str):
@@ -218,7 +225,7 @@ class Plots:
218
225
 
219
226
  def save_plot(self, ax, caption, header, filename, type_s):
220
227
  # one up because of the runs
221
- fig_dir = os.path.dirname(self.util.get_path("fig_dir"))
228
+ fig_dir = audeer.path(self.util.get_path("fig_dir"), "..")
222
229
  fig_plots = ax.figure
223
230
  # avoid warning
224
231
  # plt.tight_layout()
nkululeko/utils/util.py CHANGED
@@ -189,8 +189,11 @@ class Util:
189
189
 
190
190
  def is_categorical(self, pd_series):
191
191
  """Check if a dataframe column is categorical."""
192
- return pd_series.dtype.name == "object" or isinstance(
193
- pd_series.dtype, pd.CategoricalDtype
192
+ return (
193
+ pd_series.dtype.name == "object"
194
+ or pd_series.dtype.name == "bool"
195
+ or isinstance(pd_series.dtype, pd.CategoricalDtype)
196
+ or isinstance(pd_series.dtype, pd.BooleanDtype)
194
197
  )
195
198
 
196
199
  def get_name(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nkululeko
3
- Version: 0.95.6
3
+ Version: 0.95.8
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
@@ -4,14 +4,14 @@ nkululeko/aug_train.py,sha256=wpiHCJ7zsW38kumg3ypwXZe2HQrhUblAnv7P2QeJnAc,3525
4
4
  nkululeko/augment.py,sha256=3RzaxB3gRxovgJVjHXi0glprW01J7RaHhUkqotW2T3U,2955
5
5
  nkululeko/balance.py,sha256=r7opXbrqAipm2euPPaOmLlA5J10p2bHQgO5kWk2x9ro,8702
6
6
  nkululeko/cacheddataset.py,sha256=XFpWZmbJRg0pvhnIgYf0TkclxllD-Fctu-Ol0PF_00c,969
7
- nkululeko/constants.py,sha256=jC8e4ENKUF9damz-8BUpeu-yQdmouspc5ZJsg5VwyJs,39
7
+ nkululeko/constants.py,sha256=9cVRluLqakiiCBPe3kAeJizsgpn2LUbgdAs0Y9scIEM,39
8
8
  nkululeko/demo-ft.py,sha256=iD9Pzp9QjyAv31q1cDZ75vPez7Ve8A4Cfukv5yfZdrQ,770
9
9
  nkululeko/demo.py,sha256=tu7Al2l5MCLVegkDC-NE2wcuc_YE7NRbgOlPW3yhGEs,4940
10
10
  nkululeko/demo_feats.py,sha256=BvZjeNFTlERIRlq34OHM4Z96jdDQAhB01BGQAUcX9dM,2026
11
11
  nkululeko/demo_predictor.py,sha256=lDF-xOxRdEAclOmbepAYg-BQXQdGkHfq2n74PTIoop8,4872
12
12
  nkululeko/ensemble.py,sha256=71V-rre61H3J4sh7lu-OTo4I2_g7mm_rQxwW1ARDHgY,12782
13
13
  nkululeko/experiment.py,sha256=BAc220lktt_tvifl-m-ZIPO7Nwi-HzDBNyTfjPDbQkE,38397
14
- nkululeko/explore.py,sha256=aDVHwuo-lkih7VZrbb_zFKg5fowSrAIcx0V9wf0SRGo,4175
14
+ nkululeko/explore.py,sha256=PjNcLuPdvWqCqYXUvGhd0hBijIhzdyi3ED1RF6o5Gjk,4212
15
15
  nkululeko/export.py,sha256=U-V4acxtuL6qKt6oAsVcM5TTeWogYUJ3GU-lA6rq6d4,4336
16
16
  nkululeko/feature_extractor.py,sha256=CsKmBoxwNClRGu20ox_eCxMG4u_1OH8Y83FYw7GfUwA,4230
17
17
  nkululeko/file_checker.py,sha256=xJY0Q6w47pnmgJVK5rcAKPYBrCpV7eBT4_3YBzTx-H8,3454
@@ -24,7 +24,7 @@ nkululeko/nkuluflag.py,sha256=_83LqLr2bSHjnVJuPeSAHCIyuiIbRxgpFKW6CwanWFM,3728
24
24
  nkululeko/nkululeko.py,sha256=6ALPMMIz6l0O3IRaP0q4b59ZUxpfzNqLQUqZMf5t3Zo,1976
25
25
  nkululeko/optim.py,sha256=Pn_02irXYJJmNG1yWA9GImHirpbXXywV61MalZb2wVA,1658
26
26
  nkululeko/optimizationrunner.py,sha256=UfWU_gOPaHUVjvYaw3AoF9HoDGYxIjbCyTGmi1PVu3s,44283
27
- nkululeko/plots.py,sha256=lUxgyoriYTwdpHZvBBQ4e41v77deQrt0PcRDLJWijys,27503
27
+ nkululeko/plots.py,sha256=DnTJHmz50vphnTiazCy2J6k0wP0-MRWir7gj7i_WKXM,27808
28
28
  nkululeko/predict.py,sha256=PWv1Pc39lrxqqIWrYszVk5SL37dDL93CHgcruItNID8,2211
29
29
  nkululeko/resample.py,sha256=rn3-M1A-iwVGibfQNGyeYNa7briD24lIN9Szq_1uTJo,5194
30
30
  nkululeko/runmanager.py,sha256=YtGQP0UyyQTKkilncB1XYM-T8oatzGcZEOcj5SorjJw,8902
@@ -58,7 +58,7 @@ nkululeko/autopredict/whisper_transcriber.py,sha256=DWDvpRaV5KmUF18ojPEvxnVXm_h_
58
58
  nkululeko/autopredict/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  nkululeko/autopredict/tests/test_whisper_transcriber.py,sha256=ilas6j3OUvq_xnQCRZgytQCtyrpNU6tvG5a8kPvVKBQ,5085
60
60
  nkululeko/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
- nkululeko/data/dataset.py,sha256=2-I7d91M9f296SANYiL4eTZmcXKs-nj1vqsUEXpp-cA,42461
61
+ nkululeko/data/dataset.py,sha256=uj4rtcAoiEUpoZv8dlgrdzBuUdFrXtU7Pai6wSHY2xU,42997
62
62
  nkululeko/data/dataset_csv.py,sha256=AIbtB6pGk5BSQGIgfokZ7tEGFjmuOq5w2XumRSimVWs,4833
63
63
  nkululeko/feat_extract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  nkululeko/feat_extract/feats_agender.py,sha256=onfAQ6-xx_mFMJXEF1IX8cHBmGtGeX6weJmxbkfh1_o,3184
@@ -133,10 +133,10 @@ nkululeko/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
133
  nkululeko/utils/files.py,sha256=SrrYaU7AB80MZHiV1jcB0h_zigvYLYgSVNTXV4ao38g,4593
134
134
  nkululeko/utils/stats.py,sha256=3Fyx8q8BSKYmiufT6OkRug9RATWmGrr9BaX_y8jziWo,3074
135
135
  nkululeko/utils/unzip.py,sha256=G68f5120TjwACZC3bQcneMniddnwubPbBdMc2L5KBOo,1206
136
- nkululeko/utils/util.py,sha256=yHgzfj-8ncgCvyrrrH_NDWCh6VmhAqVYY6Vlgyg-c6E,18585
137
- nkululeko-0.95.6.dist-info/licenses/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
138
- nkululeko-0.95.6.dist-info/METADATA,sha256=fNK6XplFh2R-uBVMhUR9R4XhIp3Ebx8SX0BUZ8Cldvk,21998
139
- nkululeko-0.95.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
140
- nkululeko-0.95.6.dist-info/entry_points.txt,sha256=lNTkFEdh6Kjo5o95ZAWf_0Lq-4ztGoAoMVSDuPtuyS0,442
141
- nkululeko-0.95.6.dist-info/top_level.txt,sha256=bf1k1YKkqcXemNX_cUgoyKqQ3_GVErPqAY-53J36jkM,19
142
- nkululeko-0.95.6.dist-info/RECORD,,
136
+ nkululeko/utils/util.py,sha256=s7Hd7Ju1r3_WCw8gLD9YK4O6k3S_WhFcN2-XZBSctSM,18705
137
+ nkululeko-0.95.8.dist-info/licenses/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
138
+ nkululeko-0.95.8.dist-info/METADATA,sha256=ye2EpYXgbMMRD1L1KnUqjbFO5W7--glJKj-1yBmHCX8,21998
139
+ nkululeko-0.95.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
140
+ nkululeko-0.95.8.dist-info/entry_points.txt,sha256=lNTkFEdh6Kjo5o95ZAWf_0Lq-4ztGoAoMVSDuPtuyS0,442
141
+ nkululeko-0.95.8.dist-info/top_level.txt,sha256=bf1k1YKkqcXemNX_cUgoyKqQ3_GVErPqAY-53J36jkM,19
142
+ nkululeko-0.95.8.dist-info/RECORD,,