{ "info": { "author": "CyberZHG", "author_email": "CyberZHG@gmail.com", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6" ], "description": "# Keras Ordered Neurons LSTM\n\n[![Travis](https://travis-ci.org/CyberZHG/keras-ordered-neurons.svg)](https://travis-ci.org/CyberZHG/keras-ordered-neurons)\n[![Coverage](https://coveralls.io/repos/github/CyberZHG/keras-ordered-neurons/badge.svg?branch=master)](https://coveralls.io/github/CyberZHG/keras-ordered-neurons)\n[![Version](https://img.shields.io/pypi/v/keras-ordered-neurons.svg)](https://pypi.org/project/keras-ordered-neurons/)\n![Downloads](https://img.shields.io/pypi/dm/keras-ordered-neurons.svg)\n[![996.ICU](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://996.icu) \n\n![](https://img.shields.io/badge/keras-tensorflow-blue.svg)\n![](https://img.shields.io/badge/keras-theano-blue.svg)\n![](https://img.shields.io/badge/keras-cntk-blue.svg)\n![](https://img.shields.io/badge/keras-tf.keras-blue.svg)\n![](https://img.shields.io/badge/keras-tf.keras/eager-blue.svg)\n\n\\[[\u4e2d\u6587](https://github.com/CyberZHG/keras-ordered-neurons/blob/master/README.zh-CN.md)|[English](https://github.com/CyberZHG/keras-ordered-neurons/blob/master/README.md)\\]\n\nUnofficial implementation of [ON-LSTM](https://openreview.net/pdf?id=B1l6qiR5F7).\n\n## Install\n\n```bash\npip install keras-ordered-neurons\n```\n\n## Usage\n\n### Basic\n\nSame as `LSTM` except that an extra argument `chunk_size` should be given:\n\n```python\nfrom keras.models import Sequential\nfrom keras.layers import Embedding, Bidirectional, Dense\nfrom keras_ordered_neurons import ONLSTM\n\nmodel = Sequential()\nmodel.add(Embedding(input_shape=(None,), input_dim=10, output_dim=100))\nmodel.add(Bidirectional(ONLSTM(units=50, chunk_size=5)))\nmodel.add(Dense(units=2, activation='softmax'))\nmodel.compile(optimizer='adam', loss='sparse_categorical_crossentropy')\nmodel.summary()\n```\n\n### DropConnect\n\nSet `recurrent_dropconnect` to a non-zero value to enable drop-connect for recurrent weights:\n\n```python\nfrom keras_ordered_neurons import ONLSTM\n\nONLSTM(units=50, chunk_size=5, recurrent_dropconnect=0.2)\n```\n\n### Expected Split Points\n\nSet `return_splits` to `True` if you want to know the expected split points of master forget gate and master input gate.\n\n```python\nfrom keras.models import Model\nfrom keras.layers import Input, Embedding\nfrom keras_ordered_neurons import ONLSTM\n\ninputs = Input(shape=(None,))\nembed = Embedding(input_dim=10, output_dim=100)(inputs)\noutputs, splits = ONLSTM(units=50, chunk_size=5, return_sequences=True, return_splits=True)(embed)\nmodel = Model(inputs=inputs, outputs=splits)\nmodel.compile(optimizer='adam', loss='mse')\nmodel.summary(line_length=120)\n```\n\n### `tf.keras`\n\nAdd `TF_KERAS=1` to environment variables if you are using `tensorflow.python.keras`.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/CyberZHG/keras-ordered-neurons", "keywords": "", "license": "Anti 996", "maintainer": "", "maintainer_email": "", "name": "keras-on-lstm", "package_url": "https://pypi.org/project/keras-on-lstm/", "platform": "", "project_url": "https://pypi.org/project/keras-on-lstm/", "project_urls": { "Homepage": "https://github.com/CyberZHG/keras-ordered-neurons" }, "release_url": "https://pypi.org/project/keras-on-lstm/0.8.0/", "requires_dist": null, "requires_python": "", "summary": "Unofficial implementation of ON-LSTM", "version": "0.8.0" }, "last_serial": 5336670, "releases": { "0.8.0": [ { "comment_text": "", "digests": { "md5": "2aec39346fe3c89a5f1587c42215e2db", "sha256": "b42eac9836765e8a96c5e3f8a939fc7552ec4f6125efb438df273e0abe61eda5" }, "downloads": -1, "filename": "keras-on-lstm-0.8.0.tar.gz", "has_sig": false, "md5_digest": "2aec39346fe3c89a5f1587c42215e2db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9752, "upload_time": "2019-05-30T10:23:00", "url": "https://files.pythonhosted.org/packages/8c/26/166451b98706b778d47146c46fe51ee5be3a3982663cb4bf44adeea95204/keras-on-lstm-0.8.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2aec39346fe3c89a5f1587c42215e2db", "sha256": "b42eac9836765e8a96c5e3f8a939fc7552ec4f6125efb438df273e0abe61eda5" }, "downloads": -1, "filename": "keras-on-lstm-0.8.0.tar.gz", "has_sig": false, "md5_digest": "2aec39346fe3c89a5f1587c42215e2db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9752, "upload_time": "2019-05-30T10:23:00", "url": "https://files.pythonhosted.org/packages/8c/26/166451b98706b778d47146c46fe51ee5be3a3982663cb4bf44adeea95204/keras-on-lstm-0.8.0.tar.gz" } ] }