Skip to main content

Self-organizing maps in tensorflow

Project description

tf-som

Tensorflow self-organizing maps.

Locally competitive algorithms demonstrate superior convergence to their supervised counterparts over a suite of tasks. Try them yourself:

pip install tf-som
from .models import ConvNet

# build unsupervised base
unsupervised_base = ConvNet((H, W))

# train unsupervised
for x, _ in train_ds:
    unsupervised_base(x, training=True) 

...

# build supervised head
supervised_head = keras.Sequential([
    tfkl.Input(unsupervised_base.output_shape),
    tfkl.Conv2D(8, (3, 3), activation='relu'),
    tfkl.Flatten(),
    tfkl.Dense(N_classes, activation='softmax')
])

# assemble full classifier
unsupervised_base.trainable = False
classifier = keras.Sequential([
    unsupervised_base,
    supervised_head
])
classifier.compile('sgd', 'cross_entropy', 'accuracy')

# train supervised
classifier.fit(train_ds)

# compare model sizes
print(unsupervised_base.summary())
print(supervised_head.summary())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tf-som-0.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

tf_som-0.0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file tf-som-0.0.1.tar.gz.

File metadata

  • Download URL: tf-som-0.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

File hashes

Hashes for tf-som-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4910a44254f463851ff71e5ae05261e5ae1d73f3a66d04dad541c49bf73cd4fa
MD5 90399bd14858502544433f636fc2cb01
BLAKE2b-256 ae12880b1a430ed0109621b43148b4c57c8364efea8eaa3904280c84e44f6be6

See more details on using hashes here.

File details

Details for the file tf_som-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tf_som-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

File hashes

Hashes for tf_som-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5689e1fdd8a4584ab7d91dc7c8feb3fa3c0f8613eae54119c1637a9c0850d59
MD5 25a66aec01b77888c1378d0fb24006c3
BLAKE2b-256 acb8966777fc7531aebbdc36e8484ff164816e496af9f3ac91ce2ae2775e21bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page