Commit Graph

234 Commits

Author SHA1 Message Date
Jensun Ravichandran
561119ef1d fix: python is python3.9 2021-06-20 17:50:09 +02:00
Jensun Ravichandran
f1f0b313c9 Constrain prototorch version 2021-06-20 17:40:07 +02:00
Jensun Ravichandran
b9eb88a602 Remove .swp file 2021-06-18 13:46:08 +02:00
danielstaps
0a2da9ae50
Added Vis for GMLVQ with more then 2 dims using PCA (#11)
* Added Vis for GMLVQ with more then 2 dims using PCA

* Added initialization possibility to GMlVQ with PCA and one example with omega init + PCA vis of 3 dims

* test(githooks): Add githooks for automatic commit checks

Co-authored-by: staps@hs-mittweida.de <staps@hs-mittweida.de>
Co-authored-by: Alexander Engelsberger <alexanderengelsberger@gmail.com>
2021-06-18 13:28:11 +02:00
Alexander Engelsberger
8956ee75ad
test(githooks): Add githooks for automatic commit checks 2021-06-16 16:16:34 +02:00
Alexander Engelsberger
c87ed5ba8b
[FEATURE] Add PLVQ model 2021-06-12 13:02:26 +02:00
Alexander Engelsberger
fc11d78b38
[REFACTOR] Rename LikelihoodRatioLVQ to SLVQ 2021-06-12 13:02:26 +02:00
Jensun Ravichandran
e62a8e6582 [BUGFIX] Log loss in NG and GNG 2021-06-11 18:50:14 +02:00
Jensun Ravichandran
ea33196a50 Update SOM example 2021-06-11 11:30:27 +02:00
Jensun Ravichandran
4ca846997a [BUGFIX] Set minimum required version of pytorch_lightning
The `check_on_train_epoch_end=True` argument to the EarlyStopping callback from
pytorch_lightning does not seem to be available in pl version 1.2.8.
2021-06-10 01:14:01 +02:00
Jensun Ravichandran
57f8bec270 Update SOM 2021-06-09 18:21:12 +02:00
Jensun Ravichandran
022d791ea5 Route initialized prototypes 2021-06-07 21:18:08 +02:00
Alexander Engelsberger
43fc7d1678 [QA] Remove unused argument from CBC 2021-06-07 21:00:58 +02:00
Jensun Ravichandran
c7b5c88776 [WIP] Add SOM 2021-06-07 18:44:15 +02:00
Jensun Ravichandran
b031382072 Update NG 2021-06-07 18:35:08 +02:00
Jensun Ravichandran
d558fa6a4a [REFACTOR] Clean up GLVQ-types 2021-06-07 17:00:38 +02:00
Jensun Ravichandran
34ffeb95bc Update how the model is printed 2021-06-07 16:58:00 +02:00
Jensun Ravichandran
3aa33fd182 Add remarkrc 2021-06-07 15:18:26 +02:00
Jensun Ravichandran
f65a665157 Update readme 2021-06-07 15:18:10 +02:00
Jensun Ravichandran
bed753a6e9 Minor aesthetic change 2021-06-05 01:23:58 +02:00
Jensun Ravichandran
b82bb54dbe Add LGMLVQ example 2021-06-04 22:58:54 +02:00
Jensun Ravichandran
acac39cff6 Fix bold markup 2021-06-04 22:39:27 +02:00
Jensun Ravichandran
19f601fac8 Bump minimum required python version to 3.8 2021-06-04 22:21:41 +02:00
Jensun Ravichandran
5d2a8226ce Update example scripts 2021-06-04 22:21:28 +02:00
Jensun Ravichandran
016fcb4060 [REFACTOR] Major cleanup 2021-06-04 22:20:32 +02:00
Jensun Ravichandran
20471bfb1c [FEATURE] Update pruning callback to re-add pruned prototypes 2021-06-04 15:56:46 +02:00
Jensun Ravichandran
42d974e08c No implicit learning rate scheduling 2021-06-04 15:55:06 +02:00
Jensun Ravichandran
b0df61d1c3 [BUGFIX] Fix examples/ng_iris.py 2021-06-03 16:34:48 +02:00
Alexander Engelsberger
47db1965ee [BUGFIX] GNG Example 2021-06-03 15:42:54 +02:00
Alexander Engelsberger
0bc385fe7b [BUGFIX] Neural Gas gets prototype intiailizer from kwargs 2021-06-03 15:24:17 +02:00
Alexander Engelsberger
358f27257d [REFACTOR] Remove prototype_initializer function from GLVQ
Fixes #9
2021-06-03 15:15:22 +02:00
Alexander Engelsberger
bda88149d4 [BUGFIX] Growing neural gas 2021-06-03 15:13:38 +02:00
Alexander Engelsberger
7379c61966 [BUGFIX] Fix image visualization for some parameter combination
image visualization was broken if add_embeding was False, but data visualization was on.
2021-06-03 15:12:51 +02:00
Alexander Engelsberger
e209bf73d5 [BUGFIX] Pruning example works on GPU now 2021-06-03 14:35:24 +02:00
Alexander Engelsberger
1b09b1d57b [BUGFIX] Probabilistic Models work on GPU now 2021-06-03 14:05:44 +02:00
Alexander Engelsberger
459f7c24be [REFACTOR] Probabilistic loss signs changed 2021-06-03 14:00:47 +02:00
Alexander Engelsberger
5918f1cc21 [BUGFIX] CLI example documentation improved 2021-06-03 13:47:20 +02:00
Alexander Engelsberger
3b02d99ebe [BUGFIX] Early stopping example works now 2021-06-03 13:38:16 +02:00
Jensun Ravichandran
64250d0938 [BUG] CLI example crashes
Running examples/cli/gmlvq.py crashes with:
```
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/miniconda3/envs/py38/lib/python3.8/site-packages/pytorch_lightning/utilities/parsing.py in __getattr__(self, key)
    249         try:
--> 250             return self[key]
    251         except KeyError as exp:

KeyError: 'distribution'

The above exception was the direct cause of the following exception:

AttributeError                            Traceback (most recent call last)
~/work/repos/prototorch_models/examples/cli/gmlvq.py in <module>
     10
     11
---> 12 cli = LightningCLI(GMLVQMNIST)

~/miniconda3/envs/py38/lib/python3.8/site-packages/pytorch_lightning/utilities/cli.py in __init__(self, model_class, datamodule_class, save_config_callback, trainer_class, trainer_defaults, seed_everything_default, description, env_prefix, env_parse, parser_kwargs, subclass_mode_model, subclass_mode_data)
    168             seed_everything(self.config['seed_everything'])
    169         self.before_instantiate_classes()
--> 170         self.instantiate_classes()
    171         self.prepare_fit_kwargs()
    172         self.before_fit()

~/miniconda3/envs/py38/lib/python3.8/site-packages/pytorch_lightning/utilities/cli.py in instantiate_classes(self)
    211         self.config_init = self.parser.instantiate_subclasses(self.config)
    212         self.instantiate_datamodule()
--> 213         self.instantiate_model()
    214         self.instantiate_trainer()
    215

~/miniconda3/envs/py38/lib/python3.8/site-packages/pytorch_lightning/utilities/cli.py in instantiate_model(self)
    228             self.model = self.config_init['model']
    229         else:
--> 230             self.model = self.model_class(**self.config_init.get('model', {}))
    231
    232     def instantiate_trainer(self) -> None:

~/work/repos/prototorch_models/prototorch/models/glvq.py in __init__(self, hparams, **kwargs)
    307     def __init__(self, hparams, **kwargs):
    308         distance_fn = kwargs.pop("distance_fn", omega_distance)
--> 309         super().__init__(hparams, distance_fn=distance_fn, **kwargs)
    310         omega = torch.randn(self.hparams.input_dim,
    311                             self.hparams.latent_dim,

~/work/repos/prototorch_models/prototorch/models/glvq.py in __init__(self, hparams, **kwargs)
     39         # Layers
     40         self.proto_layer = LabeledComponents(
---> 41             distribution=self.hparams.distribution,
     42             initializer=self.prototype_initializer(**kwargs))
     43

~/miniconda3/envs/py38/lib/python3.8/site-packages/pytorch_lightning/utilities/parsing.py in __getattr__(self, key)
    250             return self[key]
    251         except KeyError as exp:
--> 252             raise AttributeError(f'Missing attribute "{key}"') from exp
    253
    254     def __setattr__(self, key, val):

AttributeError: Missing attribute "distribution"
```
2021-06-02 13:02:40 +02:00
Jensun Ravichandran
86688b26b0 Update setup.py 2021-06-02 13:01:27 +02:00
Jensun Ravichandran
ef6bcc1079 [BUG] Early stopping does not seem to work
The early stopping callback does not work as expected, and crashes at the end of
max_epochs with:

```
~/miniconda3/envs/py38/lib/python3.8/site-packages/pytorch_lightning/trainer/callback_hook.py in on_train_end(self)
    155         """Called when the train ends."""
    156         for callback in self.callbacks:
--> 157             callback.on_train_end(self, self.lightning_module)
    158
    159     def on_pretrain_routine_start(self) -> None:

~/work/repos/prototorch_models/prototorch/models/callbacks.py in on_train_end(self, trainer, pl_module)
     18     def on_train_end(self, trainer, pl_module):
     19         # instead, do it at the end of training loop
---> 20         self._run_early_stopping_check(trainer, pl_module)
     21
     22

TypeError: _run_early_stopping_check() takes 2 positional arguments but 3 were given
```
2021-06-02 12:44:34 +02:00
Jensun Ravichandran
bdacc83185 [REFACTOR] Update examples/dynamic_pruning.py 2021-06-02 03:53:21 +02:00
Jensun Ravichandran
8851d1bbc9 [FEATURE] Add PruneLoserPrototypes Callback 2021-06-02 03:52:41 +02:00
Jensun Ravichandran
a3f5d7d113 Update docstring 2021-06-02 02:40:29 +02:00
Jensun Ravichandran
b2009bb563 [FEATURE] Add example to showcase dynamic pruning of prototypes 2021-06-02 02:36:37 +02:00
Jensun Ravichandran
398431e7ea Remove examples/dynamic_components.py 2021-06-02 02:35:45 +02:00
Jensun Ravichandran
8f7deb75dd [FEATURE] Log prototype win ratios over all training batches 2021-06-02 02:32:54 +02:00
Jensun Ravichandran
7743c50725 Tweak repr 2021-06-02 01:07:48 +02:00
Jensun Ravichandran
fcf3a4979c Remove unused import 2021-06-02 00:49:36 +02:00
Jensun Ravichandran
d46fe4a393 [WIP] Update CBC example 2021-06-02 00:45:33 +02:00