diff --git a/Topyfic/train.py b/Topyfic/train.py index 405ef4c..9f92be0 100644 --- a/Topyfic/train.py +++ b/Topyfic/train.py @@ -204,6 +204,8 @@ def save_train(self, name=None, save_path="", file_format='pickle'): :type name: str :param save_path: directory you want to use to save pickle file (default is saving near script) :type save_path: str + :param file_format: format of the file you want to save (option: pickle (default), HDF5) + :type file_format: str """ if file_format not in ['pickle', 'HDF5']: sys.exit(f"{file_format} is not correct! It should be 'pickle' or 'HDF5'.") @@ -226,9 +228,6 @@ def save_train(self, name=None, save_path="", file_format='pickle'): models = f.create_group("models") for i in range(len(self.top_models)): model = models.create_group(str(i)) - - self.top_models[i].model = self.top_models[i].rLDA - model['components_'] = self.top_models[i].model.components_ model['exp_dirichlet_component_'] = self.top_models[i].model.exp_dirichlet_component_ model['n_batch_iter_'] = np.int_(self.top_models[i].model.n_batch_iter_) diff --git a/Topyfic/utilsMakeModel.py b/Topyfic/utilsMakeModel.py index da33d4c..0a6545a 100644 --- a/Topyfic/utilsMakeModel.py +++ b/Topyfic/utilsMakeModel.py @@ -528,15 +528,15 @@ def read_train(file): model = initialize_lda_model(components, exp_dirichlet_component, others) top_model = TopModel(name=f"{name}_{random_state}", - N=k, - gene_weights=components, - model=model) + N=k, + gene_weights=components, + model=model) top_models.append(top_model) train = Train(name=name, - k=k, - n_runs=n_runs, - random_state_range=random_state_range) + k=k, + n_runs=n_runs, + random_state_range=random_state_range) train.top_models = top_models f.close()