QubitPi commited on
Commit
5bd8e7f
1 Parent(s): c7d38ff

Rebranding - Entity Extraction

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .github/free_disk_space.sh +48 -0
  2. .github/pull_request_template.md +0 -23
  3. .github/workflows/ci-cd.yaml +108 -0
  4. .github/workflows/ci-cd.yml +0 -43
  5. .gitignore +3 -0
  6. .readthedocs.yaml +0 -29
  7. LICENSE +1 -1
  8. README.md +106 -34
  9. app.py +22 -0
  10. docs/Makefile +0 -34
  11. docs/make.bat +0 -35
  12. docs/source/conf.py +0 -96
  13. docs/source/faq.rst +0 -78
  14. docs/source/img/char-level-language-model.png +0 -0
  15. docs/source/img/hello-sampling.png +0 -0
  16. docs/source/img/hello-sound.png +0 -0
  17. docs/source/img/real-vs-sampling.png +0 -0
  18. docs/source/img/rnn-4-black-boxes-connected.drawio +0 -121
  19. docs/source/img/rnn-4-black-boxes-connected.png +0 -0
  20. docs/source/img/rnn-4-black-boxes.drawio +0 -94
  21. docs/source/img/rnn-4-black-boxes.png +0 -0
  22. docs/source/img/rnn-many-to-many-different-ltr.png +0 -0
  23. docs/source/img/rnn-many-to-many-same-ltr.png +0 -0
  24. docs/source/img/rnn-many-to-one-ltr.png +0 -0
  25. docs/source/img/rnn-multi-sequences.drawio +0 -250
  26. docs/source/img/rnn-multi-sequences.png +0 -0
  27. docs/source/img/rnn-one-to-many-ltr.png +0 -0
  28. docs/source/img/rnn-one-to-one-ltr.png +0 -0
  29. docs/source/img/rnn.drawio +0 -149
  30. docs/source/img/rnn.png +0 -0
  31. docs/source/img/sampling-sound-wave.gif +0 -0
  32. docs/source/img/sound-wave.png +0 -0
  33. docs/source/img/speech-processing.png +0 -0
  34. docs/source/index.rst +0 -46
  35. docs/source/intro/install.rst +0 -54
  36. docs/source/lamassu.rst +0 -9
  37. docs/source/requirements.txt +0 -7
  38. docs/source/rnn/rnn.rst +0 -612
  39. docs/source/speech/sampling.rst +0 -68
  40. lamassu-logo.png +0 -0
  41. lamassu/rnn/__init__.py +0 -0
  42. lamassu/rnn/example.py +0 -50
  43. lamassu/rnn/rnn.py +0 -114
  44. lamassu/speech/__init__.py +0 -0
  45. lamassu/speech/sampling.py +0 -16
  46. mlflow/HanLPner.py +57 -0
  47. {lamassu → mlflow}/__init__.py +0 -0
  48. mlflow/parser.py +84 -0
  49. mlflow/requirements.txt +4 -0
  50. mlflow/test_parser.py +25 -0
