MCPcopy Create free account
hub / github.com/MarcCoru/locationencoder / __init__

Method __init__

locationencoder/locationencoder.py:73–94  ·  view source on GitHub ↗
(self, positional_encoding_name, neural_network_name, hparams)

Source from the content-addressed store, hash-verified

71# define the LightningModule
72class LocationEncoder(pl.LightningModule):
73 def __init__(self, positional_encoding_name, neural_network_name, hparams):
74 super().__init__()
75
76 self.learning_rate = hparams["optimizer"]["lr"]
77 self.weight_decay = hparams["optimizer"]["wd"]
78 self.regression = get_param(hparams, "regression")
79
80 self.loss_fn = get_loss_fn(presence_only=get_param(hparams, "presence_only_loss"),
81 loss_weight=get_param(hparams, "loss_weight"),
82 regression=self.regression)
83
84 self.positional_encoder = get_positional_encoding(
85 positional_encoding_name, hparams
86 )
87 self.neural_network = get_neural_network(
88 neural_network_name,
89 input_dim=self.positional_encoder.embedding_dim,
90 hparams=hparams
91 )
92
93 # this enables LocationEncoder.load_from_checkpoint(path)
94 self.save_hyperparameters()
95
96 def common_step(self, batch, batch_idx):
97 lonlats, label = batch

Callers

nothing calls this directly

Calls 4

get_loss_fnFunction · 0.90
get_paramFunction · 0.85
get_positional_encodingFunction · 0.85
get_neural_networkFunction · 0.85

Tested by

no test coverage detected