Skip to main content

COLA - Competitive layers for deep learning

COLA (COmpetitive LAyers) is a Python package providing the implementation of gradient-based competitive layers which can be used on top of deep learning models for unsupervised tasks.

https://github.com/pietrobarbiero/deep-topological-learning/blob/master/deep_dual_figure.png

Theory

Theoretical foundations can be found in our paper.

If you find COLA useful in your research, please consider citing the following paper:

@misc{barbiero2020topological,
    title={Topological Gradient-based Competitive Learning},
    author={Pietro Barbiero and Gabriele Ciravegna and Vincenzo Randazzo and Giansalvo Cirrincione},
    year={2020},
    eprint={2008.09477},
    archivePrefix={arXiv},
    primaryClass={stat.ML}
}

Examples

Dual Competitive Layer (DCL)

https://github.com/pietrobarbiero/deep-topological-learning/blob/master/test/test-results/circles_dynamic_dual.png
https://github.com/pietrobarbiero/deep-topological-learning/blob/master/test/test-results/circles_scatter_dual.png

Vanilla Competitive Layer (VCL)

https://github.com/pietrobarbiero/deep-topological-learning/blob/master/test/test-results/circles_dynamic_vanilla.png
https://github.com/pietrobarbiero/deep-topological-learning/blob/master/test/test-results/circles_scatter_vanilla.png

Using COLA

from cola import DualModel, plot_confusion_matrix, scatterplot, scatterplot_dynamic

X, y = ... # load dataset

# load custom tensorflow layers
inputs = Input(shape=(d,), name='input')
...
outputs = ...

# instantiate the dual model
n = X.shape[0] # number of samples
k = ... # upper bound of the desired number of prototypes
model = DualModel(n_samples=n, k_prototypes=k, inputs=inputs, outputs=outputs, deep=False)
model.compile(optimizer=optimizer)
model.fit(X, y, epochs=epochs)

# plot prototype dynamics
plt.figure()
scatterplot_dynamic(X, model.prototypes_, y, valid=True)
plt.show()

# plot confusion matrix
# considering the prototypes estimated in the last epoch
plt.figure()
plot_confusion_matrix(x_pred, model.prototypes[-1], y)
plt.show()

# plot estimated topology
# considering the prototypes estimated in the last epoch
plt.figure()
scatterplot(x_pred, model.prototypes[-1], y, valid=True)
plt.show()

Authors

Pietro Barbiero

Licence

Copyright 2020 Pietro Barbiero.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for deepcola 0.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deepcola 0.0.0
File Size Uploaded Provenance
deepcola-0.0.0.tar.gz 13.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for deepcola 0.0.0
File Interpreter ABI Platform
deepcola-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / deepcola-0.0.0.tar.gz

Download URL deepcola-0.0.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
be10bde18d9c2170189889f63e844dcccbde8c28a8f2858adb537bc529af0e01
BLAKE2b-256 checksum
How to use checksums
00a792cf586b99fc1d6b8f63fbdacf8f6113b1368dde48d3145a4b3f3e3f0253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

Release files / deepcola-0.0.0-py3-none-any.whl

Download URL deepcola-0.0.0-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a6b120d397ccb61fc35c659ce0694ec99e9042d1d89b6da126b5785c84d92dc
BLAKE2b-256 checksum
How to use checksums
f7eb397fe1eeef2c425c6d98272efb001454de0f5933355c21d46463a04fa87c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

Security for deepcola 0.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page