nkululeko 0.94.2__py3-none-any.whl → 0.95.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/augmenting/resampler.py +25 -14
- nkululeko/autopredict/ap_emotion.py +36 -0
- nkululeko/autopredict/ap_text.py +45 -0
- nkululeko/autopredict/whisper_transcriber.py +81 -0
- nkululeko/constants.py +1 -1
- nkululeko/experiment.py +53 -3
- nkululeko/explore.py +32 -13
- nkululeko/feat_extract/feats_analyser.py +45 -17
- nkululeko/feat_extract/feats_emotion2vec.py +51 -26
- nkululeko/feat_extract/feinberg_praat.py +515 -372
- nkululeko/glob_conf.py +9 -0
- nkululeko/modelrunner.py +15 -6
- nkululeko/models/model_tuned.py +416 -84
- nkululeko/models/model_xgb.py +149 -3
- nkululeko/plots.py +25 -19
- nkululeko/predict.py +6 -5
- nkululeko/reporting/report.py +7 -5
- nkululeko/reporting/reporter.py +8 -5
- nkululeko/runmanager.py +1 -1
- nkululeko/utils/util.py +34 -2
- {nkululeko-0.94.2.dist-info → nkululeko-0.95.0.dist-info}/METADATA +1 -1
- {nkululeko-0.94.2.dist-info → nkululeko-0.95.0.dist-info}/RECORD +26 -23
- {nkululeko-0.94.2.dist-info → nkululeko-0.95.0.dist-info}/WHEEL +0 -0
- {nkululeko-0.94.2.dist-info → nkululeko-0.95.0.dist-info}/entry_points.txt +0 -0
- {nkululeko-0.94.2.dist-info → nkululeko-0.95.0.dist-info}/licenses/LICENSE +0 -0
- {nkululeko-0.94.2.dist-info → nkululeko-0.95.0.dist-info}/top_level.txt +0 -0
nkululeko/models/model_xgb.py
CHANGED
@@ -1,18 +1,164 @@
|
|
1
|
-
#
|
1
|
+
# model_xgb.py
|
2
2
|
|
3
|
+
import os
|
3
4
|
from xgboost import XGBClassifier
|
4
5
|
|
6
|
+
import nkululeko.glob_conf as glob_conf
|
5
7
|
from nkululeko.models.model import Model
|
6
8
|
|
7
9
|
|
8
10
|
class XGB_model(Model):
|
9
|
-
"""An XGBoost model"""
|
11
|
+
"""An XGBoost model with early stopping support"""
|
10
12
|
|
11
13
|
def __init__(self, df_train, df_test, feats_train, feats_test):
|
12
14
|
super().__init__(df_train, df_test, feats_train, feats_test)
|
13
15
|
self.name = "xgb"
|
14
16
|
self.is_classifier = True
|
15
|
-
|
17
|
+
|
18
|
+
# Configure XGBoost parameters
|
19
|
+
xgb_params = {}
|
20
|
+
|
21
|
+
# Get early stopping configuration
|
22
|
+
self.early_stopping_rounds = self.util.config_val(
|
23
|
+
"MODEL", "early_stopping_rounds", False
|
24
|
+
)
|
25
|
+
self.eval_metric = self.util.config_val("MODEL", "eval_metric", "logloss")
|
26
|
+
|
27
|
+
# Set up other XGBoost parameters that can be configured
|
28
|
+
n_estimators = self.util.config_val("MODEL", "n_estimators", 100)
|
29
|
+
max_depth = self.util.config_val("MODEL", "max_depth", 6)
|
30
|
+
learning_rate = self.util.config_val("MODEL", "learning_rate", 0.3)
|
31
|
+
subsample = self.util.config_val("MODEL", "subsample", 1.0)
|
32
|
+
|
33
|
+
xgb_params["n_estimators"] = int(n_estimators)
|
34
|
+
xgb_params["max_depth"] = int(max_depth)
|
35
|
+
xgb_params["learning_rate"] = float(learning_rate)
|
36
|
+
xgb_params["subsample"] = float(subsample)
|
37
|
+
|
38
|
+
# Set random state for reproducibility
|
39
|
+
xgb_params["random_state"] = 42
|
40
|
+
|
41
|
+
# Add early stopping parameters to model initialization if configured
|
42
|
+
if self.early_stopping_rounds:
|
43
|
+
xgb_params["early_stopping_rounds"] = int(self.early_stopping_rounds)
|
44
|
+
xgb_params["eval_metric"] = self.eval_metric
|
45
|
+
|
46
|
+
# Initialize classifier with parameters
|
47
|
+
self.clf = XGBClassifier(**xgb_params)
|
48
|
+
|
49
|
+
def train(self):
|
50
|
+
"""Train the XGBoost model with optional early stopping."""
|
51
|
+
# Check if NANs in features and handle them
|
52
|
+
if self.feats_train.isna().to_numpy().any():
|
53
|
+
self.util.debug(
|
54
|
+
"Model, train: replacing"
|
55
|
+
f" {self.feats_train.isna().sum().sum()} NANs with 0"
|
56
|
+
)
|
57
|
+
self.feats_train = self.feats_train.fillna(0)
|
58
|
+
|
59
|
+
feats = self.feats_train.to_numpy()
|
60
|
+
labels = self.df_train[self.target]
|
61
|
+
|
62
|
+
# Configure fitting parameters
|
63
|
+
fit_params = {}
|
64
|
+
|
65
|
+
# Check if early stopping is configured
|
66
|
+
if self.early_stopping_rounds:
|
67
|
+
# Check if we're in split3 mode (train/dev/test) where validation data is available
|
68
|
+
import ast
|
69
|
+
|
70
|
+
split3 = ast.literal_eval(
|
71
|
+
self.util.config_val("EXP", "traindevtest", "False")
|
72
|
+
)
|
73
|
+
|
74
|
+
if split3 and self.feats_test is not None and self.df_test is not None:
|
75
|
+
# In split3 mode, self.feats_test and self.df_test are actually the dev set
|
76
|
+
feats_dev = self.feats_test.to_numpy()
|
77
|
+
labels_dev = self.df_test[self.target]
|
78
|
+
|
79
|
+
# Handle NANs in dev features
|
80
|
+
if self.feats_test.isna().to_numpy().any():
|
81
|
+
self.util.debug(
|
82
|
+
"Model, dev: replacing"
|
83
|
+
f" {self.feats_test.isna().sum().sum()} NANs with 0"
|
84
|
+
)
|
85
|
+
feats_dev = self.feats_test.fillna(0).to_numpy()
|
86
|
+
|
87
|
+
# Set up early stopping with validation data
|
88
|
+
eval_set = [(feats, labels), (feats_dev, labels_dev)]
|
89
|
+
fit_params["eval_set"] = eval_set
|
90
|
+
fit_params["verbose"] = True
|
91
|
+
|
92
|
+
self.util.debug(
|
93
|
+
f"Training XGBoost with early stopping (using dev set):"
|
94
|
+
)
|
95
|
+
self.util.debug(
|
96
|
+
f" - early_stopping_rounds: {self.early_stopping_rounds}"
|
97
|
+
)
|
98
|
+
self.util.debug(f" - eval_metric: {self.eval_metric}")
|
99
|
+
self.util.debug(f" - validation set size: {feats_dev.shape[0]}")
|
100
|
+
else:
|
101
|
+
# For train/test split only: use a portion of training data for validation
|
102
|
+
from sklearn.model_selection import train_test_split
|
103
|
+
|
104
|
+
# Get validation split ratio (default 0.2 = 20% of training data)
|
105
|
+
val_split = float(
|
106
|
+
self.util.config_val("MODEL", "validation_split", 0.2)
|
107
|
+
)
|
108
|
+
|
109
|
+
# Split training data into train and validation
|
110
|
+
feats_train_split, feats_val, labels_train_split, labels_val = (
|
111
|
+
train_test_split(
|
112
|
+
feats,
|
113
|
+
labels,
|
114
|
+
test_size=val_split,
|
115
|
+
random_state=42,
|
116
|
+
stratify=labels,
|
117
|
+
)
|
118
|
+
)
|
119
|
+
|
120
|
+
# Set up early stopping with validation split
|
121
|
+
eval_set = [
|
122
|
+
(feats_train_split, labels_train_split),
|
123
|
+
(feats_val, labels_val),
|
124
|
+
]
|
125
|
+
fit_params["eval_set"] = eval_set
|
126
|
+
fit_params["verbose"] = True
|
127
|
+
|
128
|
+
# Use the split training data for actual training
|
129
|
+
feats = feats_train_split
|
130
|
+
labels = labels_train_split
|
131
|
+
|
132
|
+
self.util.debug(
|
133
|
+
f"Training XGBoost with early stopping (using validation split):"
|
134
|
+
)
|
135
|
+
self.util.debug(
|
136
|
+
f" - early_stopping_rounds: {self.early_stopping_rounds}"
|
137
|
+
)
|
138
|
+
self.util.debug(f" - eval_metric: {self.eval_metric}")
|
139
|
+
self.util.debug(f" - validation_split: {val_split}")
|
140
|
+
self.util.debug(f" - training set size: {feats_train_split.shape[0]}")
|
141
|
+
self.util.debug(f" - validation set size: {feats_val.shape[0]}")
|
142
|
+
|
143
|
+
# Handle class weights if configured
|
144
|
+
class_weight = self.util.config_val("MODEL", "class_weight", False)
|
145
|
+
if class_weight:
|
146
|
+
import sklearn.utils.class_weight
|
147
|
+
|
148
|
+
self.util.debug("using class weight")
|
149
|
+
classes_weights = sklearn.utils.class_weight.compute_sample_weight(
|
150
|
+
class_weight="balanced", y=labels
|
151
|
+
)
|
152
|
+
fit_params["sample_weight"] = classes_weights
|
153
|
+
|
154
|
+
# Train the model
|
155
|
+
self.clf.fit(feats, labels, **fit_params)
|
156
|
+
|
157
|
+
# Log information about the trained model
|
158
|
+
if hasattr(self.clf, "best_iteration"):
|
159
|
+
self.util.debug(f"Best iteration: {self.clf.best_iteration}")
|
160
|
+
if hasattr(self.clf, "best_score"):
|
161
|
+
self.util.debug(f"Best score: {self.clf.best_score}")
|
16
162
|
|
17
163
|
def get_type(self):
|
18
164
|
return "xgb"
|
nkululeko/plots.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# plots.py
|
2
2
|
import ast
|
3
|
+
import os
|
3
4
|
|
4
5
|
import matplotlib.pyplot as plt
|
5
6
|
import numpy as np
|
@@ -87,9 +88,10 @@ class Plots:
|
|
87
88
|
|
88
89
|
def plot_distributions(self, df, type_s="samples"):
|
89
90
|
class_label, df = self._check_binning("class_label", df)
|
90
|
-
|
91
|
-
|
92
|
-
|
91
|
+
value_counts_conf = self.util.config_val("EXPL", "value_counts", False)
|
92
|
+
if not isinstance(value_counts_conf, str):
|
93
|
+
value_counts_conf = str(value_counts_conf)
|
94
|
+
attributes = ast.literal_eval(value_counts_conf)
|
93
95
|
# always plot the distribution of the main attribute
|
94
96
|
filename = f"{class_label}_distribution"
|
95
97
|
if self.util.is_categorical(df[class_label]):
|
@@ -216,11 +218,11 @@ class Plots:
|
|
216
218
|
|
217
219
|
def save_plot(self, ax, caption, header, filename, type_s):
|
218
220
|
# one up because of the runs
|
219
|
-
fig_dir = self.util.get_path("fig_dir")
|
221
|
+
fig_dir = os.path.dirname(self.util.get_path("fig_dir"))
|
220
222
|
fig_plots = ax.figure
|
221
223
|
# avoid warning
|
222
224
|
# plt.tight_layout()
|
223
|
-
img_path = f"{
|
225
|
+
img_path = os.path.join(fig_dir, f"{filename}_{type_s}.{self.format}")
|
224
226
|
plt.savefig(img_path)
|
225
227
|
plt.close(fig_plots)
|
226
228
|
self.util.debug(f"Saved plot to {img_path}")
|
@@ -359,7 +361,7 @@ class Plots:
|
|
359
361
|
|
360
362
|
def plot_durations(self, df, filename, sample_selection, caption=""):
|
361
363
|
# one up because of the runs
|
362
|
-
fig_dir = self.util.get_path("fig_dir")
|
364
|
+
fig_dir = os.path.join(self.util.get_path("fig_dir"), "..")
|
363
365
|
try:
|
364
366
|
ax = sns.histplot(df, x="duration", hue="class_label", kde=True)
|
365
367
|
except AttributeError as ae:
|
@@ -376,7 +378,7 @@ class Plots:
|
|
376
378
|
ax.set_ylabel("number of samples")
|
377
379
|
fig = ax.figure
|
378
380
|
# plt.tight_layout()
|
379
|
-
img_path = f"{
|
381
|
+
img_path = os.path.join(fig_dir, f"{filename}_{sample_selection}.{self.format}")
|
380
382
|
plt.savefig(img_path)
|
381
383
|
plt.close(fig)
|
382
384
|
self.util.debug(f"plotted durations to {img_path}")
|
@@ -393,14 +395,14 @@ class Plots:
|
|
393
395
|
filename = "speakers"
|
394
396
|
caption = "speakers"
|
395
397
|
# one up because of the runs
|
396
|
-
fig_dir = self.util.get_path("fig_dir")
|
398
|
+
fig_dir = os.path.join(self.util.get_path("fig_dir"), "..")
|
397
399
|
sns.set_style("whitegrid") # Set style for chart
|
398
400
|
ax = df["speaker"].value_counts().plot(kind="pie", autopct="%1.1f%%")
|
399
401
|
title = f"Speaker distr. for {sample_selection} {df.shape[0]}."
|
400
402
|
ax.set_title(title)
|
401
403
|
fig = ax.figure
|
402
404
|
# plt.tight_layout()
|
403
|
-
img_path = f"{
|
405
|
+
img_path = os.path.join(fig_dir, f"{filename}_{sample_selection}.{self.format}")
|
404
406
|
plt.savefig(img_path)
|
405
407
|
plt.close(fig)
|
406
408
|
self.util.debug(f"plotted speakers to {img_path}")
|
@@ -415,7 +417,7 @@ class Plots:
|
|
415
417
|
|
416
418
|
def describe_df(self, name, df, target, filename):
|
417
419
|
"""Make a stacked barplot of samples and speakers per sex and target values. speaker, gender and target columns must be present"""
|
418
|
-
fig_dir = self.util.get_path("fig_dir") + "../" # one up because of the runs
|
420
|
+
fig_dir = self.util.get_path("fig_dir") # + "../" # one up because of the runs
|
419
421
|
sampl_num = df.shape[0]
|
420
422
|
sex_col = "gender"
|
421
423
|
if target == "gender":
|
@@ -447,7 +449,7 @@ class Plots:
|
|
447
449
|
kind="bar", ax=axes, title=f"samples ({sampl_num})"
|
448
450
|
)
|
449
451
|
# plt.tight_layout()
|
450
|
-
img_path = f"{
|
452
|
+
img_path = os.path.join(fig_dir, f"{filename}.{self.format}")
|
451
453
|
plt.savefig(img_path)
|
452
454
|
fig.clear()
|
453
455
|
plt.close(fig)
|
@@ -462,11 +464,12 @@ class Plots:
|
|
462
464
|
|
463
465
|
def scatter_plot(self, feats, label_df, label, dimred_type):
|
464
466
|
dim_num = int(self.util.config_val("EXPL", "scatter.dim", 2))
|
465
|
-
# one up because of the runs
|
466
|
-
fig_dir = self.util.get_path("fig_dir")
|
467
|
+
# one up because of the runs (for explore module)
|
468
|
+
fig_dir = os.path.join(self.util.get_path("fig_dir"), "..")
|
467
469
|
sample_selection = self.util.config_val("EXPL", "sample_selection", "all")
|
468
|
-
|
469
|
-
filename = f"{
|
470
|
+
exp_name = self.util.get_name()
|
471
|
+
filename = f"{label}_{exp_name}_{self.util.get_feattype_name()}_{sample_selection}_{dimred_type}_{str(dim_num)}d"
|
472
|
+
filename = os.path.join(fig_dir, f"{filename}.{self.format}")
|
470
473
|
self.util.debug(f"computing {dimred_type}, this might take a while...")
|
471
474
|
data = None
|
472
475
|
labels = label_df[label]
|
@@ -573,6 +576,7 @@ class Plots:
|
|
573
576
|
self.util.error(f"wrong dimension number: {dim_num}")
|
574
577
|
fig = ax.figure
|
575
578
|
plt.savefig(filename)
|
579
|
+
self.util.debug(f"plotted {dimred_type} scatter plot to {filename}")
|
576
580
|
fig.clear()
|
577
581
|
plt.close(fig)
|
578
582
|
glob_conf.report.add_item(
|
@@ -599,8 +603,10 @@ class Plots:
|
|
599
603
|
# remove fullstops in the name
|
600
604
|
feature_name = feature.replace(".", "-")
|
601
605
|
# one up because of the runs
|
602
|
-
fig_dir = self.util.get_path("fig_dir")
|
603
|
-
filename =
|
606
|
+
fig_dir = os.path.join(self.util.get_path("fig_dir"), "..")
|
607
|
+
filename = os.path.join(
|
608
|
+
fig_dir, f"feat_dist_{title}_{feature_name}.{self.format}"
|
609
|
+
)
|
604
610
|
if self.util.is_categorical(df_labels[label]):
|
605
611
|
df_plot = pd.DataFrame(
|
606
612
|
{label: df_labels[label], feature: df_features[feature]}
|
@@ -647,9 +653,9 @@ class Plots:
|
|
647
653
|
# plt.tight_layout()
|
648
654
|
# print(ax)
|
649
655
|
# one up because of the runs
|
650
|
-
fig_dir = self.util.get_path("fig_dir")
|
656
|
+
fig_dir = os.path.join(self.util.get_path("fig_dir"), "..")
|
651
657
|
exp_name = self.util.get_exp_name(only_data=True)
|
652
|
-
filename = f"{
|
658
|
+
filename = os.path.join(fig_dir, f"{exp_name}EXPL_tree-plot.{self.format}")
|
653
659
|
fig = ax.figure
|
654
660
|
fig.savefig(filename)
|
655
661
|
fig.clear()
|
nkululeko/predict.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# predict.py
|
2
|
-
# use some model and add automatically predicted labels
|
3
|
-
# then save as a new dataset
|
2
|
+
# use some model and add automatically predicted labels
|
3
|
+
# also can labels train and test splits then save as a new dataset
|
4
4
|
|
5
|
-
r"""This script is used to call the nkululeko PREDICT
|
5
|
+
r"""This script is used to call the nkululeko PREDICT module.
|
6
6
|
|
7
7
|
It loads a configuration file, creates a new experiment,
|
8
8
|
and performs automatic prediction on the train and test datasets. The predicted labels are added to the datasets and
|
@@ -60,9 +60,10 @@ def main():
|
|
60
60
|
if "class_label" in df.columns:
|
61
61
|
df = df.drop(columns=[target])
|
62
62
|
df = df.rename(columns={"class_label": target})
|
63
|
-
|
63
|
+
sample_selection = util.config_val("PREDICT", "sample_selection", "all")
|
64
|
+
name = f"{sample_selection}_predicted"
|
64
65
|
df.to_csv(f"{expr.data_dir}/{name}.csv")
|
65
|
-
util.debug(f"saved {
|
66
|
+
util.debug(f"saved {os.path.join(expr.data_dir, name)}.csv")
|
66
67
|
print("DONE")
|
67
68
|
|
68
69
|
|
nkululeko/reporting/report.py
CHANGED
@@ -5,7 +5,6 @@ Collector class for report items collected during module processing.
|
|
5
5
|
|
6
6
|
"""
|
7
7
|
|
8
|
-
from nkululeko.reporting.latex_writer import LatexWriter
|
9
8
|
from nkululeko.utils.util import Util
|
10
9
|
|
11
10
|
|
@@ -31,7 +30,10 @@ class Report:
|
|
31
30
|
print("\t" + c.contents)
|
32
31
|
|
33
32
|
def export_latex(self):
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
if str(self.util.config_val("REPORT", "show", "False")).lower() == "true":
|
34
|
+
from nkululeko.reporting.latex_writer import LatexWriter
|
35
|
+
|
36
|
+
lw = LatexWriter()
|
37
|
+
for topic in self.report_items:
|
38
|
+
lw.add_items_for_section(topic, self.report_items[topic])
|
39
|
+
lw.finish_doc()
|
nkululeko/reporting/reporter.py
CHANGED
@@ -152,11 +152,14 @@ class Reporter:
|
|
152
152
|
probas["truth"] = self.truths
|
153
153
|
try:
|
154
154
|
le = glob_conf.label_encoder
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
155
|
+
if le is not None:
|
156
|
+
mapping = dict(zip(le.classes_, range(len(le.classes_))))
|
157
|
+
mapping_reverse = {value: key for key, value in mapping.items()}
|
158
|
+
probas = probas.rename(columns=mapping_reverse)
|
159
|
+
probas["predicted"] = probas["predicted"].map(mapping_reverse)
|
160
|
+
probas["truth"] = probas["truth"].map(mapping_reverse)
|
161
|
+
else:
|
162
|
+
self.util.debug("Label encoder is None, skipping label mapping")
|
160
163
|
except AttributeError as ae:
|
161
164
|
self.util.debug(f"Can't label categories: {ae}")
|
162
165
|
# compute entropy per sample
|
nkululeko/runmanager.py
CHANGED
@@ -181,7 +181,7 @@ class Runmanager:
|
|
181
181
|
"""
|
182
182
|
# self.load_model(report)
|
183
183
|
# report = self.model.predict()
|
184
|
-
self.util.debug(f"plotting conf matrix
|
184
|
+
self.util.debug(f"plotting conf matrix as {plot_name}")
|
185
185
|
report.plot_confmatrix(plot_name, epoch=report.epoch)
|
186
186
|
report.print_results(report.epoch, file_name=plot_name)
|
187
187
|
report.print_probabilities(file_name=plot_name)
|
nkululeko/utils/util.py
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# util.py
|
2
2
|
import ast
|
3
3
|
import configparser
|
4
|
+
import json
|
4
5
|
import logging
|
5
6
|
import os.path
|
6
7
|
import pickle
|
7
8
|
import sys
|
8
9
|
|
9
|
-
import audeer
|
10
|
-
import audformat
|
11
10
|
import numpy as np
|
12
11
|
import pandas as pd
|
13
12
|
|
13
|
+
import audeer
|
14
|
+
import audformat
|
15
|
+
|
14
16
|
|
15
17
|
class Util:
|
16
18
|
# a list of words that need not to be warned upon if default values are
|
@@ -92,6 +94,8 @@ class Util:
|
|
92
94
|
dir_name = "./results/"
|
93
95
|
elif entry == "model_dir":
|
94
96
|
dir_name = "./models/"
|
97
|
+
elif entry == "cache":
|
98
|
+
dir_name = "./cache/"
|
95
99
|
else:
|
96
100
|
dir_name = "./store/"
|
97
101
|
else:
|
@@ -107,6 +111,8 @@ class Util:
|
|
107
111
|
entryn = "./results/"
|
108
112
|
elif entry == "model_dir":
|
109
113
|
entryn = "./models/"
|
114
|
+
elif entry == "cache":
|
115
|
+
entryn = "./cache/"
|
110
116
|
else:
|
111
117
|
entryn = "./store/"
|
112
118
|
|
@@ -328,6 +334,7 @@ class Util:
|
|
328
334
|
self.logger.warning(f"WARNING: {self.caller}: {message}")
|
329
335
|
else:
|
330
336
|
print(f"WARNING: {message}")
|
337
|
+
|
331
338
|
def debug(self, message):
|
332
339
|
if self.logger is not None:
|
333
340
|
self.logger.debug(f"DEBUG: {self.caller}: {message}")
|
@@ -505,3 +512,28 @@ class Util:
|
|
505
512
|
def to_3_digits_str(self, x):
|
506
513
|
"""Given a float, return this to 3 digits as string without integer number."""
|
507
514
|
return str(self.to_3_digits(x))[1:]
|
515
|
+
|
516
|
+
def save_json(self, file: str, var: dict):
|
517
|
+
"""Save variable to json file.
|
518
|
+
|
519
|
+
Args:
|
520
|
+
file: path to json file
|
521
|
+
var: dictionary to store
|
522
|
+
|
523
|
+
"""
|
524
|
+
with open(file, "w", encoding="utf-8") as fp:
|
525
|
+
json.dump(var, fp, ensure_ascii=False, indent=2)
|
526
|
+
|
527
|
+
def read_json(self, file: str) -> object:
|
528
|
+
"""Read variable from json file.
|
529
|
+
|
530
|
+
Args:
|
531
|
+
file: path to json file
|
532
|
+
|
533
|
+
Returns:
|
534
|
+
content of json file
|
535
|
+
|
536
|
+
"""
|
537
|
+
with open(file, "r") as fp:
|
538
|
+
return json.load(fp)
|
539
|
+
|
@@ -3,28 +3,28 @@ nkululeko/__init__.py,sha256=62f8HiEzJ8rG2QlTFJXUCMpvuH3fKI33DoJSj33mscc,63
|
|
3
3
|
nkululeko/aug_train.py,sha256=wpiHCJ7zsW38kumg3ypwXZe2HQrhUblAnv7P2QeJnAc,3525
|
4
4
|
nkululeko/augment.py,sha256=3RzaxB3gRxovgJVjHXi0glprW01J7RaHhUkqotW2T3U,2955
|
5
5
|
nkululeko/cacheddataset.py,sha256=XFpWZmbJRg0pvhnIgYf0TkclxllD-Fctu-Ol0PF_00c,969
|
6
|
-
nkululeko/constants.py,sha256=
|
6
|
+
nkululeko/constants.py,sha256=kSkvbiOI3g6sa27nNrD9sHxZMswo_qr0qKYSc_hZQLY,39
|
7
7
|
nkululeko/demo-ft.py,sha256=iD9Pzp9QjyAv31q1cDZ75vPez7Ve8A4Cfukv5yfZdrQ,770
|
8
8
|
nkululeko/demo.py,sha256=tu7Al2l5MCLVegkDC-NE2wcuc_YE7NRbgOlPW3yhGEs,4940
|
9
9
|
nkululeko/demo_feats.py,sha256=BvZjeNFTlERIRlq34OHM4Z96jdDQAhB01BGQAUcX9dM,2026
|
10
10
|
nkululeko/demo_predictor.py,sha256=lDF-xOxRdEAclOmbepAYg-BQXQdGkHfq2n74PTIoop8,4872
|
11
11
|
nkululeko/ensemble.py,sha256=71V-rre61H3J4sh7lu-OTo4I2_g7mm_rQxwW1ARDHgY,12782
|
12
|
-
nkululeko/experiment.py,sha256=
|
13
|
-
nkululeko/explore.py,sha256=
|
12
|
+
nkululeko/experiment.py,sha256=hdFvRA7EoQz10nId9MwcbYOTz2ifYeGrFKVJOv9a88Q,38394
|
13
|
+
nkululeko/explore.py,sha256=aDVHwuo-lkih7VZrbb_zFKg5fowSrAIcx0V9wf0SRGo,4175
|
14
14
|
nkululeko/export.py,sha256=U-V4acxtuL6qKt6oAsVcM5TTeWogYUJ3GU-lA6rq6d4,4336
|
15
15
|
nkululeko/feature_extractor.py,sha256=X6ZWDjGwUMVwnP6TkCEnw8B4xo8eWvJa1QT9-0WUuvA,4102
|
16
16
|
nkululeko/file_checker.py,sha256=xJY0Q6w47pnmgJVK5rcAKPYBrCpV7eBT4_3YBzTx-H8,3454
|
17
17
|
nkululeko/filter_data.py,sha256=4sGrKvMZ_hLnJPrHm_CqjDPKIRV8REWoT7nfSYGXbwo,7305
|
18
18
|
nkululeko/fixedsegment.py,sha256=Tb92QiuiyMsOO3WRWwuGjZGibS8hbHHCrcWAXGk7g04,2868
|
19
|
-
nkululeko/glob_conf.py,sha256=
|
20
|
-
nkululeko/modelrunner.py,sha256=
|
19
|
+
nkululeko/glob_conf.py,sha256=NLFh-1_I0Wdfo2EnSq1Oppx23AX6jAUpgFbk2zqZJ24,659
|
20
|
+
nkululeko/modelrunner.py,sha256=mnM5JBTiTVH4BOGZBepOuwEzAgrZDmoejhpVEvzq35s,11970
|
21
21
|
nkululeko/multidb.py,sha256=sO6OwJn8sn1-C-ig3thsIL8QMWHdV9SnJhDodKjeKrI,6876
|
22
22
|
nkululeko/nkuluflag.py,sha256=PGWSmZz-PiiHLgcZJAoGOI_Y-sZDVI1ksB8p5r7riWM,3725
|
23
23
|
nkululeko/nkululeko.py,sha256=6ALPMMIz6l0O3IRaP0q4b59ZUxpfzNqLQUqZMf5t3Zo,1976
|
24
|
-
nkululeko/plots.py,sha256=
|
25
|
-
nkululeko/predict.py,sha256=
|
24
|
+
nkululeko/plots.py,sha256=lUxgyoriYTwdpHZvBBQ4e41v77deQrt0PcRDLJWijys,27503
|
25
|
+
nkululeko/predict.py,sha256=VSF42CqJvyiwAnvoThV0oNNJLHhTRMS0cI6lICQeptc,2177
|
26
26
|
nkululeko/resample.py,sha256=rn3-M1A-iwVGibfQNGyeYNa7briD24lIN9Szq_1uTJo,5194
|
27
|
-
nkululeko/runmanager.py,sha256
|
27
|
+
nkululeko/runmanager.py,sha256=YtGQP0UyyQTKkilncB1XYM-T8oatzGcZEOcj5SorjJw,8902
|
28
28
|
nkululeko/scaler.py,sha256=a4lKwWT436TV4VEvqtP1uQ58Yz67XVHr1HjO5gp3xLI,5109
|
29
29
|
nkululeko/segment.py,sha256=7UrJEwdLmh9wDL5iBwpdJyJm9dwSxidHrHt-_D2qtxw,4949
|
30
30
|
nkululeko/syllable_nuclei.py,sha256=5w_naKxNxz66a_qLkraemi2fggM-gWesiiBPS47iFcE,9931
|
@@ -35,11 +35,12 @@ nkululeko/augmenting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
35
35
|
nkululeko/augmenting/augmenter.py,sha256=TUUznEz0pe9DSMC9r7LoBckuvsJTprvypeV5-8zLn20,2846
|
36
36
|
nkululeko/augmenting/randomsplicer.py,sha256=TQTy4RBt6XbWiuUu5Ic913DMvmwTUwEufldBJjo7i1s,2801
|
37
37
|
nkululeko/augmenting/randomsplicing.py,sha256=GXCpCDdOsOyWACDJ3ujmFZBVe6ISvkoQLefBNPgxxow,1750
|
38
|
-
nkululeko/augmenting/resampler.py,sha256=
|
38
|
+
nkululeko/augmenting/resampler.py,sha256=c5AjohxomX8ujOoJRnLZoNe1fxY8Fdw6LAdFm9KDy78,4020
|
39
39
|
nkululeko/autopredict/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
40
|
nkululeko/autopredict/ap_age.py,sha256=yzd8sF6gi0hnqNawyLBCIkt-pKgl9gYPlZHsrLGfz0U,1098
|
41
41
|
nkululeko/autopredict/ap_arousal.py,sha256=lpv3jTSVEVCcR226JevNM6S7e0_uMZXHb_8Wpup1yj8,1027
|
42
42
|
nkululeko/autopredict/ap_dominance.py,sha256=Ltq5x0ralxU1758_e-nNKvzexiPUM66xLAm3Wo2B07c,1040
|
43
|
+
nkululeko/autopredict/ap_emotion.py,sha256=1efW3cQjwc804Pf2aYU-XfjYtYXtZdyeiXtWL439x6o,1030
|
43
44
|
nkululeko/autopredict/ap_gender.py,sha256=RjLv9YxY9OPHT_gnd6htjKQzQA4DSKcbjipKGjHHx2A,1011
|
44
45
|
nkululeko/autopredict/ap_mos.py,sha256=PMLU67JDgYQMobRSR2vW9cWoL3QK5JbhLM65fVsRGkc,1108
|
45
46
|
nkululeko/autopredict/ap_pesq.py,sha256=EuJ9u6oaSPWdYsaU8q3t8tiFKhfW1qdqgO-cySpfxw0,1141
|
@@ -47,20 +48,22 @@ nkululeko/autopredict/ap_sdr.py,sha256=xYCy4M_aWzoFiYD_KOK9ys2P2v0bfxNkLcIRdi5z2
|
|
47
48
|
nkululeko/autopredict/ap_sid.py,sha256=b_JwVWlqcwdC7acU9Q7mExuOJKUn6qdlmQTm8pmmptk,2642
|
48
49
|
nkululeko/autopredict/ap_snr.py,sha256=cjc0pUsCN_RacTw1UBR2cGY9t_um48f2cjo3QJDn7bw,1111
|
49
50
|
nkululeko/autopredict/ap_stoi.py,sha256=csv9qCcRmieHAhypszqGoGt9r3biM8IYPgcTwp9GIFM,1188
|
51
|
+
nkululeko/autopredict/ap_text.py,sha256=zaz9qIg90-ghZhBe1ka0HoUnap6s6RyopUKoCpttHOU,1333
|
50
52
|
nkululeko/autopredict/ap_valence.py,sha256=9S06SpO_zXKSpkf0InHYYXZcD9HDGoCJ6UPkn__eBAg,1027
|
51
53
|
nkululeko/autopredict/estimate_snr.py,sha256=1k9-XadABudnsNOeFZD_Fg0E64-GUQVS7JEp82MLQS4,4995
|
54
|
+
nkululeko/autopredict/whisper_transcriber.py,sha256=DWDvpRaV5KmUF18ojPEvxnVXm_h_nWyY-TfW2Ngd5N8,2941
|
52
55
|
nkululeko/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
56
|
nkululeko/data/dataset.py,sha256=JLbBYGniUrjwxs-HtbIyhqO3Cv-ELfpmlq7jzij4dBc,41759
|
54
57
|
nkululeko/data/dataset_csv.py,sha256=AIbtB6pGk5BSQGIgfokZ7tEGFjmuOq5w2XumRSimVWs,4833
|
55
58
|
nkululeko/feat_extract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
59
|
nkululeko/feat_extract/feats_agender.py,sha256=onfAQ6-xx_mFMJXEF1IX8cHBmGtGeX6weJmxbkfh1_o,3184
|
57
60
|
nkululeko/feat_extract/feats_agender_agender.py,sha256=_YQv1qw--3uQfnyTQDCwlmPRnrhdMhgXbYK2yQtseW0,3464
|
58
|
-
nkululeko/feat_extract/feats_analyser.py,sha256=
|
61
|
+
nkululeko/feat_extract/feats_analyser.py,sha256=lodim7qQ8M7c3iMeJ5bHQ-nCy9Cehx1Xl5K3leii6-w,14768
|
59
62
|
nkululeko/feat_extract/feats_ast.py,sha256=w62xEoLiFtU-rj6SXkqXAktmoFaXcAcAWpUyEjp8JWo,4652
|
60
63
|
nkululeko/feat_extract/feats_auddim.py,sha256=CGLp_aYhudfwoU5522vjrvjPxfZcyw593A8xLjYefV8,3134
|
61
64
|
nkululeko/feat_extract/feats_audmodel.py,sha256=OsZyB1rdcG0Fai2gAwBlbuubmWor1_-P4IDkZLqgPKE,3161
|
62
65
|
nkululeko/feat_extract/feats_clap.py,sha256=1tttpfm2SJmQgYm2u8eUVpDiDOpWdKqFChpY3ZZokNs,3395
|
63
|
-
nkululeko/feat_extract/feats_emotion2vec.py,sha256=
|
66
|
+
nkululeko/feat_extract/feats_emotion2vec.py,sha256=LnV8xEg7L7HIDqz0ulqUNoaAHBU0d5gyQPb2_32T_18,9694
|
64
67
|
nkululeko/feat_extract/feats_hubert.py,sha256=F3vrPCkx8EimJjFWYCZ7Yg9uo1G3NjYt4UKrGIUev8k,5172
|
65
68
|
nkululeko/feat_extract/feats_import.py,sha256=cPi4XRuRs71npB8YGXr7rYOvkeTU_oZEl3GrGncdiqY,2222
|
66
69
|
nkululeko/feat_extract/feats_mld.py,sha256=5aRoYiGDm5ApoFntxAMQYPjEelXHHRBHZcAJR9dxaeI,1945
|
@@ -78,7 +81,7 @@ nkululeko/feat_extract/feats_wav2vec2.py,sha256=q1QzMD3KbhF2SOmxdwI7CiViRmhlFRyg
|
|
78
81
|
nkululeko/feat_extract/feats_wavlm.py,sha256=O9cfc39VF5aPJRRATKb37pHT4W11i2cu5O1mY9LOjIA,4755
|
79
82
|
nkululeko/feat_extract/feats_whisper.py,sha256=n3ESZtva7wshs8E8diBlQYa9xCH_P0UY1DncSrxz-FY,4508
|
80
83
|
nkululeko/feat_extract/featureset.py,sha256=clcBv9rzBRW-bfw7JC_FYTjU5uUS-c0UE1XtQLYYRiE,1615
|
81
|
-
nkululeko/feat_extract/feinberg_praat.py,sha256=
|
84
|
+
nkululeko/feat_extract/feinberg_praat.py,sha256=mMin5V-Kmx24oYJT_miNFN4t-tEVEF3Cd0969xiVV0E,28573
|
82
85
|
nkululeko/feat_extract/transformer_feature_extractor.py,sha256=LaXuW-AJZ931ttLis0J5h9N3RtiiE51BnkxJR-bubfY,5837
|
83
86
|
nkululeko/losses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
84
87
|
nkululeko/losses/loss_ccc.py,sha256=NOK0y0fxKUnU161B5geap6Fmn8QzoPl2MqtPiV8IuJE,976
|
@@ -97,17 +100,17 @@ nkululeko/models/model_svm.py,sha256=zP8ykLhCZTYvwSqw06XHuzq9qMBtsiYpxjUpWDAnMyA
|
|
97
100
|
nkululeko/models/model_svr.py,sha256=FEwYRdgqwgGhZdkpRnT7Ef12lklWi6GZL28PyV99xWs,726
|
98
101
|
nkululeko/models/model_tree.py,sha256=6L3PD3aIiiQz1RPWS6z3Edx4f0gnR7AOfBKOJzf0BNU,433
|
99
102
|
nkululeko/models/model_tree_reg.py,sha256=IMaQpNImoRqP8Biw1CsJevxpV_PVpKblsKtYlMW5d_U,429
|
100
|
-
nkululeko/models/model_tuned.py,sha256=
|
101
|
-
nkululeko/models/model_xgb.py,sha256=
|
103
|
+
nkululeko/models/model_tuned.py,sha256=74c_pQUtpx_x8bM3r5ufuqhaaQxfy6KRUqirdzSac-Q,35999
|
104
|
+
nkululeko/models/model_xgb.py,sha256=_VxFFP1QcoyxrwvJSrzdIwwDt85IulUWvg1BxXBgN1Y,6616
|
102
105
|
nkululeko/models/model_xgr.py,sha256=H01FJCRgmX2unvambMs5TTCS9sI6VDB9ip9G6rVGt2c,419
|
103
106
|
nkululeko/models/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
107
|
nkululeko/models/tests/test_model_svm.py,sha256=spDlZmeBKBdK4EFBpOgEkaAfGeGH9kau6CqSWOY6Uag,1856
|
105
108
|
nkululeko/reporting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
106
109
|
nkululeko/reporting/defines.py,sha256=0vh-Tlx4fAPpk1o6mP_4x3EkIoqzYMr38IZnj-JM5z4,641
|
107
110
|
nkululeko/reporting/latex_writer.py,sha256=NGwSIfd4nfslDkNUOSZSdqY_VDLA8634thyhe-vj1bY,1824
|
108
|
-
nkululeko/reporting/report.py,sha256=
|
111
|
+
nkululeko/reporting/report.py,sha256=B5eoIKMz46VKDBsi7M9u_iegzAD-E3eGCmolzSFjZ3c,1118
|
109
112
|
nkululeko/reporting/report_item.py,sha256=drkknsyFhGviaPJNmPQtCXJmRhTSSfjNcJt0Bls6JAA,533
|
110
|
-
nkululeko/reporting/reporter.py,sha256
|
113
|
+
nkululeko/reporting/reporter.py,sha256=bfRMN-8nAHAx3iWvjumQsqS-7DHdv7fgAzaUkdi-_qo,20336
|
111
114
|
nkululeko/reporting/result.py,sha256=G63a2tHCwHhM6NBJgYzsWKWJm4Yu3r4hsCHA2Km7eHU,1073
|
112
115
|
nkululeko/segmenting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
116
|
nkululeko/segmenting/seg_inaspeechsegmenter.py,sha256=b3t0zdpJYofKWMyKRMtMMX91xeR-k8d5pbnNaQHcsOE,1902
|
@@ -117,10 +120,10 @@ nkululeko/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
117
120
|
nkululeko/utils/files.py,sha256=SrrYaU7AB80MZHiV1jcB0h_zigvYLYgSVNTXV4ao38g,4593
|
118
121
|
nkululeko/utils/stats.py,sha256=3Fyx8q8BSKYmiufT6OkRug9RATWmGrr9BaX_y8jziWo,3074
|
119
122
|
nkululeko/utils/unzip.py,sha256=G68f5120TjwACZC3bQcneMniddnwubPbBdMc2L5KBOo,1206
|
120
|
-
nkululeko/utils/util.py,sha256=
|
121
|
-
nkululeko-0.
|
122
|
-
nkululeko-0.
|
123
|
-
nkululeko-0.
|
124
|
-
nkululeko-0.
|
125
|
-
nkululeko-0.
|
126
|
-
nkululeko-0.
|
123
|
+
nkululeko/utils/util.py,sha256=b4wolRb-9eCgfUDaxedcG3ys6HwgJrO5uoYvGSvi1nc,18571
|
124
|
+
nkululeko-0.95.0.dist-info/licenses/LICENSE,sha256=0zGP5B_W35yAcGfHPS18Q2B8UhvLRY3dQq1MhpsJU_U,1076
|
125
|
+
nkululeko-0.95.0.dist-info/METADATA,sha256=wVnk9XYBqWK3W55yNDp7-AK8h4Xpqgd1sRuWBrDGvV8,2874
|
126
|
+
nkululeko-0.95.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
127
|
+
nkululeko-0.95.0.dist-info/entry_points.txt,sha256=lNTkFEdh6Kjo5o95ZAWf_0Lq-4ztGoAoMVSDuPtuyS0,442
|
128
|
+
nkululeko-0.95.0.dist-info/top_level.txt,sha256=bf1k1YKkqcXemNX_cUgoyKqQ3_GVErPqAY-53J36jkM,19
|
129
|
+
nkululeko-0.95.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|