Skip to content

Commit 7dbf33d

Browse files
set reasonable defaults
1 parent 23cfe1b commit 7dbf33d

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/netmap/grn/inferrence.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def attribution_one_target(
213213
return attributions_list
214214

215215

216-
def inferrence(models, data_train_full_tensor, gene_names, xai_method):
216+
def inferrence(models, data_train_full_tensor, gene_names, xai_method='GuidedBackprop'):
217217

218218
"""
219219
The main inferrence function to compute the entire GRN. Computes all
@@ -344,7 +344,7 @@ def attribution_one_model(
344344
return attributions
345345

346346

347-
def inferrence_model_wise(models, data_train_full_tensor, gene_names, xai_method, n_models = [10, 25, 50], background_type = 'zeros'):
347+
def inferrence_model_wise(models, data_train_full_tensor, gene_names, xai_method = 'GuidedBackprop', n_models = [10, 25, 50], background_type = 'zeros'):
348348

349349
"""
350350
The main inferrence function to compute the entire GRN model wise. Computes all
@@ -430,10 +430,13 @@ def inferrence_model_wise(models, data_train_full_tensor, gene_names, xai_method
430430

431431
# cou = cou.merge(top_egde_collector, left_index = True, right_on='edge_key')
432432

433-
grn_adata = attribution_to_anndata(attributions[keynames[0]], var=cou)
434433

435434
if len(keynames)>0:
435+
grn_adata = attribution_to_anndata(attributions[keynames[0]], var=cou)
436+
436437
for k in keynames[1:len(keynames)]:
437438
# add remaining versions as masks
438439
grn_adata.layers[k] = attributions[k]
439-
return grn_adata
440+
return grn_adata
441+
else:
442+
return None

src/netmap/model/nbautoencoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def forward(self, y_true, y_pred, theta):
4949
return torch.mean(loss) # Return mean loss over the batch
5050

5151
class NegativeBinomialAutoencoder(nn.Module):
52-
def __init__(self, input_dim, latent_dim, dropout_rate=0.0, hidden_dims=[64, 64, 64], activation='relu'):
52+
def __init__(self, input_dim, latent_dim, dropout_rate=0.1, hidden_dims=[64], activation='relu'):
5353
super(NegativeBinomialAutoencoder, self).__init__()
5454

5555
# Mapping for the requested activation functions

src/netmap/model/train_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from tqdm import tqdm
88

99

10-
def create_model_zoo(data_tensor, n_models = 10, n_epochs = 10000, model_type = 'ZINBAutoencoder', dropout_rate = 0.02, latent_dim=8, hidden_dim=[128]):
10+
def create_model_zoo(data_tensor, n_models = 10, n_epochs = 10000, model_type = 'ZINBAutoencoder', dropout_rate = 0.1, latent_dim=8, hidden_dim=[64]):
1111
""" Creates a set of Autoencoders of the data using the speicified architecture. The architecture of the encoder can be specified using
1212
the `hidden_dim` parameter, the decoder architecture is mirrored. Early stopping is used by default.
1313

0 commit comments

Comments
 (0)