Skip to content

Commit

Permalink
0.93.10
Browse files Browse the repository at this point in the history
  • Loading branch information
FBurkhardt committed Dec 18, 2024
1 parent 15fe41e commit c1c3b44
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

Version 0.93.10
--------------
* added nan check for imported features
* added LOGO result output

Version 0.93.9
--------------
* added manual seed to torch models
Expand Down
2 changes: 1 addition & 1 deletion nkululeko/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION="0.93.9"
VERSION="0.93.10"
SAMPLING_RATE = 16000
7 changes: 6 additions & 1 deletion nkululeko/feat_extract/feats_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def extract(self):
"feature type == import needs import_file = ['file1', 'filex']"
)
except SyntaxError:
if type(feat_import_files) == str:
if type(feat_import_files) is str:
feat_import_files = [feat_import_files]
else:
self.util.error(f"import_file is wrong: {feat_import_files}")
Expand All @@ -40,6 +40,11 @@ def extract(self):
if not os.path.isfile(feat_import_file):
self.util.error(f"no import file: {feat_import_file}")
df = audformat.utils.read_csv(feat_import_file)
if df.isnull().values.any():
self.util.warn(
f"imported features contain {df.isna().sum()} NAN, filling with zero."
)
df = df.fillna(0)
df = self.util.make_segmented_index(df)
df = df[df.index.isin(self.data_df.index)]
if import_files_append:
Expand Down
1 change: 1 addition & 0 deletions nkululeko/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def _do_logo(self):
f"LOGO: {self.logo} folds: mean {results.mean():.3f}, std:"
f" {results.std():.3f}"
)
report.print_logo(results)

def train(self):
"""Train the model."""
Expand Down
12 changes: 12 additions & 0 deletions nkululeko/reporting/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,18 @@ def _plot_confmat(self, truths, preds, plot_name, epoch=None, test_result=None):
def set_filename_add(self, my_string):
self.filenameadd = f"_{my_string}"

def print_logo(self, results):
res_dir = self.util.get_path("res_dir")
result_str = f"LOGO results: [{','.join(results.astype(str))}]"
file_name = f"{res_dir}/logo_results.txt"
with open(file_name, "w") as text_file:
text_file.write(
f"LOGO: mean {results.mean():.3f}, std: " + f"{results.std():.3f}"
)
text_file.write("\n")
text_file.write(result_str)
self.util.debug(result_str)

def print_results(self, epoch=None):
if epoch is None:
epoch = self.epoch
Expand Down

0 comments on commit c1c3b44

Please sign in to comment.