IMLCV.implementations.CvDiscovery#
Module Contents#
Classes#
Base class for all neural network modules. Layers and models should subclass this class. |
|
Base class for all neural network modules. Layers and models should subclass this class. |
|
Base class for all neural network modules. Layers and models should subclass this class. |
|
- class IMLCV.implementations.CvDiscovery.Encoder[source]#
Bases:
flax.linen.ModuleBase class for all neural network modules. Layers and models should subclass this class.
All Flax Modules are Python 3.7 dataclasses. Since dataclasses take over
__init__, you should instead overridesetup(), which is automatically called to initialize the module.Modules can contain submodules, and in this way can be nested in a tree structure. Submodels can be assigned as regular attributes inside the
setup()method.You can define arbitrary “forward pass” methods on your Module subclass. While no methods are special-cased,
__call__is a popular choice because it allows you to use module instances as if they are functions:from flax import linen as nn class Module(nn.Module): features: Tuple[int, ...] = (16, 4) def setup(self): self.dense1 = Dense(self.features[0]) self.dense2 = Dense(self.features[1]) def __call__(self, x): return self.dense2(nn.relu(self.dense1(x)))
Optionally, for more concise module implementations where submodules definitions are co-located with their usage, you can use the
compact()wrapper.
- class IMLCV.implementations.CvDiscovery.Decoder[source]#
Bases:
flax.linen.ModuleBase class for all neural network modules. Layers and models should subclass this class.
All Flax Modules are Python 3.7 dataclasses. Since dataclasses take over
__init__, you should instead overridesetup(), which is automatically called to initialize the module.Modules can contain submodules, and in this way can be nested in a tree structure. Submodels can be assigned as regular attributes inside the
setup()method.You can define arbitrary “forward pass” methods on your Module subclass. While no methods are special-cased,
__call__is a popular choice because it allows you to use module instances as if they are functions:from flax import linen as nn class Module(nn.Module): features: Tuple[int, ...] = (16, 4) def setup(self): self.dense1 = Dense(self.features[0]) self.dense2 = Dense(self.features[1]) def __call__(self, x): return self.dense2(nn.relu(self.dense1(x)))
Optionally, for more concise module implementations where submodules definitions are co-located with their usage, you can use the
compact()wrapper.
- class IMLCV.implementations.CvDiscovery.VAE[source]#
Bases:
flax.linen.ModuleBase class for all neural network modules. Layers and models should subclass this class.
All Flax Modules are Python 3.7 dataclasses. Since dataclasses take over
__init__, you should instead overridesetup(), which is automatically called to initialize the module.Modules can contain submodules, and in this way can be nested in a tree structure. Submodels can be assigned as regular attributes inside the
setup()method.You can define arbitrary “forward pass” methods on your Module subclass. While no methods are special-cased,
__call__is a popular choice because it allows you to use module instances as if they are functions:from flax import linen as nn class Module(nn.Module): features: Tuple[int, ...] = (16, 4) def setup(self): self.dense1 = Dense(self.features[0]) self.dense2 = Dense(self.features[1]) def __call__(self, x): return self.dense2(nn.relu(self.dense1(x)))
Optionally, for more concise module implementations where submodules definitions are co-located with their usage, you can use the
compact()wrapper.- setup()[source]#
Initializes a Module lazily (similar to a lazy
__init__).setupis called once lazily on a module instance when a module is bound, immediately before any other methods like__call__are invoked, or before asetup-defined attribute on self is accessed.This can happen in three cases:
Immediately when invoking
apply(),init()orinit_and_output().Once the module is given a name by being assigned to an attribute of another module inside the other module’s
setupmethod (see__setattr__()):class MyModule(nn.Module): def setup(self): submodule = Conv(...) # Accessing `submodule` attributes does not yet work here. # The following line invokes `self.__setattr__`, which gives # `submodule` the name "conv1". self.conv1 = submodule # Accessing `submodule` attributes or methods is now safe and # either causes setup() to be called once.
Once a module is constructed inside a method wrapped with
compact(), immediately before another method is called orsetupdefined attribute is accessed.
- class IMLCV.implementations.CvDiscovery.TranformerAutoEncoder(outdim, periodicity=None, bounding_box=None, descriptor='sb', descriptor_kwargs={})[source]#
Bases:
IMLCV.base.CVDiscovery.Transformer- _fit(cv: list[IMLCV.base.CV.CV], nl: list[NeighbourList] | None, nunits=250, nlayers=3, lr=0.0001, num_epochs=100, batch_size=32, **kwargs)[source]#
- class IMLCV.implementations.CvDiscovery.TransoformerLDA(outdim, periodicity=None, bounding_box=None, descriptor='sb', descriptor_kwargs={})[source]#
Bases:
IMLCV.base.CVDiscovery.Transformer- _fit(cv_list: list[IMLCV.base.CV.CV], nl_list: list[NeighbourList] | None, kernel=False, harmonic=True, sort='rematch', shrinkage=0, alpha_rematch=0.1, max_iterations=50, **kwargs)[source]#