Skip to main content

Keras Ordered Neurons LSTM

Version

[中文|English]

Unofficial implementation of ON-LSTM.

Install

pip install keras-ordered-neurons

Usage

Basic

Same as LSTM except that an extra argument chunk_size should be given:

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Embedding, Bidirectional, Dense

from keras_ordered_neurons import ONLSTM

model = Sequential()
model.add(Embedding(input_shape=(None,), input_dim=10, output_dim=100))
model.add(Bidirectional(ONLSTM(units=50, chunk_size=5)))
model.add(Dense(units=2, activation='softmax'))
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy')
model.summary()

DropConnect

Set recurrent_dropconnect to a non-zero value to enable drop-connect for recurrent weights:

from keras_ordered_neurons import ONLSTM

ONLSTM(units=50, chunk_size=5, recurrent_dropconnect=0.2)

Expected Split Points

Set return_splits to True if you want to know the expected split points of master forget gate and master input gate.

from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Embedding

from keras_ordered_neurons import ONLSTM

inputs = Input(shape=(None,))
embed = Embedding(input_dim=10, output_dim=100)(inputs)
outputs, splits = ONLSTM(units=50, chunk_size=5, return_sequences=True, return_splits=True)(embed)
model = Model(inputs=inputs, outputs=splits)
model.compile(optimizer='adam', loss='mse')
model.summary(line_length=120)

Metadata

Release files for keras-ordered-neurons 0.10.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 keras-ordered-neurons 0.10.0
File Size Uploaded Provenance
keras-ordered-neurons-0.10.0.tar.gz 10.2 kB Without provenance Details

Release files / keras-ordered-neurons-0.10.0.tar.gz

Download URL keras-ordered-neurons-0.10.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
40c4255cb1b583fcafeeef63e617adead545df674b023e5e7a2d4c53c7f36170
BLAKE2b-256 checksum
How to use checksums
9e08ce12de80e01b45d19455f3281d7289c9a891ff8abfa09b3d243854f93c9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

Security for keras-ordered-neurons 0.10.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.

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