ef6bcc1079
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 ``` |
||
---|---|---|
docs | ||
examples | ||
prototorch/models | ||
tests | ||
.bumpversion.cfg | ||
.codacy.yml | ||
.codecov.yml | ||
.gitignore | ||
.readthedocs.yml | ||
.travis.yml | ||
LICENSE | ||
README.md | ||
setup.py |
ProtoTorch Models
Pre-packaged prototype-based machine learning models using ProtoTorch and PyTorch-Lightning.
Installation
To install this plugin, simply run the following command:
pip install prototorch_models
The plugin should then be available for use in your Python environment as
prototorch.models
.
Note: Installing the models plugin should automatically install a suitable version of ProtoTorch.
Available models
LVQ Family
- Learning Vector Quantization 1 (LVQ1)
- Generalized Learning Vector Quantization (GLVQ)
- Generalized Relevance Learning Vector Quantization (GRLVQ)
- Generalized Matrix Learning Vector Quantization (GMLVQ)
- Localized and Generalized Matrix Learning Vector Quantization (LGMLVQ)
- Limited-Rank Matrix Learning Vector Quantization (LiRaMLVQ)
- Learning Vector Quantization Multi-Layer Network (LVQMLN)
- Siamese GLVQ
- Cross-Entropy Learning Vector Quantization (CELVQ)
- Robust Soft Learning Vector Quantization (RSLVQ)
Other
- k-Nearest Neighbors (KNN)
- Neural Gas (NG)
- Growing Neural Gas (GNG)
Work in Progress
- Classification-By-Components Network (CBC)
- Learning Vector Quantization 2.1 (LVQ2.1)
Planned models
- Median-LVQ
- Generalized Tangent Learning Vector Quantization (GTLVQ)
- Probabilistic Learning Vector Quantization (PLVQ)
- Self-Incremental Learning Vector Quantization (SILVQ)
Development setup
It is recommended that you use a virtual environment for development. If you do
not use conda
, the easiest way to work with virtual environments is by using
virtualenvwrapper. Once
you've installed it with pip install virtualenvwrapper
, you can do the
following:
export WORKON_HOME=~/pyenvs
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh # location may vary
mkvirtualenv pt
Once you have a virtual environment setup, you can start install the models
plugin with:
workon pt
git clone git@github.com:si-cim/prototorch_models.git
cd prototorch_models
git checkout dev
pip install -e .[all] # \[all\] if you are using zsh or MacOS
Note: Please avoid installing Tensorflow in this environment.
To assist in the development process, you may also find it useful to install
yapf
, isort
and autoflake
. You can install them easily with pip
.
FAQ
How do I update the plugin?
If you have already cloned and installed prototorch
and the
prototorch_models
plugin with the -e
flag via pip
, all you have to do is
navigate to those folders from your terminal and do git pull
to update.