Skip to main content

gsdr

Generative Sparse Distributed Representations, a fast generative model written in Python (Original C++ implementation https://github.com/222464/GSDR)

Dependencies

  • Python 3

  • Python libraries

    • numpy

Installation

pip install gsdr or clone and python setup.py install

Usage

(More extensive examples and IPython notebooks can be found in examples/)

With labeled data:

data, labels = ...

num_labels = 10

# Data: (batches, num_features)
# Labels: (batches,) (contains numbers from 0 to num_labels-1, eg. 10 for MNIST)

# Build the GSDR network (only one layer for now)
gsdr = GSDRStack()
gsdr.add(input_count=data.shape[1], hidden_count=256, sparsity=0.1, forced_latent_count=num_labels)

forced_latents = np.eye(num_labels)

# Train once for each data point
for i in range(data.shape[0]):
    gsdr.train(data[i], forced_latents={0: forced_latents[labels[i]]})

# Generate one example for each label
for i in range(num_labels):
    generated = gsdr.generate(forced_latents={0: forced_latents[i]})

With unlabeled data:

data = ...

# Data: (batches, num_features)

# Build the GSDR network (only one layer for now)
gsdr = GSDRStack()
gsdr.add(input_count=data.shape[1], hidden_count=256, sparsity=0.1)

# Train once for each data point
for i in range(data.shape[0]):
    gsdr.train(data[i])

states = np.eye(hidden_count)

# Generate one example for each one-hot state
for i in range(hidden_count):
    generated = gsdr.generate(states[i])

Metadata

Release files for gsdr 0.1.1

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

Source distribution (sdist)

Source distribution for gsdr 0.1.1
File Size Uploaded
gsdr-0.1.1.zip 2.5 kB Details

Release files / gsdr-0.1.1.zip

Download URL gsdr-0.1.1.zip
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
172750cc3ad23db1f40a6aa3fc121f208af5053a9649c392d380e40a1f4998df
BLAKE2b-256 checksum
How to use checksums
3f85b7b0b71c19459ceb4714c70c7d90cd21a1d61abd10e815404970835feba2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

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