From 0c466ea48d79520007b974cf48a4bc40c82b6261 Mon Sep 17 00:00:00 2001 From: Mario Graff Date: Thu, 22 May 2025 20:39:57 +0000 Subject: [PATCH 1/2] Bug in Train missing clone --- encexp/__init__.py | 2 +- encexp/text_repr.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/encexp/__init__.py b/encexp/__init__.py index 846a24a..3f3f4b6 100644 --- a/encexp/__init__.py +++ b/encexp/__init__.py @@ -17,4 +17,4 @@ if not '-m' in sys.argv: from encexp.text_repr import EncExpT, SeqTM, TextModel -__version__ = "0.1.3" +__version__ = "0.1.4" diff --git a/encexp/text_repr.py b/encexp/text_repr.py index 0484380..3873ad6 100644 --- a/encexp/text_repr.py +++ b/encexp/text_repr.py @@ -649,7 +649,7 @@ def set_weights(data): if tsv_filename is None or not isfile(tsv_filename): ds.process(D) if train is None: - train = Train(text_model=self.seqTM, + train = Train(text_model=clone(self.seqTM), filename=ds.output_filename, use_tqdm=self.use_tqdm, min_pos=min_pos, From db1024964e3f38ec2316fbd61e4463b807db9d8b Mon Sep 17 00:00:00 2001 From: Mario Graff Date: Mon, 26 May 2025 16:13:21 +0000 Subject: [PATCH 2/2] using sklearn convention --- encexp/build_encexp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/encexp/build_encexp.py b/encexp/build_encexp.py index dc46ece..4342ff2 100644 --- a/encexp/build_encexp.py +++ b/encexp/build_encexp.py @@ -252,7 +252,7 @@ def parameters(self, label): if self.with_intercept: output['intercept'] = m.intercept_.astype(np.float16).tobytes().hex() return output - + def create_model(self): """Create model""" def inner(fname, label, add_label=None): @@ -263,14 +263,14 @@ def inner(fname, label, add_label=None): return None with open(fname, 'w', encoding='utf-8') as fpt: if add_label is not None: - coef['label'] = [coef['label'], add_label] + coef['label'] = [add_label, coef['label']] print(json.dumps(coef), file=fpt) return (fname, label) if not isdir(self.identifier): os.mkdir(self.identifier) if len(self.labels) == 2: - args = [join(self.identifier, '0.json'), self.labels[0]] - output = inner(*args, add_label=self.labels[1]) + args = [join(self.identifier, '0.json'), self.labels[1]] + output = inner(*args, add_label=self.labels[0]) if output is not None: return [output] return []