Keras NALU (Neural Arithmetic Logic Units)
Keras implementation of a NALU layer (Neural Arithmetic Logic Units). See: https://arxiv.org/pdf/1808.00508.pdf.
Installation
pip install keras-nalu
Usage
from keras.layers import Input
from keras.models import Model
from keras.optimizers import RMSprop
from keras_nalu.nalu import NALU
# Your dataset
X_test = ... # Interpolation data
Y_test = ... # Interpolation data
X_validation = ... # Extrapolation data (validation)
Y_validation = ... # Extrapolation data (validation)
X_test = ... # Extrapolation data (test)
Y_test = ... # Extrapolation data (test)
# Hyper parameters
epoch_count = 1000
learning_rate = 0.05
sequence_len = 100
inputs = Input(shape=(sequence_len, ))
hidden = NALU(units=2)(inputs)
hidden = NALU(units=2)(hidden)
outputs = NALU(units=1)(hidden)
model = Model(inputs=inputs, outputs=outputs)
model.summary()
model.compile(loss='mse', optimizer=RMSprop(lr=learning_rate))
model.fit(
batch_size=256,
epochs=epoch_count,
validation_data=(X_validation, Y_validation),
x=X_train,
y=Y_train,
)
extrapolation_loss = model.evaluate(
batch_size=256,
x=X_test,
y=Y_test,
)
Options
cell
Cell to use in the NALU layer. May be 'a' (addition/subtraction), 'm' (multiplication/division/power), or None which, will apply a gating function to toggle between 'a' or 'm'.
- Default:
None - Type:
?('a' | 'm' | None)
e
Epsilon value added to inputs in order to prevent calculating the log of zero.
- Default:
1e-7 - Type:
?float
Metadata
Release files for keras-nalu 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keras-nalu-1.3.0.tar.gz | 14.5 kB | Without provenance | Details for keras-nalu-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keras_nalu-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for keras_nalu-1.3.0-py3-none-any.whl |
Total release size: 53.3 kB
Release files / keras-nalu-1.3.0.tar.gz
| Download URL | keras-nalu-1.3.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85664c773a75797a5fe3fe5db0e0889e4ad553d4184bf5ffdf6d0da89b057f10
|
|
BLAKE2b-256 checksum How to use checksums |
89f1502af7bedc4fa2fe7b6d35d20a97c30f2989af6486eff0facffe54b7003b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/3.7.0 Darwin/17.7.0
|
Release files / keras_nalu-1.3.0-py3-none-any.whl
| Download URL | keras_nalu-1.3.0-py3-none-any.whl |
|---|---|
| Size | 38.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f9f5bacd096dd82e68c8850b57e08b5ce841a87bec595e25a14c45e2620dd7d
|
|
BLAKE2b-256 checksum How to use checksums |
f3220e80455884cb0caf7b0e9e7ed9193998b3d0ef63f5e416bbf70a74115f33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/3.7.0 Darwin/17.7.0
|
Security for keras-nalu 1.3.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.