.github/free_disk_space.sh ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Licensed to the Apache Software Foundation (ASF) under one or more
3
+ # contributor license agreements. See the NOTICE file distributed with
4
+ # this work for additional information regarding copyright ownership.
5
+ # The ASF licenses this file to You under the Apache License, Version 2.0
6
+ # (the "License"); you may not use this file except in compliance with
7
+ # the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ #
19
+ # The Azure provided machines typically have the following disk allocation:
20
+ # Total space: 85GB
21
+ # Allocated: 67 GB
22
+ # Free: 17 GB
23
+ # This script frees up 28 GB of disk space by deleting unneeded packages and
24
+ # large directories.
25
+ # The Flink end to end tests download and generate more than 17 GB of files,
26
+ # causing unpredictable behavior and build failures.
27
+ #
28
+ echo "=============================================================================="
29
+ echo "Freeing up disk space on CI system"
30
+ echo "=============================================================================="
31
+
32
+ echo "Listing 100 largest packages"
33
+ dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
34
+ df -h
35
+ echo "Removing large packages"
36
+ sudo apt-get remove -y '^ghc-8.*'
37
+ sudo apt-get remove -y '^dotnet-.*'
38
+ sudo apt-get remove -y '^llvm-.*'
39
+ sudo apt-get remove -y 'php.*'
40
+ sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel
41
+ sudo apt-get autoremove -y
42
+ sudo apt-get clean
43
+ df -h
44
+ echo "Removing large directories"
45
+ # deleting 15GB
46
+ rm -rf /usr/share/dotnet/
47
+ rm -rf /opt/hostedtoolcache
48
+ df -h
.github/pull_request_template.md DELETED
@@ -1,23 +0,0 @@
1
- Changelog
2
- ---------
3
-
4
- ### Added
5
-
6
- ### Changed
7
-
8
- ### Deprecated
9
-
10
- ### Removed
11
-
12
- ### Fixed
13
-
14
- ### Security
15
-
16
-
17
- Checklist
18
- ---------
19
-
20
- - [ ] Test
21
- - [ ] Self-review
22
- - [ ] Documentation
23
- - [ ] Version Bumped Manually*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/ci-cd.yaml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Jiaqi Liu
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ ---
15
+ name: CI/CD
16
+
17
+ on:
18
+ pull_request:
19
+ push:
20
+ branches: [master]
21
+
22
+ jobs:
23
+ yml-md-style-and-link-checks:
24
+ uses: QubitPi/hashistack/.github/workflows/yml-md-style-and-link-checks.yml@master
25
+
26
+ unit-tests:
27
+ needs: yml-md-style-and-link-checks
28
+ runs-on: ubuntu-latest
29
+ strategy:
30
+ fail-fast: false
31
+ matrix:
32
+ python-version: ["3.10"]
33
+ test: [
34
+ {test-file: "mlflow/test_parser.py", requirements-file: "mlflow/requirements.txt"}
35
+ ]
36
+ steps:
37
+ - uses: actions/checkout@v3
38
+ - name: Set up Python ${{ matrix.python-version }}
39
+ uses: actions/setup-python@v4
40
+ with:
41
+ python-version: ${{ matrix.python-version }}
42
+ - name: Install dependencies
43
+ run: pip3 install -r ${{ matrix.test.requirements-file }}
44
+ - name: Run all tests
45
+ run: python3 -m unittest ${{ matrix.test.test-file }}
46
+
47
+ mlflow-tests:
48
+ needs: unit-tests
49
+ runs-on: ubuntu-latest
50
+ strategy:
51
+ fail-fast: false
52
+ matrix:
53
+ python-version: ["3.10"]
54
+ steps:
55
+ - uses: actions/checkout@v3
56
+ - name: Remove unnecessary files
57
+ run: .github/free_disk_space.sh
58
+ - name: Set up Python ${{ matrix.python-version }}
59
+ uses: actions/setup-python@v4
60
+ with:
61
+ python-version: ${{ matrix.python-version }}
62
+ - name: Install dependencies
63
+ run: pip3 install -r requirements.txt
64
+ working-directory: mlflow
65
+ - name: Build model
66
+ run: python3 HanLPner.py
67
+ working-directory: mlflow
68
+ - name: Build Docker image
69
+ run: mlflow models build-docker --name "entity-extraction"
70
+ working-directory: mlflow
71
+ - name: Run Container
72
+ run: |
73
+ cp parser.py models/HanLPner/
74
+ export ML_MODEL_PATH=${{ github.workspace }}/mlflow/models/HanLPner
75
+ docker run --rm \
76
+ --memory=4000m \
77
+ -p 8080:8080 \
78
+ -v $ML_MODEL_PATH:/opt/ml/model \
79
+ -e PYTHONPATH="/opt/ml/model:$PYTHONPATH" \
80
+ -e GUNICORN_CMD_ARGS="--timeout 60 -k gevent --workers=1" \
81
+ "entity-extraction" &
82
+ working-directory: mlflow
83
+ - name: Wait until container is up
84
+ run: |
85
+ npm install -g wait-on
86
+ wait-on http://127.0.0.1:8080/ping
87
+ - name: Get status code of a test request and verify it's 200
88
+ run: |
89
+ status_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type:application/json" --data '{"dataframe_split": {"columns":["text"], "data":[["我爱中国"], ["世界会变、科技会变,但「派昂」不会变,它不会向任何人低头,不会向任何困难低头,甚至不会向「时代」低头。「派昂」,永远引领对科技的热爱。只有那些不向梦想道路上的阻挠认输的人,才配得上与我们一起追逐梦想"]]}}' http://127.0.0.1:8080/invocations)
90
+ if [ "$status_code" == 200 ]; then
91
+ exit 0
92
+ else
93
+ echo "Integration test failed with a non-200 response from container"
94
+ exit 1
95
+ fi
96
+
97
+ sync-to-huggingface-space:
98
+ needs: unit-tests
99
+ runs-on: ubuntu-latest
100
+ steps:
101
+ - uses: actions/checkout@v3
102
+ with:
103
+ fetch-depth: 0
104
+ lfs: true
105
+ - name: Push to hub
106
+ run: git push https://QubitPi:[email protected]/spaces/QubitPi/lamassu master:main -f
107
+ env:
108
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
.github/workflows/ci-cd.yml DELETED
@@ -1,43 +0,0 @@
1
- # Copyright Jiaqi Liu
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- ---
15
- name: CI/CD
16
-
17
- "on":
18
- pull_request:
19
- push:
20
- branches:
21
- - master
22
-
23
- jobs:
24
- yml-md-style-and-link-checks:
25
- uses: QubitPi/hashicorp-aws/.github/workflows/yml-md-style-and-link-checks.yml@master
26
-
27
- release:
28
- name: Publish Lamassu To PyPI
29
- runs-on: ubuntu-latest
30
- steps:
31
- - uses: actions/checkout@v3
32
- - name: Set up Python 3.10
33
- uses: actions/setup-python@v4
34
- with:
35
- python-version: "3.10"
36
- - name: Package up SDK
37
- run: python setup.py sdist
38
- - name: Publish a Python distribution to PyPI
39
- if: github.ref == 'refs/heads/master'
40
- uses: pypa/gh-action-pypi-publish@release/v1
41
- with:
42
- user: __token__
43
- password: ${{ secrets.PYPI_API_TOKEN }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore CHANGED
@@ -1,3 +1,6 @@
 
1
  .idea/
 
 
2
  .DS_Store
3
  __pycache__
 
1
+ .venv
2
  .idea/
3
+ mlruns/
4
+ models/
5
  .DS_Store
6
  __pycache__
.readthedocs.yaml DELETED
@@ -1,29 +0,0 @@
1
- # Copyright Jiaqi Liu
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- version: 2
15
-
16
- build:
17
- os: ubuntu-22.04
18
- tools:
19
- python: "3.11"
20
-
21
- sphinx:
22
- configuration: docs/source/conf.py
23
-
24
- python:
25
- install:
26
- - method: pip
27
- path: .
28
- - requirements: requirements.txt
29
- - requirements: docs/source/requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LICENSE CHANGED
@@ -186,7 +186,7 @@
186
  same "printed page" as the copyright notice for easier
187
  identification within third-party archives.
188
 
189
- Copyright [yyyy] [name of copyright owner]
190
 
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
  you may not use this file except in compliance with the License.
 
186
  same "printed page" as the copyright notice for easier
187
  identification within third-party archives.
188
 
189
+ Copyright 2024 Jiaqi Liu
190
 
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
  you may not use this file except in compliance with the License.
README.md CHANGED
@@ -1,50 +1,122 @@
1
- <div align="center">
 
 
 
 
 
 
 
 
 
 
2
 
3
- <img src="lamassu-logo.png" width="30%"/>
 
 
 
 
4
 
5
- </div>
 
6
 
7
- ![Python Version][Python Version Badge]
8
- [![Read the Docs][Read the Docs badge]][Read the Docs URL]
9
- [![PyPI][PyPI project badge]][PyPI project url]
10
- [![GitHub Workflow Status][GitHub Workflow Status badge]][GitHub Workflow Status URL]
11
- ![Last Commit][GitHub Last Commit Badge]
12
- [![Apache License badge]][Apache License URL]
13
 
14
- Lamassu
15
- =======
16
 
17
- Lamassu is a project that empowers individual to agnostically run machine learning algorithms to produce ad-hoc NLP
18
- features.
19
 
20
- Documentation
21
- -------------
22
 
23
- [**Lamassu is in beta development phase for the moment**](https://lamassu.readthedocs.io/en/latest/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  License
26
  -------
27
 
28
- The use and distribution terms for Lamassu are covered by the
29
- [Apache License, Version 2.0][Apache License, Version 2.0].
30
 
31
- <div align="center">
32
- <a href="https://opensource.org/licenses">
33
- <img align="center" width="50%" alt="License Illustration" src="https://github.com/QubitPi/QubitPi/blob/master/img/apache-2.png?raw=true">
34
- </a>
35
- </div>
36
 
37
- [Apache License badge]: https://img.shields.io/badge/Apache%202.0-F25910.svg?style=for-the-badge&logo=Apache&logoColor=white
38
- [Apache License URL]: https://www.apache.org/licenses/LICENSE-2.0
39
- [Apache License, Version 2.0]: http://www.apache.org/licenses/LICENSE-2.0.html
40
 
41
- [GitHub Last Commit Badge]: https://img.shields.io/github/last-commit/QubitPi/lamassu/master?logo=github&style=for-the-badge
42
- [GitHub Workflow Status badge]: https://img.shields.io/github/actions/workflow/status/QubitPi/lamassu/ci-cd.yml?logo=github&style=for-the-badge
43
- [GitHub Workflow Status URL]: https://github.com/QubitPi/lamassu/actions/workflows/ci-cd.yml
44
 
45
- [Python Version Badge]: https://img.shields.io/badge/Python-3.10-brightgreen?style=for-the-badge&logo=python&logoColor=white
46
- [PyPI project badge]: https://img.shields.io/pypi/v/lamassu?logo=pypi&logoColor=white&style=for-the-badge
47
- [PyPI project url]: https://pypi.org/project/lamassu/
 
48
 
49
- [Read the Docs badge]: https://img.shields.io/readthedocs/lamassu?style=for-the-badge&logo=readthedocs&logoColor=white&label=Read%20the%20Docs&labelColor=8CA1AF
50
- [Read the Docs URL]: https://lamassu.readthedocs.io/en/latest/
 
1
+ ---
2
+ title: Lamassu
3
+ emoji: 🤗
4
+ colorFrom: gray
5
+ colorTo: red
6
+ sdk: gradio
7
+ sdk_version: 4.36.1
8
+ app_file: app.py
9
+ pinned: false
10
+ license: apache-2.0
11
+ ---
12
 
13
+ [![Hugging Face space badge]][Hugging Face space URL]
14
+ [![Hugging Face sync status badge]][Hugging Face sync status URL]
15
+ [![MLflow badge]][MLflow URL]
16
+ [![MLflow build status badge]][MLflow build status URL]
17
+ [![Apache License Badge]][Apache License, Version 2.0]
18
 
19
+ Lamassu is a Named Entity Extraction service that is capable of running on [Hugging Face][Hugging Face space URL] and
20
+ MLflow managed environment. It is the service backing the [Nexus Graph](https://paion-data.github.io/nexusgraph.com/)
21
 
22
+ Hugging Face
23
+ ------------
 
 
 
 
24
 
25
+ Lamassu is directly available on [Hugging Face space][Hugging Face space URL]. Please check it out.
 
26
 
27
+ MLflow
28
+ ------
29
 
30
+ ![Python Version Badge]
 
31
 
32
+ ### Getting Source Code
33
+
34
+ ```console
35
+ git clone [email protected]:QubitPi/lamassu.git
36
+ ```
37
+
38
+ ### Running Locally
39
+
40
+ Create virtual environment and install dependencies:
41
+
42
+ ```console
43
+ cd lamassu/mlflow
44
+ python3 -m venv .venv
45
+ . .venv/bin/activate
46
+ pip3 install -r requirements.txt
47
+ ```
48
+
49
+ Generate Model with
50
+
51
+ ```console
52
+ python3 HanLPner.py
53
+ ```
54
+
55
+ A model directory called "HanLPner" appears under `mlflow/models`. Then build Docker image
56
+
57
+ ```console
58
+ mlflow models build-docker --name "entity-extraction"
59
+ ```
60
+
61
+ and run container with
62
+
63
+ ```console
64
+ cp parser.py models/HanLPner/
65
+ export ML_MODEL_PATH=/absolute/path/to/models/HanLPner
66
+
67
+ docker run --rm \
68
+ --memory=4000m \
69
+ -p 8080:8080 \
70
+ -v $ML_MODEL_PATH:/opt/ml/model \
71
+ -e PYTHONPATH="/opt/ml/model:$PYTHONPATH" \
72
+ -e GUNICORN_CMD_ARGS="--timeout 60 -k gevent --workers=1" \
73
+ "entity-extraction"
74
+ ```
75
+
76
+ > [!TIP]
77
+ > If `docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))`
78
+ > error is seen, refer to
79
+ > https://forums.docker.com/t/docker-errors-dockerexception-error-while-fetching-server-api-version-connection-aborted-filenotfounderror-2-no-such-file-or-directory-error-in-python/135637/5
80
+
81
+ The container runs Gunicorn server inside to serve incoming requests
82
+
83
+ > [!WARNING]
84
+ > The number of gunicorn worker process MUST be **1** (`--workers=1`) to prevent multiple workers from downloading a
85
+ > HanLP pre-trained model to the same location, which results in runtime error in Docker container. In **native**
86
+ > environment, this error can be
87
+ >
88
+ > ```console
89
+ > OSError: [Errno 39] Directory not empty: '/root/.hanlp/mtl/close_tok_pos_ner_srl_dep_sdp_con_electra_small_20210304_135840'
90
+ > -> '/root/.hanlp/mtl/close_tok_pos_ner_srl_dep_sdp_con_electra_small_20210111_124159'
91
+ > ```
92
+
93
+ Example query:
94
+
95
+ ```bash
96
+ curl -X POST -H "Content-Type:application/json" \
97
+ --data '{"dataframe_split": {"columns":["text"], "data":[["我爱中国"], ["世界会变、科技会变,但「派昂」不会变,它不会向任何人低头,不会向任何困难低头,甚至不会向「时代」低头。「派昂」,永远引领对科技的热爱。只有那些不向梦想道路上的阻挠认输的人,才配得上与我们一起追逐梦想"]]}}' \
98
+ http://127.0.0.1:8080/invocations
99
+ ```
100
+
101
+ [Note the JSON schema of the `--data` value](https://stackoverflow.com/a/75104855)
102
 
103
  License
104
  -------
105
 
106
+ The use and distribution terms for [lamassu]() are covered by the [Apache License, Version 2.0].
 
107
 
108
+ [Apache License Badge]: https://img.shields.io/badge/Apache%202.0-F25910.svg?style=for-the-badge&logo=Apache&logoColor=white
109
+ [Apache License, Version 2.0]: https://www.apache.org/licenses/LICENSE-2.0
 
 
 
110
 
111
+ [Hugging Face space badge]: https://img.shields.io/badge/Hugging%20Face%20Space-lamassu-FFD21E?style=for-the-badge&logo=huggingface&logoColor=white
112
+ [Hugging Face space URL]: https://huggingface.co/spaces/QubitPi/lamassu
 
113
 
114
+ [Hugging Face sync status badge]: https://img.shields.io/github/actions/workflow/status/QubitPi/lamassu/ci-cd.yaml?branch=master&style=for-the-badge&logo=github&logoColor=white&label=Hugging%20Face%20Sync%20Up
115
+ [Hugging Face sync status URL]: https://github.com/QubitPi/lamassu/actions/workflows/ci-cd.yaml
 
116
 
117
+ [MLflow badge]: https://img.shields.io/badge/MLflow%20Supported-0194E2?style=for-the-badge&logo=mlflow&logoColor=white
118
+ [MLflow URL]: https://mlflow.qubitpi.org/
119
+ [MLflow build status badge]: https://img.shields.io/github/actions/workflow/status/QubitPi/lamassu/ci-cd.yaml?branch=master&style=for-the-badge&logo=github&logoColor=white&label=MLflow%20Build
120
+ [MLflow build status URL]: https://github.com/QubitPi/lamassu/actions/workflows/ci-cd.yaml
121
 
122
+ [Python Version Badge]: https://img.shields.io/badge/Python-3.10-brightgreen?style=for-the-badge&logo=python&logoColor=white
 
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ import hanlp
4
+ from mlflow.parser import convert_to_knowledge_graph_spec
5
+
6
+ HanLP = hanlp.load(hanlp.pretrained.mtl.CLOSE_TOK_POS_NER_SRL_DEP_SDP_CON_ELECTRA_SMALL_ZH)
7
+
8
+ def inference(input):
9
+ return convert_to_knowledge_graph_spec(HanLP([input])["srl"])
10
+
11
+ app = gr.Interface(
12
+ fn=inference,
13
+ inputs="text",
14
+ outputs="json",
15
+ title="Named Entity Recognition",
16
+ description=("Turning text corpus into graph representation"),
17
+ examples=[
18
+ ["我爱中国"],
19
+ ["世界会变、科技会变,但「派昂」不会变,它不会向任何人低头,不会向任何困难低头,甚至不会向「时代」低头。「派昂」,永远引领对科技的热爱。只有那些不向梦想道路上的阻挠认输的人,才配得上与我们一起追逐梦想"]
20
+ ],
21
+ )
22
+ app.launch()
docs/Makefile DELETED
@@ -1,34 +0,0 @@
1
- # Copyright Jiaqi Liu
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- # Minimal makefile for Sphinx documentation
16
- #
17
-
18
- # You can set these variables from the command line, and also
19
- # from the environment for the first two.
20
- SPHINXOPTS ?=
21
- SPHINXBUILD ?= sphinx-build
22
- SOURCEDIR = source
23
- BUILDDIR = build
24
-
25
- # Put it first so that "make" without argument is like "make help".
26
- help:
27
- @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
28
-
29
- .PHONY: help Makefile
30
-
31
- # Catch-all target: route all unknown targets to Sphinx using the new
32
- # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
33
- %: Makefile
34
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/make.bat DELETED
@@ -1,35 +0,0 @@
1
- @ECHO OFF
2
-
3
- pushd %~dp0
4
-
5
- REM Command file for Sphinx documentation
6
-
7
- if "%SPHINXBUILD%" == "" (
8
- set SPHINXBUILD=sphinx-build
9
- )
10
- set SOURCEDIR=source
11
- set BUILDDIR=build
12
-
13
- if "%1" == "" goto help
14
-
15
- %SPHINXBUILD% >NUL 2>NUL
16
- if errorlevel 9009 (
17
- echo.
18
- echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19
- echo.installed, then set the SPHINXBUILD environment variable to point
20
- echo.to the full path of the 'sphinx-build' executable. Alternatively you
21
- echo.may add the Sphinx directory to PATH.
22
- echo.
23
- echo.If you don't have Sphinx installed, grab it from
24
- echo.http://sphinx-doc.org/
25
- exit /b 1
26
- )
27
-
28
- %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
- goto end
30
-
31
- :help
32
- %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
-
34
- :end
35
- popd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/conf.py DELETED
@@ -1,96 +0,0 @@
1
- # Configuration file for the Sphinx documentation builder.
2
- #
3
- # This file only contains a selection of the most common options. For a full
4
- # list see the documentation:
5
- # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
-
7
- # -- Path setup --------------------------------------------------------------
8
-
9
- # If extensions (or modules to document with autodoc) are in another directory,
10
- # add these directories to sys.path here. If the directory is relative to the
11
- # documentation root, use os.path.abspath to make it absolute, like shown here.
12
- #
13
- import os
14
- import sys
15
- sys.path.insert(0, os.path.abspath('../../'))
16
-
17
-
18
- # -- Project information -----------------------------------------------------
19
-
20
- project = 'lamassu'
21
- copyright = '2023, Jiaqi Liu'
22
- author = 'Jiaqi Liu'
23
-
24
- # The full version, including alpha/beta/rc tags
25
- release = '0.1.0'
26
-
27
-
28
- # -- General configuration ---------------------------------------------------
29
-
30
- # Add any Sphinx extension module names here, as strings. They can be
31
- # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32
- # ones.
33
- extensions = [
34
- 'sphinx.ext.autodoc',
35
- 'hoverxref.extension',
36
- 'notfound.extension',
37
- 'sphinx.ext.coverage',
38
- 'sphinx.ext.intersphinx',
39
- 'sphinx.ext.viewcode',
40
- "sphinx.ext.graphviz",
41
- "pyan.sphinx"
42
- ]
43
-
44
- # add graphviz options
45
- graphviz_output_format = "svg"
46
-
47
- # Add any paths that contain templates here, relative to this directory.
48
- templates_path = ['_templates']
49
-
50
- # List of patterns, relative to source directory, that match files and
51
- # directories to ignore when looking for source files.
52
- # This pattern also affects html_static_path and html_extra_path.
53
- exclude_patterns = []
54
-
55
-
56
- # -- Options for HTML output -------------------------------------------------
57
-
58
- # The theme to use for HTML and HTML Help pages. See the documentation for
59
- # a list of builtin themes.
60
- #
61
- html_theme = 'sphinx_rtd_theme'
62
-
63
- # Add any paths that contain custom static files (such as style sheets) here,
64
- # relative to this directory. They are copied after the builtin static files,
65
- # so a file named "default.css" will overwrite the builtin "default.css".
66
- html_static_path = ['_static']
67
-
68
- intersphinx_mapping = {
69
- 'attrs': ('https://www.attrs.org/en/stable/', None),
70
- 'coverage': ('https://coverage.readthedocs.io/en/stable', None),
71
- 'cryptography': ('https://cryptography.io/en/latest/', None),
72
- 'cssselect': ('https://cssselect.readthedocs.io/en/latest', None),
73
- 'itemloaders': ('https://itemloaders.readthedocs.io/en/latest/', None),
74
- 'pytest': ('https://docs.pytest.org/en/latest', None),
75
- 'python': ('https://docs.python.org/3', None),
76
- 'sphinx': ('https://www.sphinx-doc.org/en/master', None),
77
- 'tox': ('https://tox.wiki/en/latest/', None),
78
- 'twisted': ('https://docs.twisted.org/en/stable/', None),
79
- 'twistedapi': ('https://docs.twisted.org/en/stable/api/', None),
80
- 'w3lib': ('https://w3lib.readthedocs.io/en/latest', None),
81
- }
82
- intersphinx_disabled_reftypes = []
83
-
84
- hoverxref_auto_ref = True
85
- hoverxref_role_types = {
86
- "class": "tooltip",
87
- "command": "tooltip",
88
- "confval": "tooltip",
89
- "hoverxref": "tooltip",
90
- "mod": "tooltip",
91
- "ref": "tooltip",
92
- "reqmeta": "tooltip",
93
- "setting": "tooltip",
94
- "signal": "tooltip",
95
- }
96
- hoverxref_roles = ['command', 'reqmeta', 'setting', 'signal']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/faq.rst DELETED
@@ -1,78 +0,0 @@
1
- .. _faq:
2
-
3
- ==========================
4
- Frequently Asked Questions
5
- ==========================
6
-
7
-
8
- Python Sphinx Autodoc Is Not Rendering on readthedocs
9
- =====================================================
10
-
11
- The project's dependencies are not specified on RTD, but instead have installed the dependencies locally. Visit the
12
- project's Builds, click a build, and click "view raw"::
13
-
14
- WARNING: autodoc: failed to import module 'rnn' from module 'lamassu'; the following exception was raised:
15
- No module named 'matplotlib'
16
-
17
- To remedy the situation, we must specify that the project's dependencies to be installed. See
18
- `Specifying Dependencies <https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html>`_.
19
-
20
-
21
- Generate Sphinx Documentation Locally
22
- =====================================
23
-
24
- This site is auto-generated using `Sphinx <https://www.sphinx-doc.org/en/master/>`_ with the following command in venv::
25
-
26
- cd /path/to/lamassu/
27
- python3 -m venv venv
28
- source venv/bin/activate
29
- pip3 install .
30
- pip3 install -r docs/source/requirements.txt
31
- sphinx-build -a -b html docs/source/ /path/to/html/output/dir
32
- deactivate
33
-
34
- .. NOTE::
35
- The command above works for Linux/UNIX systems. Some commands will
36
- `differ on Windows OS <https://realpython.com/python-virtual-environments-a-primer/>`_
37
-
38
-
39
- Install Lamassu from Source Locally
40
- ===================================
41
-
42
- We recommend creating a virtualenv for your application and activate it
43
-
44
- Navigate to the ``lamassu`` root directory and run::
45
-
46
- pip3 install -e .
47
-
48
- For more general information, please refer to the
49
- `Hitchhiker's Guide to Python <https://docs.python-guide.org/writing/structure/#structuring-your-project>`_: "Structuring Your Project".
50
-
51
-
52
- "module 'collections' has no attribute 'Callable' Error When Running nosetests
53
- ==============================================================================
54
-
55
- First, uninstall nose with the following command::
56
-
57
- pip3 uninstall -y nose
58
-
59
- Second, reinstall nose but with ``--nobinaries`` flag::
60
-
61
- pip3 install -U nose --no-binary :all:
62
-
63
- Why does this work? At the time of this writing the binary generated by nose was likely generated with a version of
64
- Python 3.4 or older. This command forces to rebuild from source.
65
-
66
-
67
- No module named 'pytest' while Running Test Directly in PyCharm
68
- ===============================================================
69
-
70
- "Right-click" run a ``test_**.py`` file results in::
71
-
72
- Traceback (most recent call last):
73
- File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py", line 5, in <module>
74
- import pytest
75
- ModuleNotFoundError: No module named 'pytest'
76
-
77
- The solution is going to '**Settings** -> **Tools** -> **Python Integrated Tools**' and scroll down to where it says
78
- `pytest not found` and there is a **FIX** button. Clicking on it and apply the settings shall resolve the problem
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/img/char-level-language-model.png DELETED
Binary file (468 kB)
 
docs/source/img/hello-sampling.png DELETED
Binary file (485 kB)
 
docs/source/img/hello-sound.png DELETED
Binary file (161 kB)
 
docs/source/img/real-vs-sampling.png DELETED
Binary file (133 kB)
 
docs/source/img/rnn-4-black-boxes-connected.drawio DELETED
@@ -1,121 +0,0 @@
1
- <mxfile host="app.diagrams.net" modified="2024-03-19T01:01:04.926Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" etag="OgWHmKqu6mVN4yDKoCwM" version="24.0.7" type="device">
2
- <diagram name="Page-1" id="gxr7cFC-hZQY0lpAcxoR">
3
- <mxGraphModel dx="816" dy="516" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4
- <root>
5
- <mxCell id="0" />
6
- <mxCell id="1" parent="0" />
7
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-21" value="&lt;font size=&quot;1&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 27px;&quot;&gt;f&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" vertex="1" parent="1">
8
- <mxGeometry x="40" y="320" width="60" height="60" as="geometry" />
9
- </mxCell>
10
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-22" value="&lt;font color=&quot;#ffffff&quot; face=&quot;Italianno&quot; style=&quot;font-size: 27px;&quot;&gt;f&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" vertex="1" parent="1">
11
- <mxGeometry x="180" y="320" width="60" height="60" as="geometry" />
12
- </mxCell>
13
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-23" value="&lt;span style=&quot;color: rgb(255, 255, 255); font-family: Italianno; font-size: 27px;&quot;&gt;f&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" vertex="1" parent="1">
14
- <mxGeometry x="320" y="320" width="60" height="60" as="geometry" />
15
- </mxCell>
16
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-24" value="&lt;span style=&quot;color: rgb(255, 255, 255); font-family: Italianno; font-size: 27px;&quot;&gt;f&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" vertex="1" parent="1">
17
- <mxGeometry x="460" y="320" width="60" height="60" as="geometry" />
18
- </mxCell>
19
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
20
- <mxGeometry relative="1" as="geometry">
21
- <mxPoint x="69.5" y="439" as="sourcePoint" />
22
- <mxPoint x="69.5" y="389" as="targetPoint" />
23
- </mxGeometry>
24
- </mxCell>
25
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-26" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;h&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
26
- <mxGeometry x="45" y="450" width="50" height="50" as="geometry" />
27
- </mxCell>
28
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
29
- <mxGeometry relative="1" as="geometry">
30
- <mxPoint x="69.5" y="310" as="sourcePoint" />
31
- <mxPoint x="69.5" y="260" as="targetPoint" />
32
- </mxGeometry>
33
- </mxCell>
34
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-28" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;e&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
35
- <mxGeometry x="45" y="200" width="50" height="50" as="geometry" />
36
- </mxCell>
37
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-29" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
38
- <mxGeometry x="185" y="200" width="50" height="50" as="geometry" />
39
- </mxCell>
40
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-30" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
41
- <mxGeometry x="325" y="200" width="50" height="50" as="geometry" />
42
- </mxCell>
43
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-31" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;o&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
44
- <mxGeometry x="465" y="200" width="50" height="50" as="geometry" />
45
- </mxCell>
46
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
47
- <mxGeometry relative="1" as="geometry">
48
- <mxPoint x="209.5" y="310" as="sourcePoint" />
49
- <mxPoint x="209.5" y="260" as="targetPoint" />
50
- </mxGeometry>
51
- </mxCell>
52
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
53
- <mxGeometry relative="1" as="geometry">
54
- <mxPoint x="349.5" y="310" as="sourcePoint" />
55
- <mxPoint x="349.5" y="260" as="targetPoint" />
56
- </mxGeometry>
57
- </mxCell>
58
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
59
- <mxGeometry relative="1" as="geometry">
60
- <mxPoint x="489.5" y="310" as="sourcePoint" />
61
- <mxPoint x="489.5" y="260" as="targetPoint" />
62
- </mxGeometry>
63
- </mxCell>
64
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-35" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;e&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
65
- <mxGeometry x="185" y="450" width="50" height="50" as="geometry" />
66
- </mxCell>
67
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-36" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
68
- <mxGeometry x="325" y="450" width="50" height="50" as="geometry" />
69
- </mxCell>
70
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-37" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
71
- <mxGeometry x="465" y="450" width="50" height="50" as="geometry" />
72
- </mxCell>
73
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
74
- <mxGeometry relative="1" as="geometry">
75
- <mxPoint x="209.5" y="440" as="sourcePoint" />
76
- <mxPoint x="209.5" y="390" as="targetPoint" />
77
- </mxGeometry>
78
- </mxCell>
79
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
80
- <mxGeometry relative="1" as="geometry">
81
- <mxPoint x="349.5" y="440" as="sourcePoint" />
82
- <mxPoint x="349.5" y="390" as="targetPoint" />
83
- </mxGeometry>
84
- </mxCell>
85
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
86
- <mxGeometry relative="1" as="geometry">
87
- <mxPoint x="489.5" y="440" as="sourcePoint" />
88
- <mxPoint x="489.5" y="390" as="targetPoint" />
89
- </mxGeometry>
90
- </mxCell>
91
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" edge="1" parent="1">
92
- <mxGeometry relative="1" as="geometry">
93
- <mxPoint x="110" y="349.78" as="sourcePoint" />
94
- <mxPoint x="170.5" y="349.78" as="targetPoint" />
95
- </mxGeometry>
96
- </mxCell>
97
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" edge="1" parent="1">
98
- <mxGeometry relative="1" as="geometry">
99
- <mxPoint x="250" y="349.76" as="sourcePoint" />
100
- <mxPoint x="310.5" y="349.76" as="targetPoint" />
101
- </mxGeometry>
102
- </mxCell>
103
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-46" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" edge="1" parent="1">
104
- <mxGeometry relative="1" as="geometry">
105
- <mxPoint x="394.75" y="349.76" as="sourcePoint" />
106
- <mxPoint x="455.25" y="349.76" as="targetPoint" />
107
- </mxGeometry>
108
- </mxCell>
109
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-47" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;sub style=&quot;font-size: 25px;&quot;&gt;1&lt;/sub&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=25;fontStyle=1" vertex="1" parent="1">
110
- <mxGeometry x="110" y="320" width="60" height="30" as="geometry" />
111
- </mxCell>
112
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-48" value="&lt;font style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;/span&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;sub style=&quot;font-size: 25px;&quot;&gt;2&lt;/sub&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Italianno;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DItalianno;fontSize=25;fontStyle=1" vertex="1" parent="1">
113
- <mxGeometry x="250" y="320" width="60" height="30" as="geometry" />
114
- </mxCell>
115
- <mxCell id="o5WZRm4PuDRFcwwRBSCM-49" value="&lt;font style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;/span&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;sub style=&quot;font-size: 25px;&quot;&gt;3&lt;/sub&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Italianno;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DItalianno;fontSize=25;fontStyle=1" vertex="1" parent="1">
116
- <mxGeometry x="390" y="320" width="60" height="30" as="geometry" />
117
- </mxCell>
118
- </root>
119
- </mxGraphModel>
120
- </diagram>
121
- </mxfile>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/img/rnn-4-black-boxes-connected.png DELETED
Binary file (66.7 kB)
 
docs/source/img/rnn-4-black-boxes.drawio DELETED
@@ -1,94 +0,0 @@
1
- <mxfile host="app.diagrams.net" modified="2024-03-19T00:55:52.180Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" etag="0mAcZEyuQtVV9Bg2w-Tf" version="24.0.7" type="device">
2
- <diagram name="Page-1" id="DUD_6-T85kScICrpKMMz">
3
- <mxGraphModel dx="1536" dy="972" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4
- <root>
5
- <mxCell id="0" />
6
- <mxCell id="1" parent="0" />
7
- <mxCell id="LGyqkTtVOXbUGTZdzTyq-1" value="&lt;font size=&quot;1&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 27px;&quot;&gt;f&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
8
- <mxGeometry x="20" y="300" width="60" height="60" as="geometry" />
9
- </mxCell>
10
- <mxCell id="LGyqkTtVOXbUGTZdzTyq-2" value="&lt;font color=&quot;#ffffff&quot; face=&quot;Italianno&quot; style=&quot;font-size: 27px;&quot;&gt;f&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
11
- <mxGeometry x="160" y="300" width="60" height="60" as="geometry" />
12
- </mxCell>
13
- <mxCell id="LGyqkTtVOXbUGTZdzTyq-4" value="&lt;span style=&quot;color: rgb(255, 255, 255); font-family: Italianno; font-size: 27px;&quot;&gt;f&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
14
- <mxGeometry x="300" y="300" width="60" height="60" as="geometry" />
15
- </mxCell>
16
- <mxCell id="LGyqkTtVOXbUGTZdzTyq-5" value="&lt;span style=&quot;color: rgb(255, 255, 255); font-family: Italianno; font-size: 27px;&quot;&gt;f&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
17
- <mxGeometry x="440" y="300" width="60" height="60" as="geometry" />
18
- </mxCell>
19
- <mxCell id="LGyqkTtVOXbUGTZdzTyq-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
20
- <mxGeometry relative="1" as="geometry">
21
- <mxPoint x="49.5" y="419" as="sourcePoint" />
22
- <mxPoint x="49.5" y="369" as="targetPoint" />
23
- </mxGeometry>
24
- </mxCell>
25
- <mxCell id="hK792VXiPIr8ubialXFB-1" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;h&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
26
- <mxGeometry x="25" y="430" width="50" height="50" as="geometry" />
27
- </mxCell>
28
- <mxCell id="hK792VXiPIr8ubialXFB-2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
29
- <mxGeometry relative="1" as="geometry">
30
- <mxPoint x="49.5" y="290" as="sourcePoint" />
31
- <mxPoint x="49.5" y="240" as="targetPoint" />
32
- </mxGeometry>
33
- </mxCell>
34
- <mxCell id="hK792VXiPIr8ubialXFB-3" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;e&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
35
- <mxGeometry x="25" y="180" width="50" height="50" as="geometry" />
36
- </mxCell>
37
- <mxCell id="hK792VXiPIr8ubialXFB-4" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
38
- <mxGeometry x="165" y="180" width="50" height="50" as="geometry" />
39
- </mxCell>
40
- <mxCell id="hK792VXiPIr8ubialXFB-5" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
41
- <mxGeometry x="305" y="180" width="50" height="50" as="geometry" />
42
- </mxCell>
43
- <mxCell id="hK792VXiPIr8ubialXFB-6" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;o&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
44
- <mxGeometry x="445" y="180" width="50" height="50" as="geometry" />
45
- </mxCell>
46
- <mxCell id="hK792VXiPIr8ubialXFB-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
47
- <mxGeometry relative="1" as="geometry">
48
- <mxPoint x="189.5" y="290" as="sourcePoint" />
49
- <mxPoint x="189.5" y="240" as="targetPoint" />
50
- </mxGeometry>
51
- </mxCell>
52
- <mxCell id="hK792VXiPIr8ubialXFB-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
53
- <mxGeometry relative="1" as="geometry">
54
- <mxPoint x="329.5" y="290" as="sourcePoint" />
55
- <mxPoint x="329.5" y="240" as="targetPoint" />
56
- </mxGeometry>
57
- </mxCell>
58
- <mxCell id="hK792VXiPIr8ubialXFB-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
59
- <mxGeometry relative="1" as="geometry">
60
- <mxPoint x="469.5" y="290" as="sourcePoint" />
61
- <mxPoint x="469.5" y="240" as="targetPoint" />
62
- </mxGeometry>
63
- </mxCell>
64
- <mxCell id="hK792VXiPIr8ubialXFB-11" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;e&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
65
- <mxGeometry x="165" y="430" width="50" height="50" as="geometry" />
66
- </mxCell>
67
- <mxCell id="hK792VXiPIr8ubialXFB-12" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
68
- <mxGeometry x="305" y="430" width="50" height="50" as="geometry" />
69
- </mxCell>
70
- <mxCell id="hK792VXiPIr8ubialXFB-13" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
71
- <mxGeometry x="445" y="430" width="50" height="50" as="geometry" />
72
- </mxCell>
73
- <mxCell id="hK792VXiPIr8ubialXFB-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
74
- <mxGeometry relative="1" as="geometry">
75
- <mxPoint x="189.5" y="420" as="sourcePoint" />
76
- <mxPoint x="189.5" y="370" as="targetPoint" />
77
- </mxGeometry>
78
- </mxCell>
79
- <mxCell id="hK792VXiPIr8ubialXFB-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
80
- <mxGeometry relative="1" as="geometry">
81
- <mxPoint x="329.5" y="420" as="sourcePoint" />
82
- <mxPoint x="329.5" y="370" as="targetPoint" />
83
- </mxGeometry>
84
- </mxCell>
85
- <mxCell id="hK792VXiPIr8ubialXFB-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" edge="1" parent="1">
86
- <mxGeometry relative="1" as="geometry">
87
- <mxPoint x="469.5" y="420" as="sourcePoint" />
88
- <mxPoint x="469.5" y="370" as="targetPoint" />
89
- </mxGeometry>
90
- </mxCell>
91
- </root>
92
- </mxGraphModel>
93
- </diagram>
94
- </mxfile>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/img/rnn-4-black-boxes.png DELETED
Binary file (52.4 kB)
 
docs/source/img/rnn-many-to-many-different-ltr.png DELETED
Binary file (9.23 kB)
 
docs/source/img/rnn-many-to-many-same-ltr.png DELETED
Binary file (10.5 kB)
 
docs/source/img/rnn-many-to-one-ltr.png DELETED
Binary file (8.38 kB)
 
docs/source/img/rnn-multi-sequences.drawio DELETED
@@ -1,250 +0,0 @@
1
- <mxfile host="app.diagrams.net" modified="2024-03-19T01:28:19.045Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" etag="1-yK62UkPGlKoTsEWqch" version="24.0.7" type="device">
2
- <diagram name="Page-1" id="6HRoGfWBaaDKhnXAU6vd">
3
- <mxGraphModel dx="2156" dy="1926" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4
- <root>
5
- <mxCell id="0" />
6
- <mxCell id="1" parent="0" />
7
- <mxCell id="vckTE8xcX2gjwNGocpAb-1" value="&lt;font size=&quot;1&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 27px;&quot;&gt;f&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
8
- <mxGeometry x="40" y="320" width="60" height="60" as="geometry" />
9
- </mxCell>
10
- <mxCell id="vckTE8xcX2gjwNGocpAb-2" value="&lt;font color=&quot;#ffffff&quot; face=&quot;Italianno&quot; style=&quot;font-size: 27px;&quot;&gt;f&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
11
- <mxGeometry x="180" y="320" width="60" height="60" as="geometry" />
12
- </mxCell>
13
- <mxCell id="vckTE8xcX2gjwNGocpAb-3" value="&lt;span style=&quot;color: rgb(255, 255, 255); font-family: Italianno; font-size: 27px;&quot;&gt;f&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
14
- <mxGeometry x="320" y="320" width="60" height="60" as="geometry" />
15
- </mxCell>
16
- <mxCell id="vckTE8xcX2gjwNGocpAb-4" value="&lt;span style=&quot;color: rgb(255, 255, 255); font-family: Italianno; font-size: 27px;&quot;&gt;f&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
17
- <mxGeometry x="460" y="320" width="60" height="60" as="geometry" />
18
- </mxCell>
19
- <mxCell id="vckTE8xcX2gjwNGocpAb-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
20
- <mxGeometry relative="1" as="geometry">
21
- <mxPoint x="69.5" y="439" as="sourcePoint" />
22
- <mxPoint x="69.5" y="389" as="targetPoint" />
23
- </mxGeometry>
24
- </mxCell>
25
- <mxCell id="vckTE8xcX2gjwNGocpAb-6" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;h&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
26
- <mxGeometry x="45" y="450" width="50" height="50" as="geometry" />
27
- </mxCell>
28
- <mxCell id="vckTE8xcX2gjwNGocpAb-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
29
- <mxGeometry relative="1" as="geometry">
30
- <mxPoint x="69.5" y="310" as="sourcePoint" />
31
- <mxPoint x="69.5" y="260" as="targetPoint" />
32
- </mxGeometry>
33
- </mxCell>
34
- <mxCell id="vckTE8xcX2gjwNGocpAb-8" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;e&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
35
- <mxGeometry x="45" y="200" width="50" height="50" as="geometry" />
36
- </mxCell>
37
- <mxCell id="vckTE8xcX2gjwNGocpAb-9" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
38
- <mxGeometry x="185" y="200" width="50" height="50" as="geometry" />
39
- </mxCell>
40
- <mxCell id="vckTE8xcX2gjwNGocpAb-10" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
41
- <mxGeometry x="325" y="200" width="50" height="50" as="geometry" />
42
- </mxCell>
43
- <mxCell id="vckTE8xcX2gjwNGocpAb-11" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;o&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
44
- <mxGeometry x="465" y="200" width="50" height="50" as="geometry" />
45
- </mxCell>
46
- <mxCell id="vckTE8xcX2gjwNGocpAb-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
47
- <mxGeometry relative="1" as="geometry">
48
- <mxPoint x="209.5" y="310" as="sourcePoint" />
49
- <mxPoint x="209.5" y="260" as="targetPoint" />
50
- </mxGeometry>
51
- </mxCell>
52
- <mxCell id="vckTE8xcX2gjwNGocpAb-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
53
- <mxGeometry relative="1" as="geometry">
54
- <mxPoint x="349.5" y="310" as="sourcePoint" />
55
- <mxPoint x="349.5" y="260" as="targetPoint" />
56
- </mxGeometry>
57
- </mxCell>
58
- <mxCell id="vckTE8xcX2gjwNGocpAb-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
59
- <mxGeometry relative="1" as="geometry">
60
- <mxPoint x="489.5" y="310" as="sourcePoint" />
61
- <mxPoint x="489.5" y="260" as="targetPoint" />
62
- </mxGeometry>
63
- </mxCell>
64
- <mxCell id="vckTE8xcX2gjwNGocpAb-15" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;e&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
65
- <mxGeometry x="185" y="450" width="50" height="50" as="geometry" />
66
- </mxCell>
67
- <mxCell id="vckTE8xcX2gjwNGocpAb-16" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
68
- <mxGeometry x="325" y="450" width="50" height="50" as="geometry" />
69
- </mxCell>
70
- <mxCell id="vckTE8xcX2gjwNGocpAb-17" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;l&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
71
- <mxGeometry x="465" y="450" width="50" height="50" as="geometry" />
72
- </mxCell>
73
- <mxCell id="vckTE8xcX2gjwNGocpAb-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
74
- <mxGeometry relative="1" as="geometry">
75
- <mxPoint x="209.5" y="440" as="sourcePoint" />
76
- <mxPoint x="209.5" y="390" as="targetPoint" />
77
- </mxGeometry>
78
- </mxCell>
79
- <mxCell id="vckTE8xcX2gjwNGocpAb-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
80
- <mxGeometry relative="1" as="geometry">
81
- <mxPoint x="349.5" y="440" as="sourcePoint" />
82
- <mxPoint x="349.5" y="390" as="targetPoint" />
83
- </mxGeometry>
84
- </mxCell>
85
- <mxCell id="vckTE8xcX2gjwNGocpAb-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
86
- <mxGeometry relative="1" as="geometry">
87
- <mxPoint x="489.5" y="440" as="sourcePoint" />
88
- <mxPoint x="489.5" y="390" as="targetPoint" />
89
- </mxGeometry>
90
- </mxCell>
91
- <mxCell id="vckTE8xcX2gjwNGocpAb-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" parent="1" edge="1">
92
- <mxGeometry relative="1" as="geometry">
93
- <mxPoint x="110" y="349.78" as="sourcePoint" />
94
- <mxPoint x="170.5" y="349.78" as="targetPoint" />
95
- </mxGeometry>
96
- </mxCell>
97
- <mxCell id="vckTE8xcX2gjwNGocpAb-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" parent="1" edge="1">
98
- <mxGeometry relative="1" as="geometry">
99
- <mxPoint x="250" y="349.76" as="sourcePoint" />
100
- <mxPoint x="310.5" y="349.76" as="targetPoint" />
101
- </mxGeometry>
102
- </mxCell>
103
- <mxCell id="vckTE8xcX2gjwNGocpAb-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" parent="1" edge="1">
104
- <mxGeometry relative="1" as="geometry">
105
- <mxPoint x="394.75" y="349.76" as="sourcePoint" />
106
- <mxPoint x="455.25" y="349.76" as="targetPoint" />
107
- </mxGeometry>
108
- </mxCell>
109
- <mxCell id="vckTE8xcX2gjwNGocpAb-24" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;sub style=&quot;font-size: 25px;&quot;&gt;1&lt;/sub&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=25;fontStyle=1" parent="1" vertex="1">
110
- <mxGeometry x="110" y="320" width="60" height="30" as="geometry" />
111
- </mxCell>
112
- <mxCell id="vckTE8xcX2gjwNGocpAb-25" value="&lt;font style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;/span&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;sub style=&quot;font-size: 25px;&quot;&gt;2&lt;/sub&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Italianno;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DItalianno;fontSize=25;fontStyle=1" parent="1" vertex="1">
113
- <mxGeometry x="250" y="320" width="60" height="30" as="geometry" />
114
- </mxCell>
115
- <mxCell id="vckTE8xcX2gjwNGocpAb-26" value="&lt;font style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;/span&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;sub style=&quot;font-size: 25px;&quot;&gt;3&lt;/sub&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Italianno;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DItalianno;fontSize=25;fontStyle=1" parent="1" vertex="1">
116
- <mxGeometry x="390" y="320" width="60" height="30" as="geometry" />
117
- </mxCell>
118
- <mxCell id="vckTE8xcX2gjwNGocpAb-27" value="&lt;font face=&quot;Ubuntu&quot; size=&quot;1&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 23px;&quot;&gt;RNN&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
119
- <mxGeometry x="-140" y="320" width="60" height="60" as="geometry" />
120
- </mxCell>
121
- <mxCell id="vckTE8xcX2gjwNGocpAb-28" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;hell&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
122
- <mxGeometry x="-135" y="450" width="50" height="50" as="geometry" />
123
- </mxCell>
124
- <mxCell id="vckTE8xcX2gjwNGocpAb-29" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;ello&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
125
- <mxGeometry x="-135" y="200" width="50" height="50" as="geometry" />
126
- </mxCell>
127
- <mxCell id="vckTE8xcX2gjwNGocpAb-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
128
- <mxGeometry relative="1" as="geometry">
129
- <mxPoint x="-110.25999999999999" y="310" as="sourcePoint" />
130
- <mxPoint x="-110.25999999999999" y="260" as="targetPoint" />
131
- </mxGeometry>
132
- </mxCell>
133
- <mxCell id="vckTE8xcX2gjwNGocpAb-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
134
- <mxGeometry relative="1" as="geometry">
135
- <mxPoint x="-110.25999999999999" y="440" as="sourcePoint" />
136
- <mxPoint x="-110.25999999999999" y="390" as="targetPoint" />
137
- </mxGeometry>
138
- </mxCell>
139
- <mxCell id="vckTE8xcX2gjwNGocpAb-33" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;strokeWidth=3;" parent="1" edge="1">
140
- <mxGeometry width="50" height="50" relative="1" as="geometry">
141
- <mxPoint x="-70" y="350" as="sourcePoint" />
142
- <mxPoint x="30" y="350" as="targetPoint" />
143
- </mxGeometry>
144
- </mxCell>
145
- <mxCell id="vckTE8xcX2gjwNGocpAb-34" value="&lt;b&gt;&lt;font style=&quot;font-size: 19px;&quot; face=&quot;Ubuntu&quot;&gt;Unfold&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
146
- <mxGeometry x="-50" y="290" width="60" height="30" as="geometry" />
147
- </mxCell>
148
- <mxCell id="vckTE8xcX2gjwNGocpAb-35" value="&lt;font size=&quot;1&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 27px;&quot;&gt;f&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
149
- <mxGeometry x="40" y="-50" width="60" height="60" as="geometry" />
150
- </mxCell>
151
- <mxCell id="vckTE8xcX2gjwNGocpAb-36" value="&lt;font color=&quot;#ffffff&quot; face=&quot;Italianno&quot; style=&quot;font-size: 27px;&quot;&gt;f&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
152
- <mxGeometry x="180" y="-50" width="60" height="60" as="geometry" />
153
- </mxCell>
154
- <mxCell id="vckTE8xcX2gjwNGocpAb-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
155
- <mxGeometry relative="1" as="geometry">
156
- <mxPoint x="69.5" y="69" as="sourcePoint" />
157
- <mxPoint x="69.5" y="19" as="targetPoint" />
158
- </mxGeometry>
159
- </mxCell>
160
- <mxCell id="vckTE8xcX2gjwNGocpAb-38" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;c&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
161
- <mxGeometry x="45" y="80" width="50" height="50" as="geometry" />
162
- </mxCell>
163
- <mxCell id="vckTE8xcX2gjwNGocpAb-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
164
- <mxGeometry relative="1" as="geometry">
165
- <mxPoint x="69.5" y="-60" as="sourcePoint" />
166
- <mxPoint x="69.5" y="-110" as="targetPoint" />
167
- </mxGeometry>
168
- </mxCell>
169
- <mxCell id="vckTE8xcX2gjwNGocpAb-40" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;a&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
170
- <mxGeometry x="45" y="-170" width="50" height="50" as="geometry" />
171
- </mxCell>
172
- <mxCell id="vckTE8xcX2gjwNGocpAb-41" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;t&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
173
- <mxGeometry x="185" y="-170" width="50" height="50" as="geometry" />
174
- </mxCell>
175
- <mxCell id="vckTE8xcX2gjwNGocpAb-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
176
- <mxGeometry relative="1" as="geometry">
177
- <mxPoint x="209.5" y="-60" as="sourcePoint" />
178
- <mxPoint x="209.5" y="-110" as="targetPoint" />
179
- </mxGeometry>
180
- </mxCell>
181
- <mxCell id="vckTE8xcX2gjwNGocpAb-43" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;a&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
182
- <mxGeometry x="185" y="80" width="50" height="50" as="geometry" />
183
- </mxCell>
184
- <mxCell id="vckTE8xcX2gjwNGocpAb-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
185
- <mxGeometry relative="1" as="geometry">
186
- <mxPoint x="209.5" y="70" as="sourcePoint" />
187
- <mxPoint x="209.5" y="20" as="targetPoint" />
188
- </mxGeometry>
189
- </mxCell>
190
- <mxCell id="vckTE8xcX2gjwNGocpAb-45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" parent="1" edge="1">
191
- <mxGeometry relative="1" as="geometry">
192
- <mxPoint x="110" y="-20.220000000000027" as="sourcePoint" />
193
- <mxPoint x="170.5" y="-20.220000000000027" as="targetPoint" />
194
- </mxGeometry>
195
- </mxCell>
196
- <mxCell id="vckTE8xcX2gjwNGocpAb-46" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;sub style=&quot;font-size: 25px;&quot;&gt;1&lt;/sub&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=25;fontStyle=1" parent="1" vertex="1">
197
- <mxGeometry x="110" y="-50" width="60" height="30" as="geometry" />
198
- </mxCell>
199
- <mxCell id="vckTE8xcX2gjwNGocpAb-47" value="&lt;font face=&quot;Ubuntu&quot; size=&quot;1&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 23px;&quot;&gt;RNN&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
200
- <mxGeometry x="-140" y="-50" width="60" height="60" as="geometry" />
201
- </mxCell>
202
- <mxCell id="vckTE8xcX2gjwNGocpAb-48" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;ca&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
203
- <mxGeometry x="-135" y="80" width="50" height="50" as="geometry" />
204
- </mxCell>
205
- <mxCell id="vckTE8xcX2gjwNGocpAb-49" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;at&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
206
- <mxGeometry x="-135" y="-170" width="50" height="50" as="geometry" />
207
- </mxCell>
208
- <mxCell id="vckTE8xcX2gjwNGocpAb-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
209
- <mxGeometry relative="1" as="geometry">
210
- <mxPoint x="-110.25999999999999" y="-60" as="sourcePoint" />
211
- <mxPoint x="-110.25999999999999" y="-110" as="targetPoint" />
212
- </mxGeometry>
213
- </mxCell>
214
- <mxCell id="vckTE8xcX2gjwNGocpAb-51" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
215
- <mxGeometry relative="1" as="geometry">
216
- <mxPoint x="-110.25999999999999" y="70" as="sourcePoint" />
217
- <mxPoint x="-110.25999999999999" y="20" as="targetPoint" />
218
- </mxGeometry>
219
- </mxCell>
220
- <mxCell id="vckTE8xcX2gjwNGocpAb-53" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;strokeWidth=3;" parent="1" edge="1">
221
- <mxGeometry width="50" height="50" relative="1" as="geometry">
222
- <mxPoint x="-70" y="-20" as="sourcePoint" />
223
- <mxPoint x="30" y="-20" as="targetPoint" />
224
- </mxGeometry>
225
- </mxCell>
226
- <mxCell id="vckTE8xcX2gjwNGocpAb-54" value="&lt;b&gt;&lt;font style=&quot;font-size: 19px;&quot; face=&quot;Ubuntu&quot;&gt;Unfold&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
227
- <mxGeometry x="-50" y="-80" width="60" height="30" as="geometry" />
228
- </mxCell>
229
- <mxCell id="vckTE8xcX2gjwNGocpAb-55" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=3;rounded=0;" parent="1" edge="1">
230
- <mxGeometry width="50" height="50" relative="1" as="geometry">
231
- <mxPoint x="-225" y="104.82000000000001" as="sourcePoint" />
232
- <mxPoint x="-150" y="105.18" as="targetPoint" />
233
- </mxGeometry>
234
- </mxCell>
235
- <mxCell id="vckTE8xcX2gjwNGocpAb-56" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=3;rounded=0;" parent="1" edge="1">
236
- <mxGeometry width="50" height="50" relative="1" as="geometry">
237
- <mxPoint x="-240" y="474.63" as="sourcePoint" />
238
- <mxPoint x="-165" y="474.99" as="targetPoint" />
239
- </mxGeometry>
240
- </mxCell>
241
- <mxCell id="vckTE8xcX2gjwNGocpAb-57" value="&lt;b&gt;&lt;font style=&quot;font-size: 19px;&quot; face=&quot;Ubuntu&quot;&gt;sequence 1&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
242
- <mxGeometry x="-345" y="90" width="110" height="30" as="geometry" />
243
- </mxCell>
244
- <mxCell id="vckTE8xcX2gjwNGocpAb-58" value="&lt;b&gt;&lt;font style=&quot;font-size: 19px;&quot; face=&quot;Ubuntu&quot;&gt;sequence 2&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
245
- <mxGeometry x="-360" y="460" width="110" height="30" as="geometry" />
246
- </mxCell>
247
- </root>
248
- </mxGraphModel>
249
- </diagram>
250
- </mxfile>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/img/rnn-multi-sequences.png DELETED
Binary file (186 kB)
 
docs/source/img/rnn-one-to-many-ltr.png DELETED
Binary file (11.4 kB)
 
docs/source/img/rnn-one-to-one-ltr.png DELETED
Binary file (5.15 kB)
 
docs/source/img/rnn.drawio DELETED
@@ -1,149 +0,0 @@
1
- <mxfile host="app.diagrams.net" modified="2024-03-19T01:41:00.069Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" etag="gBXA4TJMJ-xFoxQL8in4" version="24.0.7" type="device">
2
- <diagram name="Page-1" id="DUD_6-T85kScICrpKMMz">
3
- <mxGraphModel dx="1783" dy="590" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4
- <root>
5
- <mxCell id="0" />
6
- <mxCell id="1" parent="0" />
7
- <mxCell id="Kn0003oJxsBQeWTrvDDb-1" value="&lt;font size=&quot;1&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 27px;&quot;&gt;f&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
8
- <mxGeometry x="40" y="320" width="60" height="60" as="geometry" />
9
- </mxCell>
10
- <mxCell id="Kn0003oJxsBQeWTrvDDb-2" value="&lt;font color=&quot;#ffffff&quot; face=&quot;Italianno&quot; style=&quot;font-size: 27px;&quot;&gt;f&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
11
- <mxGeometry x="180" y="320" width="60" height="60" as="geometry" />
12
- </mxCell>
13
- <mxCell id="Kn0003oJxsBQeWTrvDDb-4" value="&lt;span style=&quot;color: rgb(255, 255, 255); font-family: Italianno; font-size: 27px;&quot;&gt;f&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
14
- <mxGeometry x="460" y="320" width="60" height="60" as="geometry" />
15
- </mxCell>
16
- <mxCell id="Kn0003oJxsBQeWTrvDDb-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
17
- <mxGeometry relative="1" as="geometry">
18
- <mxPoint x="69.5" y="439" as="sourcePoint" />
19
- <mxPoint x="69.5" y="389" as="targetPoint" />
20
- </mxGeometry>
21
- </mxCell>
22
- <mxCell id="Kn0003oJxsBQeWTrvDDb-6" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;x&lt;sub&gt;1&lt;/sub&gt;&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
23
- <mxGeometry x="45" y="450" width="50" height="50" as="geometry" />
24
- </mxCell>
25
- <mxCell id="Kn0003oJxsBQeWTrvDDb-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
26
- <mxGeometry relative="1" as="geometry">
27
- <mxPoint x="69.5" y="310" as="sourcePoint" />
28
- <mxPoint x="69.5" y="260" as="targetPoint" />
29
- </mxGeometry>
30
- </mxCell>
31
- <mxCell id="Kn0003oJxsBQeWTrvDDb-8" value="&lt;font face=&quot;Ubuntu&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;o&lt;sub&gt;1&lt;/sub&gt;&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
32
- <mxGeometry x="45" y="200" width="50" height="50" as="geometry" />
33
- </mxCell>
34
- <mxCell id="Kn0003oJxsBQeWTrvDDb-9" value="&lt;b style=&quot;font-family: Ubuntu; font-size: 20px;&quot;&gt;o&lt;/b&gt;&lt;b style=&quot;font-family: Ubuntu; font-size: 16.6667px;&quot;&gt;&lt;sub&gt;2&lt;/sub&gt;&lt;/b&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
35
- <mxGeometry x="185" y="200" width="50" height="50" as="geometry" />
36
- </mxCell>
37
- <mxCell id="Kn0003oJxsBQeWTrvDDb-11" value="&lt;b style=&quot;font-family: Ubuntu; font-size: 20px;&quot;&gt;o&lt;/b&gt;&lt;b style=&quot;font-family: Ubuntu; font-size: 13.8889px;&quot;&gt;n&lt;/b&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
38
- <mxGeometry x="465" y="200" width="50" height="50" as="geometry" />
39
- </mxCell>
40
- <mxCell id="Kn0003oJxsBQeWTrvDDb-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
41
- <mxGeometry relative="1" as="geometry">
42
- <mxPoint x="209.5" y="310" as="sourcePoint" />
43
- <mxPoint x="209.5" y="260" as="targetPoint" />
44
- </mxGeometry>
45
- </mxCell>
46
- <mxCell id="Kn0003oJxsBQeWTrvDDb-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
47
- <mxGeometry relative="1" as="geometry">
48
- <mxPoint x="489.5" y="310" as="sourcePoint" />
49
- <mxPoint x="489.5" y="260" as="targetPoint" />
50
- </mxGeometry>
51
- </mxCell>
52
- <mxCell id="Kn0003oJxsBQeWTrvDDb-15" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;x&lt;sub&gt;2&lt;/sub&gt;&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
53
- <mxGeometry x="185" y="450" width="50" height="50" as="geometry" />
54
- </mxCell>
55
- <mxCell id="Kn0003oJxsBQeWTrvDDb-17" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;font-size: 16.6667px;&quot;&gt;&lt;sub&gt;n&lt;/sub&gt;&lt;/span&gt;&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
56
- <mxGeometry x="465" y="450" width="50" height="50" as="geometry" />
57
- </mxCell>
58
- <mxCell id="Kn0003oJxsBQeWTrvDDb-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
59
- <mxGeometry relative="1" as="geometry">
60
- <mxPoint x="209.5" y="440" as="sourcePoint" />
61
- <mxPoint x="209.5" y="390" as="targetPoint" />
62
- </mxGeometry>
63
- </mxCell>
64
- <mxCell id="Kn0003oJxsBQeWTrvDDb-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
65
- <mxGeometry relative="1" as="geometry">
66
- <mxPoint x="489.5" y="440" as="sourcePoint" />
67
- <mxPoint x="489.5" y="390" as="targetPoint" />
68
- </mxGeometry>
69
- </mxCell>
70
- <mxCell id="Kn0003oJxsBQeWTrvDDb-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" parent="1" edge="1">
71
- <mxGeometry relative="1" as="geometry">
72
- <mxPoint x="110" y="349.78" as="sourcePoint" />
73
- <mxPoint x="170.5" y="349.78" as="targetPoint" />
74
- </mxGeometry>
75
- </mxCell>
76
- <mxCell id="Kn0003oJxsBQeWTrvDDb-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" parent="1" edge="1">
77
- <mxGeometry relative="1" as="geometry">
78
- <mxPoint x="250" y="349.76" as="sourcePoint" />
79
- <mxPoint x="310.5" y="349.76" as="targetPoint" />
80
- </mxGeometry>
81
- </mxCell>
82
- <mxCell id="Kn0003oJxsBQeWTrvDDb-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#B266FF;fontColor=#FF6666;" parent="1" edge="1">
83
- <mxGeometry relative="1" as="geometry">
84
- <mxPoint x="394.75" y="349.76" as="sourcePoint" />
85
- <mxPoint x="455.25" y="349.76" as="targetPoint" />
86
- </mxGeometry>
87
- </mxCell>
88
- <mxCell id="Kn0003oJxsBQeWTrvDDb-24" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=Italianno&quot; face=&quot;Italianno&quot; style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;sub style=&quot;font-size: 25px;&quot;&gt;1&lt;/sub&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=25;fontStyle=1" parent="1" vertex="1">
89
- <mxGeometry x="110" y="320" width="60" height="30" as="geometry" />
90
- </mxCell>
91
- <mxCell id="Kn0003oJxsBQeWTrvDDb-25" value="&lt;font style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;h&lt;/span&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;sub style=&quot;font-size: 25px;&quot;&gt;2&lt;/sub&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Italianno;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DItalianno;fontSize=25;fontStyle=1" parent="1" vertex="1">
92
- <mxGeometry x="250" y="320" width="60" height="30" as="geometry" />
93
- </mxCell>
94
- <mxCell id="Kn0003oJxsBQeWTrvDDb-26" value="&lt;font style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;&lt;span style=&quot;font-size: 25px;&quot;&gt;hn&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Italianno;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DItalianno;fontSize=25;fontStyle=1" parent="1" vertex="1">
95
- <mxGeometry x="390" y="320" width="60" height="30" as="geometry" />
96
- </mxCell>
97
- <mxCell id="Kn0003oJxsBQeWTrvDDb-27" value="&lt;font face=&quot;Ubuntu&quot; size=&quot;1&quot; style=&quot;&quot; color=&quot;#ffffff&quot;&gt;&lt;b style=&quot;font-size: 23px;&quot;&gt;RNN&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=none;fontColor=#FF6666;" parent="1" vertex="1">
98
- <mxGeometry x="-140" y="320" width="60" height="60" as="geometry" />
99
- </mxCell>
100
- <mxCell id="Kn0003oJxsBQeWTrvDDb-28" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;font-size: 20px;&quot;&gt;&lt;b&gt;seq&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" parent="1" vertex="1">
101
- <mxGeometry x="-135" y="450" width="50" height="50" as="geometry" />
102
- </mxCell>
103
- <mxCell id="Kn0003oJxsBQeWTrvDDb-29" value="&lt;font size=&quot;1&quot; face=&quot;Ubuntu&quot;&gt;&lt;b style=&quot;font-size: 13px;&quot;&gt;output&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" parent="1" vertex="1">
104
- <mxGeometry x="-135" y="200" width="50" height="50" as="geometry" />
105
- </mxCell>
106
- <mxCell id="Kn0003oJxsBQeWTrvDDb-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
107
- <mxGeometry relative="1" as="geometry">
108
- <mxPoint x="-110.25999999999999" y="310" as="sourcePoint" />
109
- <mxPoint x="-110.25999999999999" y="260" as="targetPoint" />
110
- </mxGeometry>
111
- </mxCell>
112
- <mxCell id="Kn0003oJxsBQeWTrvDDb-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;strokeWidth=3;strokeColor=#6666FF;fontColor=#FF6666;" parent="1" edge="1">
113
- <mxGeometry relative="1" as="geometry">
114
- <mxPoint x="-110.25999999999999" y="440" as="sourcePoint" />
115
- <mxPoint x="-110.25999999999999" y="390" as="targetPoint" />
116
- </mxGeometry>
117
- </mxCell>
118
- <mxCell id="Kn0003oJxsBQeWTrvDDb-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;strokeWidth=3;curved=1;" parent="1" source="Kn0003oJxsBQeWTrvDDb-27" target="Kn0003oJxsBQeWTrvDDb-27" edge="1">
119
- <mxGeometry relative="1" as="geometry">
120
- <Array as="points">
121
- <mxPoint x="-125" y="290" />
122
- <mxPoint x="-210" y="290" />
123
- <mxPoint x="-210" y="410" />
124
- <mxPoint x="-125" y="410" />
125
- </Array>
126
- </mxGeometry>
127
- </mxCell>
128
- <mxCell id="Kn0003oJxsBQeWTrvDDb-33" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;strokeWidth=3;" parent="1" edge="1">
129
- <mxGeometry width="50" height="50" relative="1" as="geometry">
130
- <mxPoint x="-70" y="350" as="sourcePoint" />
131
- <mxPoint x="30" y="350" as="targetPoint" />
132
- </mxGeometry>
133
- </mxCell>
134
- <mxCell id="Kn0003oJxsBQeWTrvDDb-34" value="&lt;b&gt;&lt;font style=&quot;font-size: 19px;&quot; face=&quot;Ubuntu&quot;&gt;Unfold&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
135
- <mxGeometry x="-50" y="290" width="60" height="30" as="geometry" />
136
- </mxCell>
137
- <mxCell id="phTSMtF67GbWN2Al6Nvf-5" value="&lt;b&gt;&lt;font style=&quot;font-size: 25px;&quot; face=&quot;Ubuntu&quot;&gt;. . .&lt;/font&gt;&lt;/b&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
138
- <mxGeometry x="323" y="330" width="60" height="30" as="geometry" />
139
- </mxCell>
140
- <mxCell id="phTSMtF67GbWN2Al6Nvf-6" value="&lt;b style=&quot;font-family: Ubuntu; font-size: 20px;&quot;&gt;o&lt;/b&gt;&lt;b style=&quot;font-family: Ubuntu; font-size: 13.8889px;&quot;&gt;&lt;sub&gt;i&lt;/sub&gt;&lt;/b&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FF3399;fontColor=#FFFFFF;" vertex="1" parent="1">
141
- <mxGeometry x="323" y="200" width="50" height="50" as="geometry" />
142
- </mxCell>
143
- <mxCell id="phTSMtF67GbWN2Al6Nvf-7" value="&lt;font face=&quot;Ubuntu&quot; style=&quot;&quot;&gt;&lt;b style=&quot;&quot;&gt;&lt;span style=&quot;font-size: 20px;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;font-size: 13.8889px;&quot;&gt;&lt;sub&gt;i&lt;/sub&gt;&lt;/span&gt;&lt;/b&gt;&lt;/font&gt;" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#00CC00;fontColor=#FFFFFF;" vertex="1" parent="1">
144
- <mxGeometry x="323" y="450" width="50" height="50" as="geometry" />
145
- </mxCell>
146
- </root>
147
- </mxGraphModel>
148
- </diagram>
149
- </mxfile>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/img/rnn.png DELETED
Binary file (101 kB)
 
docs/source/img/sampling-sound-wave.gif DELETED
Binary file (104 kB)
 
docs/source/img/sound-wave.png DELETED
Binary file (155 kB)
 
docs/source/img/speech-processing.png DELETED
Binary file (127 kB)
 
docs/source/index.rst DELETED
@@ -1,46 +0,0 @@
1
- =====================
2
- Lamassu documentation
3
- =====================
4
-
5
-
6
- Getting help
7
- ============
8
-
9
- Having trouble? We'd like to help!
10
-
11
- * Try the :doc:`FAQ <faq>` -- it's got answers to some common questions.
12
- * Looking for specific information? Try the :ref:`genindex` or :ref:`modindex`.
13
- * Report bugs with lamassu in our `issue tracker`_.
14
- * Join the Discord community `Lamassu Discord`_.
15
-
16
- .. hint::
17
- * Since methods with two underscores (`__`) cannot be tested due to the
18
- `name mangling <https://qubitpi.github.io/cpython/tutorial/classes.html#private-variables>`_. Lamassu requires
19
- all private methods and attributes to be prefixed with **single underscore prefix (`_`) only**
20
- * The phrase "Chinese" used throughout this documentation referse to "**Simplified Chinese**", instead of
21
- "Traditional Chinese"
22
-
23
-
24
- First Steps
25
- ===========
26
-
27
- .. toctree::
28
- :caption: First steps
29
- :hidden:
30
-
31
- intro/install
32
-
33
- :doc:`intro/install`
34
- Get lamassu installed on your computer.
35
-
36
-
37
- Usage
38
- =====
39
-
40
- .. toctree::
41
- :maxdepth: 100
42
-
43
- lamassu
44
-
45
- .. _issue tracker: https://github.com/QubitPi/lamassu/issues
46
- .. _Lamassu Discord: https://discord.com/widget?id=1208960229002317934&theme=dark
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/intro/install.rst DELETED
@@ -1,54 +0,0 @@
1
- .. _intro-install:
2
-
3
- ==================
4
- Installation guide
5
- ==================
6
-
7
-
8
- Supported Python versions
9
- =========================
10
-
11
- Lamassu has been tested with Python 3.10. It may work with older versions of Python but it is not guaranteed.
12
-
13
-
14
- Installing Lamassu
15
- ==================
16
-
17
- If you are already familiar with installation of Python packages, we can install Lamassu and its dependencies from
18
- `PyPI <https://pypi.org/project/lamassu/>`_ with::
19
-
20
- pip3 install lamassu
21
-
22
- We strongly recommend that you install Lamassu in :ref:`a dedicated virtualenv <intro-using-virtualenv>`, to avoid
23
- conflicting with your system packages.
24
-
25
- If you're using `Anaconda <https://docs.anaconda.com/anaconda/>`_ or
26
- `Miniconda <https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html>`_, please allow me to
27
- apologize because I hate those two, so we won't install the package from there.
28
-
29
-
30
- Installing from Source
31
- ======================
32
-
33
- When we want to apply a bug fix quicly by installing Lamassu locally, we can use::
34
-
35
- git clone https://github.com/QubitPi/lamassu.git
36
- cd lamassu
37
- pip3 install -e .
38
-
39
-
40
- .. _intro-using-virtualenv:
41
-
42
- Using a virtual environment (recommended)
43
- -----------------------------------------
44
-
45
- We recommend installing lamassu a virtual environment on all platforms.
46
-
47
- Python packages can be installed either globally (a.k.a system wide), or in user-space. We do not recommend installing
48
- lamassu system wide. Instead, we recommend installing lamassu within a "virtual environment" (:mod:`venv`),
49
- which keep you from conflicting with already-installed Python system packages.
50
-
51
- See :ref:`tut-venv` on how to create your virtual environment.
52
-
53
- Once you have created a virtual environment, we can install lamassu inside it with ``pip3``, just like any other
54
- Python package.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/lamassu.rst DELETED
@@ -1,9 +0,0 @@
1
- =======
2
- Lamassu
3
- =======
4
-
5
- .. toctree::
6
- :maxdepth: 100
7
-
8
- rnn/rnn
9
- speech/sampling.rst
 
 
 
 
 
 
 
 
 
 
docs/source/requirements.txt DELETED
@@ -1,7 +0,0 @@
1
- sphinx==5.0.2
2
- sphinx-hoverxref==1.1.1
3
- sphinx-notfound-page==0.8
4
- sphinx-rtd-theme==1.0.0
5
- pycodestyle
6
- requests
7
- pyan3
 
 
 
 
 
 
 
 
docs/source/rnn/rnn.rst DELETED
@@ -1,612 +0,0 @@
1
- ================================================
2
- Introduction to Recurrent Neural Networks (RNNs)
3
- ================================================
4
-
5
- .. admonition:: Prerequisite
6
-
7
- This article has the following prerequisites:
8
-
9
- 1. *Chapter 4 - Artificial Neural Networks* (p. 81) of `MACHINE LEARNING by Mitchell, Thom M. (1997)`_ Paperback
10
- 2. *Deep Learning (Adaptive Computation and Machine Learning series), Ian Goodfellow*
11
-
12
- .. contents:: Table of Contents
13
- :depth: 2
14
-
15
- We all heard of this buz word "LLM" (Large Language Model). But let's put that aside for just a second and look at a
16
- much simpler one called "character-level language model" where, for example, we input a prefix of a word such as
17
- "hell" and the model outputs a complete word "hello". That is, this language model predicts the next character of a
18
- character sequence
19
-
20
- This is like a Math function where we have:
21
-
22
- .. math::
23
-
24
- f(\text{“hell"}) = \text{“hello"}
25
-
26
- .. NOTE::
27
-
28
- We call inputs like "hell" as **sequence**
29
-
30
- How do we obtain a function like this? One approach is to have 4 black boxes, each of which takes a single character as
31
- input and calculates an output:
32
-
33
- .. figure:: ../img/rnn-4-black-boxes.png
34
- :align: center
35
- :width: 50%
36
-
37
- But one might have noticed that if the 3rd function (box) produces :math:`f(‘l') = ‘l'`, then why would the 4th function
38
- (box), given the same input, gives a different output of 'o'? This suggest that we should take the "**history**" into
39
- account. Instead of having :math:`f` depend on 1 parameter, we now have it take 2 parameters.
40
-
41
- 1: a character;
42
- 2: a variable that summarizes the previous calculations:
43
-
44
- .. figure:: ../img/rnn-4-black-boxes-connected.png
45
- :align: center
46
- :width: 50%
47
-
48
- Now it makes much more sense with:
49
-
50
- .. math::
51
-
52
- f(\text{‘l'}, h_2) = \text{‘l'}
53
-
54
- f(\text{‘l'}, h_3) = \text{‘o'}
55
-
56
- But what if we want to predict a longer or shorter word? For example, how about predicting "cat" by "ca"? That's simple,
57
- we will have 2 black boxes to do the work.
58
-
59
- .. figure:: ../img/rnn-multi-sequences.png
60
- :align: center
61
-
62
- What if the function :math:`f` is not smart enough to produce the correct output everytime? We will simply collect a lot
63
- of examples such as "cat" and "hello", and feed them into the boxes to train them until they can output correct
64
- vocabulary like "cat" and "hello".
65
-
66
- This is the idea behind RNN
67
-
68
- - It's recurrent because the boxed function gets invoked repeatedly for each element of the sequence. In the case of our
69
- character-level language model, element is a character such as "e" and sequence is a string like "hell"
70
-
71
- .. figure:: ../img/rnn.png
72
- :align: center
73
-
74
- Each function :math:`f` is a network unit containing 2 perceptrons. One perceptron computes the "history" like
75
- :math:`h_1`, :math:`h_2`, :math:`h_3`. Its formula is very similar to that of perceptron:
76
-
77
- .. math::
78
-
79
- h^{(t)} = g_1\left( W_{hh}h^{(t - 1)} + W_{xh}x^{(t)} + b_h \right)
80
-
81
- where :math:`t` is the index of the "black boxes" shown above. In our example of "hell",
82
- :math:`t \in \{ 1, 2, 3, 4 \}`
83
-
84
- The other perceptron computes the output like 'e', 'l', 'l', 'o'. We call those value :math:`y` which is computed as
85
-
86
- .. math::
87
-
88
- o^{(t)} = g_2\left( W_{yh}h^{(t)} + b_o \right)
89
-
90
- .. admonition:: What are :math:`g_1` and :math:`g_2`?
91
-
92
- They are *activation functions* which are used to change the linear function in a perceptron to a non-linear
93
- function. Please refer to `MACHINE LEARNING by Mitchell, Thom M. (1997)`_ Paperback (page 96) for why we bump it
94
- to non-linear
95
-
96
- A typical activation function for :math:`g_1` is :math:`tanh`:
97
-
98
- .. math::
99
-
100
- tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}}
101
-
102
- In practice, :math:`g_2` is constance, i.e. :math:`g_2 = 1`
103
-
104
-
105
- Forward Propagation Equations for RNN
106
- -------------------------------------
107
-
108
- We now develop the forward propagation equations for the RNN. We assume the hyperbolic tangent activation function and
109
- that the output is discrete, as if the RNN is used to predict words or characters. A natural way to represent discrete
110
- variables is to regard the output :math:`\boldsymbol{o}` as giving the unnormalized log probabilities of each possible value of
111
- the discrete variable. We can then apply the softmax (we will disucss softmax function in the next section) operation as
112
- a post-processing step to obtain a vector :math:`\boldsymbol{\hat{y}}` of normalized probabilities over the output. Forward
113
- propagation begins with a specification of the initial state :math:`\boldsymbol{h}^{(0)}`. Then, for each time step from
114
- :math:`t = 1` to :math:`t = \tau`, we apply the following update equations:
115
-
116
- .. math::
117
-
118
- \color{green} \boxed{
119
- \begin{gather*}
120
- \boldsymbol{h}^{(t)} = \tanh\left( \boldsymbol{W_{hh}}h^{(t - 1)} + \boldsymbol{W_{xh}}x^{(t)} + \boldsymbol{b_h} \right) \\ \\
121
- \boldsymbol{o}^{(t)} = \boldsymbol{W_{yh}}\boldsymbol{h}^{(t)} + \boldsymbol{b_o} \\ \\
122
- \boldsymbol{\hat{y}} = softmax(\boldsymbol{o}^{(t)})
123
- \end{gather*}
124
- }
125
-
126
- Note that this recurrent network maps an input sequence to an output sequence of the same length.
127
-
128
- Loss Function of RNN
129
- --------------------
130
-
131
- According to the discussion of `MACHINE LEARNING by Mitchell, Thom M. (1997)`_, the key for training RNN or any neural
132
- network is through "specifying a measure for the training error". We call this measure a *loss function*.
133
-
134
- In RNN, the total loss for a given sequence of input :math:`\boldsymbol{x}` paired with a sequence of expected
135
- :math:`\boldsymbol{y}` is the sum of the losses over all the time steps, i.e.
136
-
137
- .. math::
138
-
139
- \mathcal{L}\left( \{ \boldsymbol{x}^{(1)}, ..., \boldsymbol{x}^{(\tau)} \}, \{ \boldsymbol{y}^{(1)}, ..., \boldsymbol{y}^{(\tau)} \} \right) = \sum_t^{\tau} \mathcal{L}^{(t)} = \sum_t^{\tau}\log\boldsymbol{\hat{y}}^{(t)}
140
-
141
- Why would we have :math:`\mathcal{L}^{(t)} = \log\boldsymbol{\hat{y}}^{(t)}`? We need to learn *Softmax Activation* first.
142
-
143
- .. admonition:: Softmax Function by `Wikipedia <https://en.wikipedia.org/wiki/Softmax_function>`_
144
-
145
- The softmax function takes as input a vector :math:`z` of :math:`K` real numbers, and normalizes it into a
146
- probability distribution consisting of :math:`K` probabilities proportional to the exponentials of the input
147
- numbers. That is, prior to applying softmax, some vector components could be negative, or greater than one; and
148
- might not sum to 1; but after applying softmax, each component will be in the interval :math:`(0, 1)` and the
149
- components will add up to 1, so that they can be interpreted as probabilities. Furthermore, the larger input
150
- components will correspond to larger probabilities.
151
-
152
- For a vector :math:`z` of :math:`K` real numbers, the the standard (unit) softmax function
153
- :math:`\sigma: \mathbb{R}^K \mapsto (0, 1)^K`, where :math:`K \ge 1` is defined by
154
-
155
- .. math::
156
-
157
- \sigma(\boldsymbol{z})_i = \frac{e^{z_i}}{\sum_{j = 1}^Ke^{z_j}}
158
-
159
- where :math:`i = 1, 2, ..., K` and :math:`\boldsymbol{x} = (x_1, x_2, ..., x_K) \in \mathbb{R}^K`
160
-
161
- In the context of RNN,
162
-
163
- .. math::
164
-
165
- \sigma(\boldsymbol{o})_i = -\frac{e^{o_i}}{\sum_{j = 1}^ne^{o_j}}
166
-
167
- where
168
-
169
- - :math:`n` is the length of a sequence feed into the RNN
170
- - :math:`o_i` is the output by perceptron unit `i`
171
- - :math:`i = 1, 2, ..., n`,
172
- - :math:`\boldsymbol{o} = (o_1, o_2, ..., o_n) \in \mathbb{R}^n`
173
-
174
- The softmax function takes an N-dimensional vector of arbitrary real values and produces another N-dimensional vector
175
- with real values in the range (0, 1) that add up to 1.0. It maps :math:`\mathbb{R}^N \rightarrow \mathbb{R}^N`
176
-
177
- .. math::
178
-
179
- \sigma(\boldsymbol{o}): \begin{pmatrix}o_1\\o_2\\\dots\\o_n\end{pmatrix} \rightarrow \begin{pmatrix}\sigma_1\\\sigma_2\\\dots\\\sigma_n\end{pmatrix}
180
-
181
- This property of softmax function that it outputs a probability distribution makes it suitable for probabilistic
182
- interpretation in classification tasks. Neural networks, however, are commonly trained under a log loss (or
183
- cross-entropy) regime
184
-
185
- We are going to compute the derivative of the softmax function because we will be using it for training our RNN model
186
- shortly. But before diving in, it is important to keep in mind that Softmax is fundamentally a vector function. It takes
187
- a vector as input and produces a vector as output; in other words, it has multiple inputs and multiple outputs.
188
- Therefore, we cannot just ask for "the derivative of softmax"; We should instead specify:
189
-
190
- 1. Which component (output element) of softmax we're seeking to find the derivative of.
191
- 2. Since softmax has multiple inputs, with respect to which input element the partial derivative is computed.
192
-
193
- What we're looking for is the partial derivatives of
194
-
195
- .. math::
196
-
197
- \frac{\partial \sigma_i}{\partial o_k} = \frac{\partial }{\partial o_k} \frac{e^{o_i}}{\sum_{j = 1}^ne^{o_j}}
198
-
199
-
200
- :math:`\frac{\partial \sigma_i}{\partial o_k}` **is the partial derivative of the i-th output with respect with the
201
- k-th input**.
202
-
203
- We'll be using the quotient rule of derivatives. For :math:`h(x) = \frac{f(x)}{g(x)}` where both :math:`f` and :math:`g`
204
- are differentiable and :math:`g(x) \ne 0`, The `quotient rule <https://en.wikipedia.org/wiki/Quotient_rule>`_ states
205
- that the derivative of :math:`h(x)` is
206
-
207
- .. math::
208
-
209
- h'(x) = \frac{f'(x)g(x) - f(x)g'(x)}{g^2(x)}
210
-
211
- In our case, we have
212
-
213
- .. math::
214
-
215
- f'(o_k) = \frac{\partial}{\partial o_k} e^{o_i} = \begin{cases}
216
- e^{o_k}, & \text{if}\ i = k \\
217
- 0, & \text{otherwise}
218
- \end{cases}
219
-
220
- .. math::
221
-
222
- g'(o_k) = \frac{\partial}{\partial o_k} \sum_{j = 1}^ne^{o_j} = \left( \frac{\partial e^{o_1}}{\partial o_k} + \frac{\partial e^{o_2}}{\partial o_k} + \dots + \frac{\partial e^{o_k}}{\partial o_k} + \dots + \frac{\partial e^{o_n}}{\partial o_k} \right) = \frac{\partial e^{o_k}}{\partial o_k} = e^{o_k}
223
-
224
- The rest of it becomes trivial then. When :math:`i = k`,
225
-
226
- .. math::
227
-
228
- \frac{\partial \sigma_i}{\partial o_k} = \frac{e^{o_k} \sum_{j = 1}^ne^{o_j} - e^{o_k} e^{o_i}}{\left( \sum_{j = 1}^ne^{o_j} \right)^2}
229
- = \frac{e^{o_i} \sum_{j = 1}^ne^{o_j} - e^{o_i} e^{o_i}}{\left( \sum_{j = 1}^ne^{o_j} \right)^2}
230
- = \frac{e^{o_i}}{\sum_{j = 1}^ne^{o_j}} \frac{\sum_{j = 1}^ne^{o_j} - e^{o_i}}{\sum_{j = 1}^ne^{o_j}} \\
231
-
232
- = \sigma_i\left( \frac{\sum_{j = 1}^ne^{o_j}}{\sum_{j = 1}^ne^{o_j}} - \frac{e^{o_i}}{\sum_{j = 1}^ne^{o_j}} \right)
233
- = \sigma_i \left( 1 - \sigma_i \right)
234
-
235
- When :math:`i \ne k`
236
-
237
- .. math::
238
-
239
- \frac{\partial \sigma_i}{\partial o_k} = \frac{-e^{o_k} e^{o_i}}{\left( \sum_{j = 1}^ne^{o_j} \right)^2} = -\sigma_i\sigma_k
240
-
241
- This concludes the derivative of the softmax function:
242
-
243
- .. math::
244
-
245
- \frac{\partial \sigma_i}{\partial o_k} = \begin{cases}
246
- \sigma_i \left( 1 - \sigma_i \right), & \text{if}\ i = k \\
247
- -\sigma_i\sigma_k, & \text{otherwise}
248
- \end{cases}
249
-
250
- Cross-Entropy
251
- """""""""""""
252
-
253
- .. admonition:: Cross-Entropy `Wikipedia <https://en.wikipedia.org/wiki/Cross-entropy>`_
254
-
255
- In information theory, the cross-entropy between two probability distributions :math:`p` and :math:`q` over the same
256
- underlying set of events measures the average number of bits needed to identify an event drawn from the set if a
257
- coding scheme used for the set is optimized for an estimated probability distribution :math:`q`, rather than the
258
- true distribution :math:`p`
259
-
260
- Confused? Let's put it in the context of Machine Learning.
261
-
262
- Machine Learning sees the world based on probability. The "probability distribution" identifies the various tasks to
263
- learn. For example, a daily language such as English or Chinese, can be seen as a probability distribution. The
264
- probability of "name" followed by "is" is far greater than "are" as in "My name is Jack". We call such language
265
- distribution :math:`p`. The task of RNN (or Machine Learning in general) is to learn an approximated distribution of
266
- :math:`p`; we call this approximation :math:`q`
267
-
268
- "The average number of bits needed" is can be seen as the distance between :math:`p` and :math:`q` given an event. In
269
- analogy of language, this can be the *quantitative* measure of the deviation between a real language phrase
270
- "My name is Jack" and "My name are Jack".
271
-
272
- At this point, it is easy to image that, in the Machine Learning world, the cross entropy indicates the distance between
273
- what the model believes the output distribution should be and what the original distribution really is.
274
-
275
- Now we have an intuitive understanding of cross entropy, let's formally define it.
276
-
277
- The cross-entropy of the discrete probability distribution :math:`q` relative to a distribution :math:`p` over a given
278
- set is defined as
279
-
280
- .. math::
281
-
282
- H(p, q) = -\sum_x p(x)\log q(x)
283
-
284
- In RNN, the probability distribution of :math:`q(x)` is exactly the softmax function we defined earlier:
285
-
286
- .. math::
287
-
288
- \mathcal{L} = -\sum_i p(i)\log\sigma(\boldsymbol{o})_i = -\sum_i \log\sigma(\boldsymbol{o})_i = -\log\boldsymbol{\hat{y}}^{(t)}
289
-
290
- where
291
-
292
- - :math:`\boldsymbol{o}` is the predicted sequence by RNN and :math:`o_i` is the i-th element of the predicted sequence
293
-
294
- .. admonition:: What is the Mathematical form of :math:`p(i)` in RNN? Why would it become 1?
295
-
296
- By definition, :math:`p(i)` is the *true* distribution whose exact functional form is unknown. In the language of
297
- Approximation Theory, :math:`p(i)` is the function that RNN is trying to learn or approximate mathematically.
298
-
299
- Although the :math:`p(i)` makes the exact form of :math:`\mathcal{L}` unknown, computationally :math:`p(i)` is
300
- perfectly defined in each training example. Taking our "hello" example:
301
-
302
- .. figure:: ../img/char-level-language-model.png
303
- :align: center
304
- :width: 60%
305
-
306
- The 4 probability distributions of :math:`q(x)` is "reflected" in the **output layer** of this example. They are
307
- "reflecting" the probability distribution of :math:`q(x)` because they are only :math:`o` values and have not been
308
- transformed to the :math:`\sigma` distribution yet. But in this case, we are 100% sure that the true probability
309
- distribution :math:`p(i)` for the 4 outputs are
310
-
311
- .. math::
312
-
313
- \begin{pmatrix}0\\1\\0\\0\end{pmatrix}, \begin{pmatrix}0\\0\\1\\0\end{pmatrix}, \begin{pmatrix}0\\0\\1\\0\end{pmatrix}, \begin{pmatrix}0\\0\\0\\1\end{pmatrix}
314
-
315
- respectively. *That is all we need for calculating the* :math:`\mathcal{L}`
316
-
317
- Deriving Gradient Descent Weight Update Rule
318
- --------------------------------------------
319
-
320
- *Training a RNN model of is the same thing as searching for the optimal values for the following parameters of these two
321
- perceptrons*:
322
-
323
- 1. :math:`W_{xh}`
324
- 2. :math:`W_{hh}`
325
- 3. :math:`W_{yh}`
326
- 4. :math:`b_h`
327
- 5. :math:`b_o`
328
-
329
- By the Gradient Descent discussed in `MACHINE LEARNING by Mitchell, Thom M. (1997)`_ tells us we should derive the
330
- weight updat rule by *taking partial derivatives with respect to all of the variables above*. Let's start with
331
- :math:`W_{yh}`
332
-
333
- `MACHINE LEARNING by Mitchell, Thom M. (1997)`_ has mentioned gradients and partial derivatives as being important for
334
- an optimization algorithm to update, say, the model weights of a neural network to reach an optimal set of weights. The
335
- use of partial derivatives permits each weight to be updated independently of the others, by calculating the gradient of
336
- the error curve with respect to each weight in turn.
337
-
338
- Many of the functions that we usually work with in machine learning are *multivariate*, *vector-valued* functions, which
339
- means that they map multiple real inputs :math:`n` to multiple real outputs :math:`m`:
340
-
341
- .. math::
342
-
343
- f: \mathbb{R}^n \rightarrow \mathbb{R}^m
344
-
345
- In training a neural network, the backpropagation algorithm is responsible for sharing back the error calculated at the
346
- output layer among the neurons comprising the different hidden layers of the neural network, until it reaches the input.
347
-
348
- If our RNN contains only 1 perceptron unit, the error is propagated back by, using the
349
- `Chain Rule <https://en.wikipedia.org/wiki/Chain_rule>`_ of :math:`\frac{dz}{dx} = \frac{dz}{dy}\frac{dy}{dx}`:
350
-
351
- .. math::
352
-
353
- \frac{\partial \mathcal{L}}{\partial W} = \frac{\partial \mathcal{L}}{\partial o}\frac{\partial o}{\partial W}
354
-
355
- Note that in the RNN mode, :math:`\mathcal{L}` is not a direct function of :math:`W`. Thus its first order derivative
356
- cannot be computed unless we connect the :math:`\mathcal{L}` to :math:`o` first and then to :math:`W`, because both the
357
- first order derivatives of :math:`\frac{\partial \mathcal{L}}{\partial o}` and :math:`\frac{\partial o}{\partial W}` are
358
- defined by the model
359
-
360
- It is more often the case that we'd have many connected perceptrons populating the network, each attributed a different
361
- weight. Since this is the case for RNN, we can generalise multiple inputs and multiple outputs using the **Generalized
362
- Chain Rule**:
363
-
364
- Consider the case where :math:`x \in \mathbb{R}^m` and :math:`u \in \mathbb{R}^n`; an inner function, :math:`f`, maps
365
- :math:`m` inputs to :math:`n` outputs, while an outer function, :math:`g`, receives :math:`n` inputs to produce an
366
- output, :math:`h \in \mathbb{R}^k`. For :math:`i = 1, \dots, m` the generalized chain rule states:
367
-
368
- .. math::
369
-
370
- \frac{\partial h}{\partial x_i} = \frac{\partial h}{\partial u_1} \frac{\partial u_1}{\partial x_i} + \frac{\partial h}{\partial u_2} \frac{\partial u_2}{\partial x_i} + \dots + \frac{\partial h}{\partial u_n} \frac{\partial u_n}{\partial x_i} = \sum_{j = 1}^n \frac{\partial h}{\partial u_j} \frac{\partial u_j}{\partial x_i}
371
-
372
- Therefore, the error propagation of Gradient Descent in RNN is
373
-
374
- .. math::
375
-
376
- \color{green} \boxed{
377
- \begin{align}
378
- \frac{\partial \mathcal{L}}{\partial W_{yh}} = \sum_{t = 1}^\tau \sum_{i = 1}^n \frac{\partial \mathcal{L}}{\partial o_i^{(t)}} \frac{\partial o_i^{(t)}}{\partial W_{yh}} \\ \\
379
- \frac{\partial \mathcal{L}}{\partial W_{hh}} = \sum_{t = 1}^\tau \sum_{i = 1}^n \frac{\partial \mathcal{L}}{\partial h_i^{(t)}} \frac{\partial h_i^{(t)}}{\partial W_{hh}} \\ \\
380
- \frac{\partial \mathcal{L}}{\partial W_{xh}} = \sum_{t = 1}^\tau \sum_{i = 1}^n \frac{\partial \mathcal{L}}{\partial h_i^{(t)}} \frac{\partial h_i^{(t)}}{\partial W_{xh}}
381
- \end{align}
382
- }
383
-
384
- where :math:`n` is the length of a RNN sequence and :math:`t` is the index of timestep
385
-
386
- .. admonition:: :math:`\sum_{t = 1}^\tau`
387
-
388
- We assume the error is the sum of all errors of each timestep, which is why we include the :math:`\sum_{t = 1}^\tau`
389
- term
390
-
391
- Let's look at :math:`\frac{\partial \mathcal{L}}{W_{yh}}` first
392
-
393
- .. math::
394
-
395
- \frac{\partial \mathcal{L}}{W_{yh}} = \sum_{t = 1}^\tau \sum_{i = 1}^n \frac{\partial \mathcal{L}}{\partial o_i^{(t)}} \frac{\partial o_i^{(t)}}{\partial W_{yh}}
396
-
397
- Since :math:`o_i = \left( W_{yh}h_i + b_o \right)`,
398
-
399
- .. math::
400
-
401
- \frac{\partial o_i}{W_{yh}} = \frac{\partial }{W_{yh}}\left( W_{yh}h_i + b_o \right) = h_i
402
-
403
- For the :math:`\frac{\partial \mathcal{L}}{\partial o_i}` we shall recall from the earlier discussion on softmax
404
- derivative that we cannot simply have
405
-
406
- .. math::
407
-
408
- \frac{\partial \mathcal{L}}{\partial o_i} = -\frac{\partial}{\partial o_i}\sum_i^np(i)\log\sigma_i
409
-
410
- because we need to
411
-
412
- 1. specify which component (output element) we're seeking to find the derivative of
413
- 2. with respect to which input element the partial derivative is computed
414
-
415
- Therefore:
416
-
417
- .. math::
418
-
419
- \frac{\partial \mathcal{L}}{\partial o_i} = -\frac{\partial}{\partial o_i}\sum_j^np(j)\log\sigma_j = -\sum_j^n\frac{\partial}{\partial o_i}p(j)\log\sigma_j = -\sum_j^np(j)\frac{\partial \log\sigma_j}{\partial o_i}
420
-
421
- where :math:`n` is the number of timesteps (or the length of a sequence such as "hell")
422
-
423
- Applying the chain rule again:
424
-
425
- .. math::
426
-
427
- -\sum_j^np(j)\frac{\partial \log\sigma_j}{\partial o_i} = -\sum_j^np(j)\frac{1}{\sigma_j}\frac{\partial\sigma_j}{\partial o_i}
428
-
429
- Recall we have already derived that
430
-
431
- .. math::
432
-
433
- \frac{\partial \sigma_i}{\partial o_j} = \begin{cases}
434
- \sigma_i \left( 1 - \sigma_i \right), & \text{if}\ i = j \\
435
- -\sigma_i\sigma_j, & \text{otherwise}
436
- \end{cases}
437
-
438
- .. math::
439
-
440
- -\sum_j^np(j)\frac{1}{\sigma_j}\frac{\partial\sigma_j}{\partial o_i} = -\sum_{i = j}^np(j)\frac{1}{\sigma_j}\frac{\partial\sigma_j}{\partial o_i} -\sum_{i \ne j}^np(j)\frac{1}{\sigma_j}\frac{\partial\sigma_j}{\partial o_i} = -p(i)(1 - \sigma_i) + \sum_{i \ne j}^np(j)\sigma_i
441
-
442
- Observing that
443
-
444
- .. math::
445
-
446
- \sum_{j}^np(j) = 1
447
-
448
- .. math::
449
-
450
- -p(i)(1 - \sigma_i) + \sum_{i \ne j}^np(j)\sigma_i = -p(i) + p(i)\sigma_i + \sum_{i \ne j}^np(j)\sigma_i = \sigma_i - p(i)
451
-
452
- .. math::
453
-
454
- \color{green} \boxed{\frac{\partial \mathcal{L}}{\partial o_i} = \sigma_i - p(i)}
455
-
456
- .. math::
457
-
458
- \color{green} \boxed{ \frac{\partial \mathcal{L}}{\partial W_{yh}} = \sum_{t = 1}^\tau \sum_i^n\left[ \sigma_i - p(i) \right] h_i = \sum_{t = 1}^\tau \left( \boldsymbol{\sigma} - \boldsymbol{p} \right) \boldsymbol{h}^{(t)} }
459
-
460
- .. math::
461
-
462
- \frac{\partial \mathcal{L}}{b_o} = \sum_{t = 1}^\tau \sum_i^n\frac{\partial \mathcal{L}}{\partial o_i^{(t)}}\frac{\partial o_i^{(t)}}{\partial b_o^{(t)}} = \sum_{t = 1}^\tau \sum_i^n\left[ \sigma_i - p(i) \right] \times 1
463
-
464
- .. math::
465
-
466
- \color{green} \boxed{ \frac{\partial \mathcal{L}}{\partial b_o} = \sum_{t = 1}^\tau \sum_i^n\left[ \sigma_i - p(i) \right] = \sum_{t = 1}^\tau \boldsymbol{\sigma} - \boldsymbol{p} }
467
-
468
- We have at this point derived backpropagating rule for :math:`W_{yh}` and :math:`b_o`:
469
-
470
- 1. :math:`W_{xh}`
471
- 2. :math:`W_{hh}`
472
- 3. ✅ :math:`W_{yh}`
473
- 4. :math:`b_h`
474
- 5. ✅ :math:`b_o`
475
-
476
- Now let's look at :math:`\frac{\partial \mathcal{L}}{\partial W_{hh}}`:
477
-
478
- Recall from *Deep Learning*, section 6.5.2, p. 207 that the vector notation of
479
- :math:`\frac{\partial z}{\partial x_i} = \sum_j \frac{\partial z}{\partial y_j}\frac{\partial y_j}{\partial x_i}` is
480
-
481
- .. math::
482
-
483
- \nabla_{\boldsymbol{x}}z = \left( \frac{\partial \boldsymbol{y}}{\partial \boldsymbol{x}} \right)^\intercal \nabla_{\boldsymbol{y}}z
484
-
485
- This gives us a start with:
486
-
487
- .. math::
488
-
489
- \begin{align}
490
- \frac{\partial \mathcal{L}}{\partial W_{hh}} &= \sum_{t = 1}^\tau \sum_{i = 1}^n \frac{\partial \mathcal{L}}{\partial h_i^{(t)}} \frac{\partial h_i^{(t)}}{\partial W_{hh}} \\
491
- & = \sum_{t = 1}^\tau \left( \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \nabla_{\boldsymbol{W_{hh}}}\boldsymbol{h}^{(t)} \\
492
- & = \sum_{t = 1}^\tau \left( \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{hh}}} \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\boldsymbol{h}^{(t)} \\
493
- & = \sum_{t = 1}^\tau \left( \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{hh}}} \right)^\intercal \\
494
- & = \sum_{t = 1}^\tau \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{hh}}} \right)^\intercal \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \\
495
- & = \sum_{t = 1}^\tau \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t - 1)}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t - 1)}}{\partial \boldsymbol{W_{hh}}} \right)^\intercal \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \\
496
- & = \sum_{t = 1}^\tau \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t - 1)}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t - 1)}}{\partial \boldsymbol{h}^{(t)}}\frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t)}}\frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{hh}}} \right)^\intercal \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \\
497
- & = \sum_{t = 1}^\tau \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t - 1)}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t - 1)}}{\partial \boldsymbol{h}^{(t)}}\frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{hh}}}\frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \\
498
- & = \sum_{t = 1}^\tau \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t - 1)}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t - 1)}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{hh}}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \\
499
- & = \sum_{t = 1}^\tau \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{hh}}} \right)^\intercal \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \frac{\partial \mathcal{L}}{\partial \boldsymbol{h}^{(t)}} \\
500
- & = \sum_{t = 1}^\tau diag\left[ 1 - \left(\boldsymbol{h}^{(t)}\right)^2 \right] \boldsymbol{h}^{(t - 1)} \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \\
501
- & = \sum_{t = 1}^\tau diag\left[ 1 - \left(\boldsymbol{h}^{(t)}\right)^2 \right] \left( \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \right) {\boldsymbol{h}^{(t - 1)}}^\intercal
502
- \end{align}
503
-
504
- .. math::
505
-
506
- \color{green} \boxed{ \frac{\partial \mathcal{L}}{\partial W_{hh}} = \sum_{t = 1}^\tau diag\left[ 1 - \left(\boldsymbol{h}^{(t)}\right)^2 \right] \left( \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \right) {\boldsymbol{h}^{(t - 1)}}^\intercal }
507
-
508
- The equation above leaves us with a term :math:`\nabla_{\boldsymbol{h}^{(t)}}\mathcal{L}`, which we calculate next. Note
509
- that the back propagation on :math:`\boldsymbol{h}^{(t)}` has source from both :math:`\boldsymbol{o}^{(t)}` and
510
- :math:`\boldsymbol{h}^{(t + 1)}`. It's gradient, therefore, is given by
511
-
512
- .. math::
513
-
514
- \begin{align}
515
- \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} &= \left( \frac{\partial \boldsymbol{o}^{(t)}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \nabla_{\boldsymbol{o}^{(t)}}\mathcal{L} + \left( \frac{\partial \boldsymbol{h}^{(t + 1)}}{\partial \boldsymbol{h}^{(t)}} \right)^\intercal \nabla_{\boldsymbol{h}^{(t + 1)}}\mathcal{L} \\
516
- &= \left( \boldsymbol{W_{yh}} \right)^\intercal \nabla_{\boldsymbol{o}^{(t)}}\mathcal{L} + \left( diag\left[ 1 - (\boldsymbol{h}^{(t + 1)})^2 \right] \boldsymbol{W_{hh}} \right)^\intercal \nabla_{\boldsymbol{h}^{(t + 1)}}\mathcal{L} \\
517
- &= \left( \boldsymbol{W_{yh}} \right)^\intercal \nabla_{\boldsymbol{o}^{(t)}}\mathcal{L}+ \boldsymbol{W_{hh}}^\intercal \nabla_{\boldsymbol{h}^{(t + 1)}}\mathcal{L} \left( diag\left[ 1 - (\boldsymbol{h}^{(t + 1)})^2 \right] \right)
518
- \end{align}
519
-
520
- .. math::
521
-
522
- \color{green} \boxed{ \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} = \left( \boldsymbol{W_{yh}} \right)^\intercal \nabla_{\boldsymbol{o}^{(t)}}\mathcal{L} + \boldsymbol{W_{hh}}^\intercal \nabla_{\boldsymbol{h}^{(t + 1)}}\mathcal{L} \left( diag\left[ 1 - (\boldsymbol{h}^{(t + 1)})^2 \right] \right) }
523
-
524
- Note that the 2nd term
525
- :math:`\boldsymbol{W_{xh}}^\intercal \nabla_{\boldsymbol{h}^{(t + 1)}}\mathcal{L} \left( diag\left[ 1 - (\boldsymbol{h}^{(t + 1)})^2 \right] \right)`
526
- is zero at first iteration propagating back because for the last-layer (unrolled) of RNN , there's no gradient update
527
- flow from the next hidden state.
528
-
529
- So far we have derived backpropagating rule for :math:`W_{hh}`
530
-
531
- 1. :math:`W_{xh}`
532
- 2. ✅ :math:`W_{hh}`
533
- 3. ✅ :math:`W_{yh}`
534
- 4. :math:`b_h`
535
- 5. ✅ :math:`b_o`
536
-
537
- Let's tackle the remaining :math:`\frac{\partial \mathcal{L}}{\partial W_{xh}}` and :math:`b_h`:
538
-
539
- .. math::
540
-
541
- \begin{align}
542
- \frac{\partial \mathcal{L}}{\partial W_{xh}} &= \sum_{t = 1}^\tau \sum_{i = 1}^n \frac{\partial \mathcal{L}}{\partial h_i^{(t)}} \frac{\partial h_i^{(t)}}{\partial W_{xh}} \\
543
- &= \sum_{t = 1}^\tau \left( \frac{\partial \boldsymbol{h}^{(t)}}{\partial \boldsymbol{W_{xh}}} \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \\
544
- &= \sum_{t = 1}^\tau \left( diag\left[ 1 - (\boldsymbol{h}^{(t)})^2 \right] \boldsymbol{x}^{(t)} \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \\
545
- &= \sum_{t = 1}^\tau \left( diag\left[ 1 - (\boldsymbol{h}^{(t)})^2 \right] \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \left( \boldsymbol{x}^{(t)} \right)
546
- \end{align}
547
-
548
- .. math::
549
-
550
- \color{green} \boxed{ \frac{\partial \mathcal{L}}{\partial W_{xh}} = \sum_{t = 1}^\tau \left( diag\left[ 1 - (\boldsymbol{h}^{(t)})^2 \right] \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \left( \boldsymbol{x}^{(t)} \right) }
551
-
552
- .. math::
553
-
554
- \begin{align}
555
- \frac{\partial \mathcal{L}}{\partial b_h} &= \sum_{t = 1}^\tau \sum_{i = 1}^n \frac{\partial \mathcal{L}}{\partial h_i^{(t)}} \frac{\partial h_i^{(t)}}{\partial b_h^{(t)}} \\
556
- &= \sum_{t = 1}^\tau \left( \frac{\partial h_i^{(t)}}{\partial b_h^{(t)}} \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \\
557
- &= \sum_{t = 1}^\tau \left( diag\left[ 1 - (\boldsymbol{h}^{(t)})^2 \right] \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L}
558
- \end{align}
559
-
560
- .. math::
561
-
562
- \color{green} \boxed{ \frac{\partial \mathcal{L}}{\partial b_h} = \sum_{t = 1}^\tau \left( diag\left[ 1 - (\boldsymbol{h}^{(t)})^2 \right] \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} }
563
-
564
- This concludes our propagation rules for training RNN:
565
-
566
- .. math::
567
-
568
- \color{green} \boxed{
569
- \begin{gather*}
570
- \frac{\partial \mathcal{L}}{\partial W_{xh}} = \sum_{t = 1}^\tau \left( diag\left[ 1 - (\boldsymbol{h}^{(t)})^2 \right] \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \left( \boldsymbol{x}^{(t)} \right) \\ \\
571
- \frac{\partial \mathcal{L}}{\partial W_{hh}} = \sum_{t = 1}^\tau diag\left[ 1 - \left(\boldsymbol{h}^{(t)}\right)^2 \right] \left( \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \right) {\boldsymbol{h}^{(t - 1)}}^\intercal \\ \\
572
- \frac{\partial \mathcal{L}}{\partial W_{yh}} = \sum_{t = 1}^\tau \left( \boldsymbol{\sigma} - \boldsymbol{p} \right) \boldsymbol{h}^{(t)} \\ \\
573
- \frac{\partial \mathcal{L}}{\partial b_h} = \sum_{t = 1}^\tau \left( diag\left[ 1 - (\boldsymbol{h}^{(t)})^2 \right] \right)^\intercal \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} \\ \\
574
- \frac{\partial \mathcal{L}}{\partial b_o} =\sum_{t = 1}^\tau \boldsymbol{\sigma} - \boldsymbol{p}
575
- \end{gather*}
576
- }
577
-
578
- where
579
-
580
- .. math::
581
-
582
- \color{green} \boxed{ \nabla_{\boldsymbol{h}^{(t)}}\mathcal{L} = \left( \boldsymbol{W_{yh}} \right)^\intercal \nabla_{\boldsymbol{o}^{(t)}}\mathcal{L}+ \boldsymbol{W_{hh}}^\intercal \nabla_{\boldsymbol{h}^{(t + 1)}}\mathcal{L} \left( diag\left[ 1 - (\boldsymbol{h}^{(t + 1)})^2 \right] \right) }
583
-
584
- Computational Gradient Descent Weight Update Rule
585
- -------------------------------------------------
586
-
587
- What does the propagation rules above look like in Python?
588
-
589
- Example
590
- -------
591
-
592
- `Pride and Prejudice by Jane Austen <https://www.gutenberg.org/ebooks/1342>`_
593
-
594
-
595
- .. code-block:: python
596
-
597
-
598
-
599
-
600
-
601
-
602
-
603
-
604
-
605
- .. _`exploding gradient`: https://qubitpi.github.io/stanford-cs231n.github.io/rnn/#vanilla-rnn-gradient-flow--vanishing-gradient-problem
606
-
607
- .. _`MACHINE LEARNING by Mitchell, Thom M. (1997)`: https://a.co/d/bjmsEOg
608
-
609
- .. _`loss function`: https://qubitpi.github.io/stanford-cs231n.github.io/neural-networks-2/#losses
610
- .. _`LSTM Formulation`: https://qubitpi.github.io/stanford-cs231n.github.io/rnn/#lstm-formulation
611
-
612
- .. _`Vanilla RNN Gradient Flow & Vanishing Gradient Problem`: https://qubitpi.github.io/stanford-cs231n.github.io/rnn/#vanilla-rnn-gradient-flow--vanishing-gradient-problem
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/source/speech/sampling.rst DELETED
@@ -1,68 +0,0 @@
1
- ===============================
2
- Speech Recognition with Lamassu
3
- ===============================
4
-
5
- .. contents:: Table of Contents
6
- :depth: 2
7
-
8
- Speech recognition will become a primary way that we interact with computers.
9
-
10
- One might guess that we could simply feed sound recordings into a neural network and train it to produce text:
11
-
12
- .. figure:: ../img/speech-processing.png
13
- :align: center
14
-
15
- That's the holy grail of speech recognition with deep learning, but we aren't quite there yet. The big problem is that
16
- speech varies in speed. One person might say "hello!" very quickly and another person might say
17
- "heeeelllllllllllllooooo!" very slowly, producing a much longer sound file with much more data. Both sounds should be
18
- recognized as exactly the same text - "hello!" Automatically aligning audio files of various lengths to a fixed-length
19
- piece of text turns out to be pretty hard. To work around this, we have to use some special tricks and extra precessing.
20
-
21
- Turning Sounds into Bits
22
- ========================
23
-
24
- The first step in speech recognition is obvious — we need to feed sound waves into a computer. Sound is transmitted as
25
- waves. A sound clip of someone saying "Hello" looks like
26
-
27
- .. figure:: ../img/hello-sound.png
28
- :align: center
29
-
30
- Sound waves are one-dimensional. At every moment in time, they have a single value based on the height of the wave.
31
- Let's zoom in on one tiny part of the sound wave and take a look:
32
-
33
- .. figure:: ../img/sound-wave.png
34
- :align: center
35
-
36
- To turn this sound wave into numbers, we just record of the height of the wave at equally-spaced points:
37
-
38
- .. figure:: ../img/sampling-sound-wave.gif
39
- :align: center
40
-
41
- This is called *sampling*. We are taking a reading thousands of times a second and recording a number representing the
42
- height of the sound wave at that point in time. That's basically all an uncompressed .wav audio file is.
43
-
44
- "CD Quality" audio is sampled at 44.1khz (44,100 readings per second). But for speech recognition, a sampling rate of
45
- 16khz (16,000 samples per second) is enough to cover the frequency range of human speech.
46
-
47
- Lets sample our "Hello" sound wave 16,000 times per second. Here's the first 100 samples:
48
-
49
- .. figure:: ../img/hello-sampling.png
50
- :align: center
51
-
52
- .. note:: Can digital samples perfectly recreate the original analog sound wave? What about those gaps?
53
-
54
- You might be thinking that sampling is only creating a rough approximation of the original sound wave because it's
55
- only taking occasional readings. There's gaps in between our readings so we must be losing data, right?
56
-
57
- .. figure:: ../img/real-vs-sampling.png
58
- :align: center
59
-
60
- But thanks to the `Nyquist theorem`_, we know that we can use math to perfectly reconstruct the original sound wave
61
- from the spaced-out samples — as long as we sample at least twice as fast as the highest frequency we want to record.
62
-
63
- .. automodule:: lamassu.speech.sampling
64
- :members:
65
- :undoc-members:
66
- :show-inheritance:
67
-
68
- .. _`Nyquist theorem`: https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lamassu-logo.png DELETED
Binary file (14.3 kB)
 
lamassu/rnn/__init__.py DELETED
File without changes
lamassu/rnn/example.py DELETED
@@ -1,50 +0,0 @@
1
- import numpy as np
2
-
3
- from lamassu.rnn.rnn import Config
4
- from lamassu.rnn.rnn import RecurrentNeuralNetwork
5
-
6
- if __name__ == "__main__":
7
- num_hidden_perceptrons= 100
8
- seq_length = 25
9
- learning_rate = 1e-1
10
-
11
-
12
- data = open('pride-and-prejudice.txt', 'r').read()
13
- char_set = list(set(data))
14
- num_chars, num_unique_chars = len(data), len(char_set)
15
- char_to_idx = { ch:i for i,ch in enumerate(char_set) }
16
- idx_to_char = { i:ch for i,ch in enumerate(char_set) }
17
-
18
- rnn = RecurrentNeuralNetwork(
19
- Config(
20
- num_hidden_perceptrons=num_hidden_perceptrons,
21
- input_size=num_unique_chars,
22
- learning_rate=learning_rate
23
- )
24
- )
25
-
26
- num_iter, pointer = 0, 0
27
-
28
-
29
- while True:
30
- if pointer + seq_length + 1 >= len(data) or num_iter == 0:
31
- prev_history = np.zeros((num_hidden_perceptrons, 1))
32
- pointer = 0
33
- input = [char_to_idx[c] for c in data[pointer: pointer + seq_length]]
34
- target = [char_to_idx[c] for c in data[pointer + 1: pointer + seq_length + 1]]
35
-
36
- if num_iter % 100 == 0: # inference after every 100 trainings
37
- inferenced_idxes = rnn.inference(prev_history, input[0])
38
- inferenced = ''.join(idx_to_char[idx] for idx in inferenced_idxes)
39
- print("============ inference ============")
40
- print(inferenced)
41
-
42
- history, q, x, loss = rnn.forward_pass(input, target, prev_history)
43
-
44
- if num_iter % 100 == 0:
45
- print("loss: {}".format(loss))
46
-
47
- prev_history = rnn.back_propagation(input, target, history, q, x)
48
-
49
- pointer += seq_length
50
- num_iter += 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lamassu/rnn/rnn.py DELETED
@@ -1,114 +0,0 @@
1
- import numpy as np
2
- from math import exp
3
- from dataclasses import dataclass
4
-
5
-
6
- np.random.seed(0)
7
-
8
- @dataclass
9
- class Config():
10
- num_hidden_perceptrons: int
11
- input_size: int
12
- learning_rate: float
13
-
14
-
15
- class RecurrentNeuralNetwork(object):
16
- """
17
- Architecture is single-hidden-layer
18
- """
19
-
20
- def __init__(self, config: Config):
21
- self.config = config
22
-
23
- self.W_xh = np.random.randn(config.num_hidden_perceptrons, config.input_size)
24
- self.W_hh = np.random.randn(config.num_hidden_perceptrons, config.num_hidden_perceptrons)
25
- self.W_yh = np.random.randn(config.input_size, config.num_hidden_perceptrons)
26
-
27
- self.b_h = np.zeros((config.num_hidden_perceptrons, 1))
28
- self.b_o = np.zeros((config.input_size, 1))
29
-
30
- def forward_pass(self, input, target, prev_history):
31
- """
32
-
33
- :param input: The input vector; each element is an index
34
- :return:
35
- """
36
-
37
- history, x, o, q, loss = {}, {}, {}, {}, 0
38
- history[-1] = np.copy(prev_history)
39
-
40
- for t in range(len(input)):
41
- x[t] = np.zeros((self.config.input_size, 1))
42
- x[t][input[t]] = 1
43
-
44
- if t == 0:
45
- np.dot(self.W_hh, history[t - 1])
46
- np.dot(self.W_xh, x[t])
47
-
48
- history[t] = np.tanh(
49
- np.dot(self.W_hh, history[t - 1]) + np.dot(self.W_xh, x[t]) + self.b_h
50
- )
51
- o[t] = np.dot(self.W_yh, history[t]) + self.b_o
52
- q[t] = np.exp(o[t]) / np.sum(np.exp(o[t]))
53
- loss += -np.log(q[t][target, 0])
54
-
55
- return history, q, x, loss
56
-
57
- def back_propagation(self, input, target, history, q, x):
58
- gradient_loss_over_W_xh = np.zeros_like(self.W_xh)
59
- gradient_loss_over_W_hh = np.zeros_like(self.W_hh)
60
- gradient_loss_over_W_yh = np.zeros_like(self.W_yh)
61
-
62
- gradient_loss_over_b_h = np.zeros_like(self.b_h)
63
- gradient_loss_over_b_y = np.zeros_like(self.b_o)
64
-
65
- gradient_loss_over_next_h = np.zeros_like(history[0])
66
-
67
- for t in reversed(range(len(input))):
68
- gradient_loss_over_o = np.copy(q[t])
69
- gradient_loss_over_o[target[t]] -= 1
70
-
71
- gradient_loss_over_W_yh += np.dot(gradient_loss_over_o, history[t].T)
72
- gradient_loss_over_b_y += gradient_loss_over_o #
73
-
74
- gradient_loss_over_h = np.dot(self.W_yh.T, gradient_loss_over_o) + gradient_loss_over_next_h
75
- diag_times_gradient_loss_over_h = (1 - history[t] * history[t]) * gradient_loss_over_h
76
-
77
- gradient_loss_over_b_h += diag_times_gradient_loss_over_h #
78
-
79
- gradient_loss_over_W_xh += np.dot(diag_times_gradient_loss_over_h, x[t].T) #
80
- gradient_loss_over_W_hh += np.dot(diag_times_gradient_loss_over_h, history[t - 1].T) #
81
-
82
- gradient_loss_over_next_h = np.dot(self.W_hh.T, diag_times_gradient_loss_over_h)
83
-
84
- for gradient in [gradient_loss_over_W_xh, gradient_loss_over_W_hh, gradient_loss_over_W_yh, gradient_loss_over_b_h, gradient_loss_over_b_y]:
85
- np.clip(gradient, -5, 5, out=gradient) # avoid exploding gradients
86
-
87
- # update weights
88
- for param, gradient in zip(
89
- [self.W_xh, self.W_hh, self.W_yh, self.b_h, self.b_o],
90
- [gradient_loss_over_W_xh, gradient_loss_over_W_hh, gradient_loss_over_W_yh, gradient_loss_over_b_h, gradient_loss_over_b_y]):
91
- param += -self.config.learning_rate * gradient
92
-
93
- return history[len(input) - 1]
94
-
95
- def inference(self, history, seed_idx):
96
- x = np.zeros((self.config.input_size, 1))
97
- x[seed_idx] = 1
98
- idxes = []
99
-
100
- for timestep in range(200):
101
- history = np.tanh(np.dot(self.W_xh, x) + np.dot(self.W_hh, history) + self.b_h)
102
- o = np.dot(self.W_yh, history) + self.b_o
103
- p = np.exp(o) / np.sum(np.exp(o))
104
-
105
- next_idx = self._inference_single(p.ravel())
106
-
107
- x[next_idx] = 1
108
- idxes.append(next_idx)
109
-
110
- return idxes
111
-
112
-
113
- def _inference_single(self, probability_distribution):
114
- return np.random.choice(range(self.config.input_size), p=probability_distribution)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lamassu/speech/__init__.py DELETED
File without changes
lamassu/speech/sampling.py DELETED
@@ -1,16 +0,0 @@
1
- import wave
2
-
3
- import numpy as np
4
-
5
-
6
- def sample_wav(file_path: str):
7
- """
8
- Sampling a .wav file
9
-
10
- :param file_path: The absolute path to the .wav file to be sampled
11
-
12
- :return: an array of sampled points
13
- """
14
- with wave.open(file_path, "rb") as f:
15
- frames = f.readframes(f.getnframes())
16
- return np.frombuffer(frames, dtype=np.int16)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mlflow/HanLPner.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hanlp
2
+ import mlflow.pyfunc
3
+ import pandas
4
+ from parser import convert_to_knowledge_graph_spec
5
+
6
+
7
+ class HanLPner(mlflow.pyfunc.PythonModel):
8
+
9
+ def __init__(self):
10
+ self.HanLP = None
11
+
12
+ def load_context(self, context):
13
+ HanLP = hanlp.load(hanlp.pretrained.mtl.CLOSE_TOK_POS_NER_SRL_DEP_SDP_CON_ELECTRA_SMALL_ZH)
14
+ self.HanLP = HanLP
15
+
16
+ def predict(self, context, model_input):
17
+ texts = []
18
+ for _, row in model_input.iterrows():
19
+ texts.append(row["text"])
20
+
21
+ return pandas.Series(convert_to_knowledge_graph_spec(self.HanLP(texts)["srl"]))
22
+
23
+ if __name__ == '__main__':
24
+ conda_env = {
25
+ 'channels': ['defaults'],
26
+ 'dependencies': [
27
+ 'python=3.10.7',
28
+ 'pip',
29
+ {
30
+ 'pip': [
31
+ 'mlflow',
32
+ 'mlflow-skinny',
33
+ 'mlflow[extras]',
34
+ 'pandas=={}'.format(pandas.__version__),
35
+ 'hanlp[amr, fasttext, full, tf]'
36
+ ],
37
+ },
38
+ ],
39
+ 'name': 'HanLPner'
40
+ }
41
+
42
+ # Save the MLflow Model
43
+ mlflow_pyfunc_model_path = "models/HanLPner"
44
+ mlflow.pyfunc.save_model(path=mlflow_pyfunc_model_path, python_model=HanLPner(), conda_env=conda_env)
45
+
46
+ loaded_model = mlflow.pyfunc.load_model(mlflow_pyfunc_model_path)
47
+
48
+ test_data = pandas.DataFrame(
49
+ {
50
+ "text": [
51
+ "我爱中国"
52
+ ]
53
+ }
54
+ )
55
+
56
+ test_predictions = loaded_model.predict(test_data)
57
+ print(test_predictions.to_markdown())
{lamassu → mlflow}/__init__.py RENAMED
File without changes
mlflow/parser.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import string
3
+
4
+
5
+ def _random_id():
6
+ return "n" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(5)).lower()
7
+
8
+
9
+ def _construct_knowledge_graph_spec_node(extrapolated_entity: str):
10
+ return {
11
+ "id": _random_id(),
12
+ "fields": {
13
+ "name": extrapolated_entity,
14
+ "type": "entity"
15
+ }
16
+ }
17
+
18
+
19
+ def _construct_knowledge_graph_spec_link(source: str, target: str, extrapolated_relationship: str):
20
+ return {
21
+ "id": _random_id(),
22
+ "source": source,
23
+ "target": target,
24
+ "fields": {
25
+ "type": extrapolated_relationship
26
+ }
27
+ }
28
+
29
+
30
+ def convert_to_knowledge_graph_spec(model_results):
31
+ nodes = []
32
+ links = []
33
+
34
+ node_name_to_id_map = {}
35
+ link_set = set()
36
+ for srl_results in model_results:
37
+ for srl_result in srl_results:
38
+ subject = None
39
+ verb = None
40
+ object = None
41
+
42
+ for tuple in srl_result:
43
+ if tuple[1] == "ARG0":
44
+ subject = tuple
45
+ if tuple[1] == "PRED":
46
+ verb = tuple
47
+ if tuple[1] == "ARG1":
48
+ object = tuple
49
+
50
+ if subject and verb and object:
51
+ source_node = _construct_knowledge_graph_spec_node(subject[0])
52
+ target_node = _construct_knowledge_graph_spec_node(object[0])
53
+
54
+ source_node_id = source_node["id"]
55
+ source_node_name = source_node["fields"]["name"]
56
+ target_node_id = target_node["id"]
57
+ target_node_name = target_node["fields"]["name"]
58
+
59
+ if source_node_name not in node_name_to_id_map.keys():
60
+ node_name_to_id_map[source_node_name] = source_node_id
61
+ nodes.append(source_node)
62
+ if target_node_name not in node_name_to_id_map.keys():
63
+ node_name_to_id_map[target_node_name] = target_node_id
64
+ nodes.append(target_node)
65
+
66
+ link: str = source_node_name + target_node_name + verb[0]
67
+ if link not in link_set:
68
+ links.append(
69
+ _construct_knowledge_graph_spec_link(
70
+ node_name_to_id_map[source_node_name],
71
+ node_name_to_id_map[target_node_name],
72
+ verb[0]
73
+ )
74
+ )
75
+ link_set.add(link)
76
+
77
+ subject = None
78
+ verb = None
79
+ object = None
80
+
81
+ return {
82
+ "nodes": nodes,
83
+ "links": links
84
+ }
mlflow/requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ mlflow
2
+ mlflow-skinny
3
+ mlflow[extras]
4
+ hanlp[amr,fasttext,full,tf]
mlflow/test_parser.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import unittest
2
+
3
+ from mlflow.parser import convert_to_knowledge_graph_spec
4
+
5
+
6
+ class TestParser(unittest.TestCase):
7
+
8
+ def test_parser(self):
9
+ model_results: list = [
10
+ [
11
+ [['我', 'ARG0', 0, 1], ['爱', 'PRED', 1, 2], ['中国', 'ARG1', 2, 3]]
12
+ ]
13
+ ]
14
+
15
+ expected_nodes = [
16
+ '我',
17
+ '中国'
18
+ ]
19
+
20
+ expected_links = ['爱']
21
+
22
+ assert [node["fields"]["name"] for node in
23
+ convert_to_knowledge_graph_spec(model_results)["nodes"]] == expected_nodes
24
+ assert [node["fields"]["type"] for node in
25
+ convert_to_knowledge_graph_spec(model_results)["links"]] == expected_links