├── .gitignore
├── .vscode
└── launch.json
├── LICENSE
├── README.md
├── main.py
├── nn_sandbox
├── assets
│ ├── data
│ │ ├── 2CS.txt
│ │ ├── 2Ccircle1.txt
│ │ ├── 2Circle1.txt
│ │ ├── 2Circle2.txt
│ │ ├── 2CloseS.txt
│ │ ├── 2CloseS2.txt
│ │ ├── 2CloseS3.txt
│ │ ├── 2Hcircle1.txt
│ │ ├── 2cring.txt
│ │ ├── 2ring.txt
│ │ ├── 579.txt
│ │ ├── 5CloseS1.txt
│ │ ├── customized1.txt
│ │ ├── customized2.txt
│ │ ├── customized3.txt
│ │ ├── customized4.txt
│ │ ├── customized5.txt
│ │ ├── perceptron1.txt
│ │ ├── perceptron2.txt
│ │ ├── perceptron4.txt
│ │ └── xor.txt
│ └── images
│ │ ├── baseline-check_circle-24px.svg
│ │ ├── baseline-play_arrow-24px.svg
│ │ └── baseline-stop-24px.svg
├── backend
│ ├── __init__.py
│ ├── algorithms
│ │ ├── __init__.py
│ │ ├── base_algorithm.py
│ │ ├── k_means.py
│ │ ├── mlp_algorithm.py
│ │ ├── perceptron_algorithm.py
│ │ ├── rbfn_algorithm.py
│ │ └── som_algorithm.py
│ ├── neurons
│ │ ├── __init__.py
│ │ ├── perceptron.py
│ │ ├── rbf_neuron.py
│ │ └── som_neuron.py
│ └── utils.py
├── bridges
│ ├── __init__.py
│ ├── bridge.py
│ ├── mlp_bridge.py
│ ├── observer.py
│ ├── perceptron_bridge.py
│ ├── rbfn_bridge.py
│ └── som_bridge.py
└── frontend
│ ├── __init__.py
│ ├── components
│ ├── DataChart.qml
│ ├── DoubleSpinBox.qml
│ ├── ExecutionControls.qml
│ ├── NetworkSetting.qml
│ ├── NoteBook.qml
│ ├── Page.qml
│ ├── RateChart.qml
│ └── dashboards
│ │ ├── Mlp.qml
│ │ ├── Perceptron.qml
│ │ ├── Rbfn.qml
│ │ └── Som.qml
│ └── main.qml
└── requirements.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | .hypothesis/
51 | .pytest_cache/
52 |
53 | # Translations
54 | *.mo
55 | *.pot
56 |
57 | # Django stuff:
58 | *.log
59 | local_settings.py
60 | db.sqlite3
61 |
62 | # Flask stuff:
63 | instance/
64 | .webassets-cache
65 |
66 | # Scrapy stuff:
67 | .scrapy
68 |
69 | # Sphinx documentation
70 | docs/_build/
71 |
72 | # PyBuilder
73 | target/
74 |
75 | # Jupyter Notebook
76 | .ipynb_checkpoints
77 |
78 | # IPython
79 | profile_default/
80 | ipython_config.py
81 |
82 | # pyenv
83 | .python-version
84 |
85 | # pipenv
86 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
87 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
88 | # having no cross-platform support, pipenv may install dependencies that don’t work, or not
89 | # install all needed dependencies.
90 | #Pipfile.lock
91 |
92 | # celery beat schedule file
93 | celerybeat-schedule
94 |
95 | # SageMath parsed files
96 | *.sage.py
97 |
98 | # Environments
99 | .env
100 | .venv
101 | env/
102 | venv/
103 | ENV/
104 | env.bak/
105 | venv.bak/
106 |
107 | # Spyder project settings
108 | .spyderproject
109 | .spyproject
110 |
111 | # Rope project settings
112 | .ropeproject
113 |
114 | # mkdocs documentation
115 | /site
116 |
117 | # mypy
118 | .mypy_cache/
119 | .dmypy.json
120 | dmypy.json
121 |
122 | # Pyre type checker
123 | .pyre/
124 |
125 | # QML
126 | .qmlc
127 |
128 | # VSCode
129 | .vscode/*
130 | !.vscode/settings.json
131 | !.vscode/tasks.json
132 | !.vscode/launch.json
133 | !.vscode/extensions.json
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Python: Current File (Integrated Terminal)",
9 | "type": "python",
10 | "request": "launch",
11 | "program": "${file}",
12 | "console": "integratedTerminal"
13 | },
14 | {
15 | "name": "Python: Remote Attach",
16 | "type": "python",
17 | "request": "attach",
18 | "port": 5678,
19 | "host": "localhost",
20 | "pathMappings": [
21 | {
22 | "localRoot": "${workspaceFolder}",
23 | "remoteRoot": "."
24 | }
25 | ]
26 | },
27 | {
28 | "name": "Python: Module",
29 | "type": "python",
30 | "request": "launch",
31 | "module": "enter-your-module-name-here",
32 | "console": "integratedTerminal"
33 | },
34 | {
35 | "name": "Python: Django",
36 | "type": "python",
37 | "request": "launch",
38 | "program": "${workspaceFolder}/manage.py",
39 | "console": "integratedTerminal",
40 | "args": [
41 | "runserver",
42 | "--noreload",
43 | "--nothreading"
44 | ],
45 | "django": true
46 | },
47 | {
48 | "name": "Python: Flask",
49 | "type": "python",
50 | "request": "launch",
51 | "module": "flask",
52 | "env": {
53 | "FLASK_APP": "app.py"
54 | },
55 | "args": [
56 | "run",
57 | "--no-debugger",
58 | "--no-reload"
59 | ],
60 | "jinja": true
61 | },
62 | {
63 | "name": "Python: Current File (External Terminal)",
64 | "type": "python",
65 | "request": "launch",
66 | "program": "${file}",
67 | "console": "externalTerminal"
68 | }
69 | ]
70 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Sean Wu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Neural Network Sandbox
2 |
3 | An assignment collection for course _CE5037 Neural Network_ in National Central University, Taiwan.
4 |
5 | ## Features
6 |
7 | * Back-end completely separates from front-end by `setContextProperty()` and [`BridgeProperty`](./nn_sandbox/bridges/bridge.py)
8 | * Animated Qt Chart in QML.
9 | * Automatically update UI when specific variables in back-end changed.
10 | * Modulized UI components.
11 |
12 | > Actually, neural networks are not the point.
13 |
14 | ## Previews
15 |
16 | 
17 |
18 | 
19 |
20 | 
21 |
22 | 
23 |
24 | ## Introduction to Architecture
25 |
26 | I created the toy, Neural Network Sandbox, to explore if I could completely separate business logic (algorithms) from UI with Python and QML. Take [`mlp_algorithm.py`](./nn_sandbox/backend/algorithms/mlp_algorithm.py) for example, the class does not know anything about UI but the users still can interact with it via a QML app.
27 |
28 | The QML UI needs to automatically observe some variables in the business logic. Thus, I need to inherit each algorithm with the Observable class. For example, [`ObservableMlpAlgorithm`](./nn_sandbox/bridges/mlp_bridge.py) inherits [`Observable`](./nn_sandbox/bridges/observer.py) and [`MlpAlgorithm`](./nn_sandbox/backend/algorithms/mlp_algorithm.py). Whenever a property has changed in the `MlpAlgorithm`, `ObserableMlpAlgorithm.__setattr__(self, name, value)` would be called. I can know which property has changed with the `name` parameter and notify the `Observer` with its new value.
29 |
30 | But who is the observer? The [bridge classes](./nn_sandbox/bridges/bridge.py) are the observer in this scenario. I created the bridge classes (e.g. [`mlp_bridge.py`](./nn_sandbox/bridges/mlp_bridge.py)) containing a list of `BridgeProperty`. When a property has been updated by the observable via `setattr(self, name, value)`, the corresponding (having the same name) `BridgeProperty` will get updated. When a `BridgeProperty` has been updated, its setter method will be called and emit PyQt signal to change QML UI.
31 |
32 | In the early version of the project, there is no `BridgeProperty` class. For instance, [the old version of `perceptron_bridge.py`](https://github.com/seanwu1105/neural-network-sandbox/blob/3bfe07ba4db2a3f78a273b94860fabc7cf0df34a/nn_sandbox/frontend/bridges/perceptron_bridge.py) having multiple pyqtProperty and its setter. To make the code cleaner, I have to create these `pyqtProperties` dynamically. `BridgeProperty` and [`BridgeMeta`](./nn_sandbox/bridges/bridge.py) classes solve the problem. You can find more details from [this Stackoverflow answer](https://stackoverflow.com/questions/48425316/how-to-create-pyqt-properties-dynamically/48432653#48432653) about creating `pyqtProperty` dynamically and [this Stackoverflow answer](https://stackoverflow.com/questions/54695976/how-can-i-update-a-qml-objects-property-from-my-python-file/54697414#54697414) about different ways to communicate between QML and Python.
33 |
34 | Actually, after I finished the project, I feel it is a little bit over-engineered, and there are still many boilerplates scattering in the project. __My solution to separate business logic (algorithms) from UI is definitely NOT the best way__, which can be further improved. Hence, if you have a better idea about the architecture, feel free to create a pull request.
35 |
36 | By the way, as far as I know, the architecture mentioned above cannot be applied to PySide2 currently [due to this issue](https://bugreports.qt.io/browse/PYSIDE-900). I hope the Qt company would provide a cleaner and simpler solution regarding the interaction between Python and QML in [the future (Qt 6)](https://www.qt.io/blog/2019/08/07/technical-vision-qt-6).
37 |
38 | ## Installation
39 |
40 | Clone the project.
41 |
42 | ``` shell
43 | git clone https://github.com/seanwu1105/neural-network-sandbox
44 | ```
45 |
46 | Install requirements.
47 |
48 | ``` shell
49 | pip install -r requirements.txt
50 | ```
51 |
52 | Start the application.
53 |
54 | ``` shell
55 | python main.py
56 | ```
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 |
4 | import PyQt5.QtQml
5 | import PyQt5.QtCore
6 | import PyQt5.QtWidgets
7 |
8 | from nn_sandbox.bridges import PerceptronBridge, MlpBridge, RbfnBridge, SomBridge
9 | import nn_sandbox.backend.utils
10 |
11 | if __name__ == '__main__':
12 | os.environ['QT_QUICK_CONTROLS_STYLE'] = 'Default'
13 |
14 | # XXX: Why I Have To Use QApplication instead of QGuiApplication? It seams
15 | # QGuiApplication cannot load QML Chart libs!
16 | app = PyQt5.QtWidgets.QApplication(sys.argv)
17 | engine = PyQt5.QtQml.QQmlApplicationEngine()
18 |
19 | bridges = {
20 | 'perceptronBridge': PerceptronBridge(),
21 | 'mlpBridge': MlpBridge(),
22 | 'rbfnBridge': RbfnBridge(),
23 | 'somBridge': SomBridge()
24 | }
25 | for name in bridges:
26 | bridges[name].dataset_dict = nn_sandbox.backend.utils.read_data()
27 | engine.rootContext().setContextProperty(name, bridges[name])
28 |
29 | engine.load('./nn_sandbox/frontend/main.qml')
30 | if not engine.rootObjects():
31 | sys.exit(-1)
32 | sys.exit(app.exec_())
33 |
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2CS.txt:
--------------------------------------------------------------------------------
1 | 1.590200 1.645400 1
2 | 2.508300 1.423700 1
3 | 1.886000 2.631600 1
4 | 1.710600 2.949500 1
5 | 2.038600 1.538100 1
6 | 3.235600 2.619200 1
7 | 2.912100 1.804200 1
8 | 2.657700 2.759400 1
9 | 2.647400 2.515200 1
10 | 2.917300 1.657700 1
11 | 3.189600 2.006900 1
12 | 1.974800 1.847100 1
13 | 2.794700 2.242500 1
14 | 2.279700 2.854900 1
15 | 1.276100 2.540700 1
16 | 2.212800 1.957600 1
17 | 2.435800 1.930100 1
18 | 2.505900 2.423000 1
19 | 2.752600 1.927300 1
20 | 1.830200 2.120400 1
21 | 3.225100 2.214500 1
22 | 1.697400 1.852400 1
23 | 1.583800 2.650300 1
24 | 2.275800 1.662500 1
25 | 1.732400 2.957600 1
26 | 2.577300 3.300500 1
27 | 2.586400 1.341200 1
28 | 1.937200 2.962400 1
29 | 2.079900 1.297200 1
30 | 2.121900 2.761200 1
31 | 2.536300 2.336400 1
32 | 1.694800 1.703000 1
33 | 2.266000 2.424900 1
34 | 2.776200 2.047200 1
35 | 2.913700 2.326300 1
36 | 1.943700 1.853200 1
37 | 1.922600 1.403700 1
38 | 1.998100 2.229200 1
39 | 2.220700 1.705200 1
40 | 2.235300 3.191600 1
41 | 2.541500 2.029200 1
42 | 2.171100 1.601300 1
43 | 1.786300 2.433800 1
44 | 2.632000 1.616200 1
45 | 1.698200 2.664700 1
46 | 2.137400 2.044100 1
47 | 2.137200 1.718700 1
48 | 2.983600 2.131800 1
49 | 2.792100 1.673600 1
50 | 1.578400 2.515600 1
51 | 2.910600 2.949700 1
52 | 1.581800 2.821600 1
53 | 1.569300 2.121200 1
54 | 2.396700 2.952400 1
55 | 2.902400 2.241000 1
56 | 2.535800 3.120500 1
57 | 3.196200 1.884400 1
58 | 1.857800 1.916000 1
59 | 2.568700 2.170800 1
60 | 2.956500 2.088400 1
61 | 2.904900 1.426300 1
62 | 2.284900 1.874500 1
63 | 2.700300 2.947300 1
64 | 1.604900 2.347400 1
65 | 2.343100 1.307100 1
66 | 2.422600 2.828000 1
67 | 2.980700 2.808800 1
68 | 1.469500 2.209700 1
69 | 2.401600 2.553400 1
70 | 2.399600 1.615900 1
71 | 2.639700 2.348900 1
72 | 1.285900 2.250900 1
73 | 1.539100 1.898800 1
74 | 2.970900 2.593500 1
75 | 1.864400 2.871700 1
76 | 2.932100 2.174400 1
77 | 1.338000 1.855500 1
78 | 3.193000 2.584400 1
79 | 2.303600 2.281800 1
80 | 2.203800 3.216300 1
81 | 1.666400 1.609700 1
82 | 3.063900 1.672800 1
83 | 1.693000 1.863800 1
84 | 1.339400 2.499000 1
85 | 2.106700 1.836800 1
86 | 2.358200 3.138300 1
87 | 1.681000 2.969400 1
88 | 2.082300 1.332300 1
89 | 1.550000 2.722900 1
90 | 1.491700 2.276200 1
91 | 2.696900 1.644100 1
92 | 1.820500 2.421200 1
93 | 1.730400 1.691900 1
94 | 2.994500 1.788800 1
95 | 2.669200 2.300700 1
96 | 3.022700 2.025300 1
97 | 3.352300 2.433000 1
98 | 2.873900 2.417500 1
99 | 2.498800 2.689100 1
100 | 2.832300 3.005600 1
101 | 1.747700 2.184900 1
102 | 2.637500 2.143100 1
103 | 2.463000 2.609400 1
104 | 2.230300 2.964700 1
105 | 2.593400 2.073100 1
106 | 2.059200 1.762500 1
107 | 2.393100 1.390100 1
108 | 2.426500 3.176700 1
109 | 2.659900 1.459200 1
110 | 2.776100 2.553200 1
111 | 3.073600 2.056300 1
112 | 1.436800 2.089100 1
113 | 2.923500 2.588900 1
114 | 2.359600 2.170900 1
115 | 3.091800 1.550400 1
116 | 2.590200 1.743000 1
117 | 2.170900 2.636500 1
118 | 2.356100 2.269800 1
119 | 2.113700 1.346900 1
120 | 2.095900 2.073900 1
121 | 2.740500 3.099000 1
122 | 3.142600 1.842900 1
123 | 2.325400 1.988000 1
124 | 1.585100 2.805600 1
125 | 2.416400 1.483900 1
126 | 2.941500 1.766200 1
127 | 3.048700 2.565600 1
128 | 2.827400 3.040800 1
129 | 2.846900 1.928600 1
130 | 2.136600 3.048200 1
131 | 2.121600 1.325800 1
132 | 2.475100 2.685900 1
133 | 2.193100 1.419200 1
134 | 2.170000 1.295400 1
135 | 1.780800 2.836900 1
136 | 1.993100 3.225000 1
137 | 1.735600 1.844800 1
138 | 2.984500 1.979700 1
139 | 2.153400 3.197300 1
140 | 2.904500 3.064700 1
141 | 2.846500 2.990200 1
142 | 2.715200 2.909300 1
143 | 2.022400 2.263900 1
144 | 2.753700 1.874800 1
145 | 2.330600 1.394000 1
146 | 2.406800 2.544000 1
147 | 2.442100 1.609100 1
148 | 1.753500 2.763500 1
149 | 2.401900 2.921400 1
150 | 2.578900 2.975700 1
151 | 2.559300 2.365900 1
152 | 2.035200 1.405800 1
153 | 1.609600 2.914400 1
154 | 1.885900 1.701600 1
155 | 2.056900 2.683000 1
156 | 1.503000 1.842500 1
157 | 2.198400 2.437100 1
158 | 2.287100 2.531100 1
159 | 1.897200 2.974700 1
160 | 1.511700 2.498200 1
161 | 2.418100 1.490100 1
162 | 3.139600 1.959900 1
163 | 2.644700 1.300900 1
164 | 2.671300 2.538700 1
165 | 1.514500 2.832900 1
166 | 3.268600 2.418200 1
167 | 2.061100 2.917000 1
168 | 2.816300 1.529300 1
169 | 2.429300 2.809700 1
170 | 2.033600 1.582200 1
171 | 2.016900 2.348000 1
172 | 3.287200 2.323900 1
173 | 2.837400 2.207400 1
174 | 1.952200 2.405400 1
175 | 1.736200 2.255100 1
176 | 1.928000 2.704500 1
177 | 2.394000 3.233600 1
178 | 1.801700 1.993500 1
179 | 1.433400 2.269100 1
180 | 2.143000 1.740400 1
181 | 2.111100 3.117100 1
182 | 1.631700 1.827700 1
183 | 2.879300 2.945100 1
184 | 3.034800 2.888000 1
185 | 2.286100 2.403700 1
186 | 3.289300 2.540300 1
187 | 2.185600 3.124800 1
188 | 2.634000 2.222000 1
189 | 1.881900 2.689800 1
190 | 2.820200 2.128600 1
191 | 2.042400 2.283500 1
192 | 1.584900 1.780500 1
193 | 2.235700 2.680000 1
194 | 2.818200 1.908500 1
195 | 1.538200 2.706600 1
196 | 1.860300 2.239600 1
197 | 1.696000 2.018200 1
198 | 1.615800 1.796900 1
199 | 1.741500 3.011300 1
200 | 1.632200 1.789200 1
201 | 3.895100 3.916500 2
202 | 4.713500 3.762000 2
203 | 4.089900 4.880100 2
204 | 4.027300 5.184600 2
205 | 4.403700 3.798200 2
206 | 5.544600 5.018000 2
207 | 5.230000 4.088500 2
208 | 4.968000 5.146100 2
209 | 4.954400 4.791400 2
210 | 5.163800 4.001200 2
211 | 5.541200 4.287600 2
212 | 4.177900 4.047900 2
213 | 5.062600 4.566900 2
214 | 4.656300 5.179100 2
215 | 3.576000 4.785200 2
216 | 4.566800 4.305000 2
217 | 4.792700 4.289700 2
218 | 4.790000 4.814600 2
219 | 5.086300 4.215100 2
220 | 4.052500 4.501300 2
221 | 5.429500 4.446500 2
222 | 4.029500 4.171500 2
223 | 3.924400 4.915100 2
224 | 4.571900 4.012300 2
225 | 3.989700 5.316900 2
226 | 4.883800 5.689900 2
227 | 4.963500 3.628500 2
228 | 4.262900 5.305100 2
229 | 4.296300 3.532300 2
230 | 4.461700 5.019400 2
231 | 4.811200 4.607200 2
232 | 4.047100 3.966600 2
233 | 4.493200 4.753800 2
234 | 5.115900 4.446900 2
235 | 5.247700 4.555200 2
236 | 4.277600 4.102700 2
237 | 4.208400 3.707300 2
238 | 4.290200 4.456200 2
239 | 4.449400 3.988600 2
240 | 4.605700 5.581900 2
241 | 4.820800 4.259200 2
242 | 4.432000 3.843000 2
243 | 4.090600 4.642100 2
244 | 5.022300 3.883400 2
245 | 3.997900 4.912000 2
246 | 4.476400 4.338700 2
247 | 4.515400 4.083900 2
248 | 5.252300 4.506600 2
249 | 5.064500 3.931700 2
250 | 3.812200 4.915500 2
251 | 5.284600 5.181100 2
252 | 3.803100 5.201700 2
253 | 3.887800 4.323400 2
254 | 4.779200 5.331600 2
255 | 5.113600 4.573100 2
256 | 4.775200 5.416000 2
257 | 5.558300 4.208400 2
258 | 4.072300 4.194200 2
259 | 4.942400 4.389500 2
260 | 5.273400 4.335600 2
261 | 5.134700 3.814000 2
262 | 4.632100 4.244700 2
263 | 4.995600 5.209700 2
264 | 3.887300 4.741100 2
265 | 4.610500 3.524300 2
266 | 4.795800 5.117500 2
267 | 5.202600 5.013800 2
268 | 3.849700 4.493300 2
269 | 4.702200 4.824200 2
270 | 4.788000 4.012500 2
271 | 4.909900 4.624000 2
272 | 3.677200 4.477700 2
273 | 3.866700 4.157000 2
274 | 5.329000 4.885700 2
275 | 4.108300 5.244000 2
276 | 5.320000 4.436500 2
277 | 3.593900 4.064500 2
278 | 5.408600 4.822100 2
279 | 4.546700 4.675400 2
280 | 4.600600 5.594400 2
281 | 3.966000 3.938500 2
282 | 5.302400 4.045200 2
283 | 4.039300 4.131200 2
284 | 3.580400 4.707300 2
285 | 4.352700 4.161200 2
286 | 4.720300 5.400500 2
287 | 3.945800 5.273800 2
288 | 4.434500 3.579300 2
289 | 3.881900 5.026500 2
290 | 3.726500 4.543400 2
291 | 5.039800 3.921500 2
292 | 4.116500 4.644000 2
293 | 4.030700 4.049900 2
294 | 5.281400 4.030000 2
295 | 4.901500 4.561300 2
296 | 5.342100 4.242100 2
297 | 5.668800 4.827700 2
298 | 5.078800 4.674800 2
299 | 4.849700 4.916500 2
300 | 5.221600 5.345200 2
301 | 4.013900 4.490100 2
302 | 5.003700 4.467400 2
303 | 4.848800 4.815200 2
304 | 4.577400 5.174300 2
305 | 4.974600 4.273300 2
306 | 4.260700 3.985400 2
307 | 4.664200 3.632600 2
308 | 4.798400 5.397800 2
309 | 4.890400 3.695700 2
310 | 5.033500 4.868100 2
311 | 5.285900 4.344100 2
312 | 3.717900 4.308500 2
313 | 5.211000 4.828400 2
314 | 4.571400 4.385300 2
315 | 5.353000 3.921600 2
316 | 4.924200 4.098500 2
317 | 4.449500 4.848400 2
318 | 4.645500 4.534500 2
319 | 4.390600 3.713800 2
320 | 4.306200 4.449700 2
321 | 5.025100 5.468200 2
322 | 5.503900 4.207600 2
323 | 4.606600 4.312100 2
324 | 3.971900 5.077000 2
325 | 4.665000 3.793400 2
326 | 5.248800 4.049600 2
327 | 5.434500 4.927400 2
328 | 5.078700 5.248600 2
329 | 5.051700 4.271400 2
330 | 4.402400 5.365000 2
331 | 4.355400 3.569000 2
332 | 4.804700 4.968600 2
333 | 4.526300 3.768900 2
334 | 4.435300 3.689800 2
335 | 4.154800 5.149000 2
336 | 4.391300 5.466500 2
337 | 3.960500 4.173700 2
338 | 5.276300 4.221200 2
339 | 4.374700 5.559600 2
340 | 5.121300 5.332400 2
341 | 5.105300 5.219000 2
342 | 4.994800 5.159400 2
343 | 4.224600 4.584400 2
344 | 5.002700 4.092800 2
345 | 4.630900 3.653100 2
346 | 4.648300 4.865500 2
347 | 4.756500 3.949300 2
348 | 3.978800 5.020100 2
349 | 4.787000 5.183400 2
350 | 4.915200 5.371700 2
351 | 4.760900 4.596800 2
352 | 4.295000 3.803000 2
353 | 3.847900 5.149200 2
354 | 4.154600 4.045100 2
355 | 4.294200 5.072900 2
356 | 3.769300 4.171700 2
357 | 4.469400 4.731000 2
358 | 4.516700 4.808500 2
359 | 4.172600 5.309300 2
360 | 3.742900 4.875000 2
361 | 4.796500 3.775100 2
362 | 5.422100 4.311000 2
363 | 4.931000 3.564600 2
364 | 5.061900 4.853400 2
365 | 3.781300 5.133700 2
366 | 5.651800 4.632700 2
367 | 4.373700 5.143100 2
368 | 5.107200 3.845000 2
369 | 4.756800 5.179400 2
370 | 4.360900 3.797700 2
371 | 4.395800 4.603400 2
372 | 5.502500 4.569300 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2Ccircle1.txt:
--------------------------------------------------------------------------------
1 | -0.900000 1.900000 1
2 | -0.903083 1.978459 1
3 | -0.912312 2.056434 1
4 | -0.927630 2.133445 1
5 | -0.948943 2.209017 1
6 | -0.976120 2.282683 1
7 | -1.008993 2.353991 1
8 | -1.047360 2.422499 1
9 | -1.090983 2.487785 1
10 | -1.139594 2.549448 1
11 | -1.192893 2.607107 1
12 | -1.250552 2.660406 1
13 | -1.312215 2.709017 1
14 | -1.377501 2.752640 1
15 | -1.446009 2.791006 1
16 | -1.517316 2.823880 1
17 | -1.590983 2.851056 1
18 | -1.666555 2.872370 1
19 | -1.743566 2.887688 1
20 | -1.821541 2.896917 1
21 | -1.900000 2.900000 1
22 | -1.978459 2.896917 1
23 | -2.056435 2.887688 1
24 | -2.133445 2.872370 1
25 | -2.209017 2.851056 1
26 | -2.282684 2.823879 1
27 | -2.353991 2.791006 1
28 | -2.422499 2.752640 1
29 | -2.487785 2.709017 1
30 | -2.549448 2.660406 1
31 | -2.607107 2.607107 1
32 | -2.660406 2.549448 1
33 | -2.709017 2.487785 1
34 | -2.752640 2.422498 1
35 | -2.791007 2.353990 1
36 | -2.823880 2.282683 1
37 | -2.851057 2.209017 1
38 | -2.872370 2.133445 1
39 | -2.887688 2.056434 1
40 | -2.896917 1.978459 1
41 | -2.900000 1.899999 1
42 | -2.896917 1.821540 1
43 | -2.887688 1.743565 1
44 | -2.872370 1.666554 1
45 | -2.851056 1.590982 1
46 | -2.823879 1.517316 1
47 | -2.791006 1.446009 1
48 | -2.752640 1.377501 1
49 | -2.709017 1.312214 1
50 | -2.660405 1.250551 1
51 | -2.607106 1.192893 1
52 | -2.549448 1.139594 1
53 | -2.487785 1.090983 1
54 | -2.422498 1.047359 1
55 | -2.353990 1.008993 1
56 | -2.282683 0.976120 1
57 | -2.209016 0.948943 1
58 | -2.133445 0.927630 1
59 | -2.056434 0.912312 1
60 | -1.978458 0.903083 1
61 | -1.899999 0.900000 1
62 | -1.821540 0.903083 1
63 | -1.743565 0.912312 1
64 | -1.666554 0.927630 1
65 | -1.590982 0.948944 1
66 | -1.517316 0.976121 1
67 | -1.446008 1.008994 1
68 | -1.377500 1.047360 1
69 | -1.312214 1.090984 1
70 | -1.250551 1.139595 1
71 | -1.192892 1.192894 1
72 | -1.139593 1.250553 1
73 | -1.090982 1.312216 1
74 | -1.047359 1.377503 1
75 | -1.008993 1.446011 1
76 | -0.976120 1.517318 1
77 | -0.948943 1.590984 1
78 | -0.927630 1.666556 1
79 | -0.912311 1.743567 1
80 | -0.903083 1.821542 1
81 | 0.200000 1.800000 2
82 | 0.198458 1.878520 2
83 | 0.193835 1.956918 2
84 | 0.186137 2.035075 2
85 | 0.175377 2.112869 2
86 | 0.161571 2.190181 2
87 | 0.144740 2.266891 2
88 | 0.124910 2.342881 2
89 | 0.102113 2.418034 2
90 | 0.076383 2.492234 2
91 | 0.047759 2.565367 2
92 | 0.016286 2.637319 2
93 | -0.017987 2.707981 2
94 | -0.055008 2.777242 2
95 | -0.094720 2.844997 2
96 | -0.137061 2.911140 2
97 | -0.181966 2.975570 2
98 | -0.229366 3.038188 2
99 | -0.279188 3.098896 2
100 | -0.331355 3.157602 2
101 | -0.385786 3.214214 2
102 | -0.442399 3.268645 2
103 | -0.501104 3.320812 2
104 | -0.561812 3.370634 2
105 | -0.624430 3.418034 2
106 | -0.688860 3.462939 2
107 | -0.755003 3.505280 2
108 | -0.822758 3.544992 2
109 | -0.892019 3.582013 2
110 | -0.962681 3.616287 2
111 | -1.034633 3.647759 2
112 | -1.107766 3.676383 2
113 | -1.181966 3.702113 2
114 | -1.257119 3.724910 2
115 | -1.333110 3.744740 2
116 | -1.409820 3.761571 2
117 | -1.487131 3.775377 2
118 | -1.564926 3.786137 2
119 | -1.643082 3.793835 2
120 | -1.721481 3.798458 2
121 | -1.800001 3.800000 2
122 | -1.878520 3.798458 2
123 | -1.956919 3.793835 2
124 | -2.035075 3.786137 2
125 | -2.112870 3.775377 2
126 | -2.190181 3.761570 2
127 | -2.266891 3.744740 2
128 | -2.342882 3.724910 2
129 | -2.418035 3.702113 2
130 | -2.492235 3.676382 2
131 | -2.565368 3.647759 2
132 | -2.637320 3.616286 2
133 | -2.707982 3.582013 2
134 | -2.777243 3.544992 2
135 | -2.844998 3.505280 2
136 | -2.911141 3.462939 2
137 | -2.975571 3.418034 2
138 | -3.038189 3.370633 2
139 | -3.098897 3.320811 2
140 | -3.157602 3.268644 2
141 | -3.214214 3.214213 2
142 | -3.268646 3.157601 2
143 | -3.320813 3.098895 2
144 | -3.370635 3.038187 2
145 | -3.418035 2.975570 2
146 | -3.462940 2.911139 2
147 | -3.505281 2.844996 2
148 | -3.544993 2.777241 2
149 | -3.582014 2.707980 2
150 | -3.616287 2.637318 2
151 | -3.647760 2.565366 2
152 | -3.676383 2.492233 2
153 | -3.702113 2.418033 2
154 | -3.724911 2.342880 2
155 | -3.744740 2.266889 2
156 | -3.761571 2.190179 2
157 | -3.775377 2.112867 2
158 | -3.786137 2.035073 2
159 | -3.793835 1.956917 2
160 | -3.798458 1.878518 2
161 | -3.800000 1.799998 2
162 | -3.798458 1.721479 2
163 | -3.793834 1.643080 2
164 | -3.786137 1.564924 2
165 | -3.775376 1.487129 2
166 | -3.761570 1.409818 2
167 | -3.744740 1.333107 2
168 | -3.724910 1.257117 2
169 | -3.702112 1.181964 2
170 | -3.676382 1.107764 2
171 | -3.647758 1.034631 2
172 | -3.616286 0.962679 2
173 | -3.582012 0.892017 2
174 | -3.544991 0.822756 2
175 | -3.505279 0.755001 2
176 | -3.462938 0.688858 2
177 | -3.418033 0.624428 2
178 | -3.370633 0.561810 2
179 | -3.320811 0.501102 2
180 | -3.268644 0.442397 2
181 | -3.214212 0.385785 2
182 | -3.157600 0.331353 2
183 | -3.098894 0.279187 2
184 | -3.038186 0.229365 2
185 | -2.975569 0.181965 2
186 | -2.911139 0.137059 2
187 | -2.844995 0.094718 2
188 | -2.777240 0.055007 2
189 | -2.707979 0.017986 2
190 | -2.637317 -0.016287 2
191 | -2.565365 -0.047760 2
192 | -2.492232 -0.076384 2
193 | -2.418031 -0.102114 2
194 | -2.342878 -0.124911 2
195 | -2.266888 -0.144740 2
196 | -2.190178 -0.161571 2
197 | -2.112866 -0.175377 2
198 | -2.035072 -0.186137 2
199 | -1.956915 -0.193835 2
200 | -1.878517 -0.198458 2
201 | -1.799997 -0.200000 2
202 | -1.721478 -0.198458 2
203 | -1.643079 -0.193834 2
204 | -1.564922 -0.186137 2
205 | -1.487128 -0.175376 2
206 | -1.409816 -0.161570 2
207 | -1.333106 -0.144739 2
208 | -1.257116 -0.124910 2
209 | -1.181963 -0.102112 2
210 | -1.107763 -0.076382 2
211 | -1.034630 -0.047758 2
212 | -0.962678 -0.016285 2
213 | -0.892016 0.017988 2
214 | -0.822755 0.055010 2
215 | -0.755000 0.094721 2
216 | -0.688857 0.137063 2
217 | -0.624427 0.181968 2
218 | -0.561809 0.229368 2
219 | -0.501101 0.279190 2
220 | -0.442396 0.331357 2
221 | -0.385784 0.385789 2
222 | -0.331353 0.442401 2
223 | -0.279186 0.501107 2
224 | -0.229364 0.561815 2
225 | -0.181964 0.624432 2
226 | -0.137059 0.688863 2
227 | -0.094718 0.755006 2
228 | -0.055006 0.822761 2
229 | -0.017985 0.892022 2
230 | 0.016288 0.962684 2
231 | 0.047761 1.034637 2
232 | 0.076384 1.107769 2
233 | 0.102114 1.181970 2
234 | 0.124912 1.257123 2
235 | 0.144741 1.333113 2
236 | 0.161571 1.409823 2
237 | 0.175377 1.487135 2
238 | 0.186137 1.564929 2
239 | 0.193835 1.643086 2
240 | 0.198458 1.721485 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2Circle1.txt:
--------------------------------------------------------------------------------
1 | 1.000000 0.000000 1
2 | 0.996917 0.078459 1
3 | 0.987688 0.156434 1
4 | 0.972370 0.233445 1
5 | 0.951057 0.309017 1
6 | 0.923880 0.382683 1
7 | 0.891007 0.453991 1
8 | 0.852640 0.522499 1
9 | 0.809017 0.587785 1
10 | 0.760406 0.649448 1
11 | 0.707107 0.707107 1
12 | 0.649448 0.760406 1
13 | 0.587785 0.809017 1
14 | 0.522499 0.852640 1
15 | 0.453991 0.891006 1
16 | 0.382684 0.923880 1
17 | 0.309017 0.951056 1
18 | 0.233445 0.972370 1
19 | 0.156434 0.987688 1
20 | 0.078459 0.996917 1
21 | -0.000000 1.000000 1
22 | -0.078459 0.996917 1
23 | -0.156435 0.987688 1
24 | -0.233445 0.972370 1
25 | -0.309017 0.951056 1
26 | -0.382684 0.923879 1
27 | -0.453991 0.891006 1
28 | -0.522499 0.852640 1
29 | -0.587785 0.809017 1
30 | -0.649448 0.760406 1
31 | -0.707107 0.707107 1
32 | -0.760406 0.649448 1
33 | -0.809017 0.587785 1
34 | -0.852640 0.522498 1
35 | -0.891007 0.453990 1
36 | -0.923880 0.382683 1
37 | -0.951057 0.309017 1
38 | -0.972370 0.233445 1
39 | -0.987688 0.156434 1
40 | -0.996917 0.078459 1
41 | -1.000000 -0.000001 1
42 | -0.996917 -0.078460 1
43 | -0.987688 -0.156435 1
44 | -0.972370 -0.233446 1
45 | -0.951056 -0.309018 1
46 | -0.923879 -0.382684 1
47 | -0.891006 -0.453991 1
48 | -0.852640 -0.522499 1
49 | -0.809017 -0.587786 1
50 | -0.760405 -0.649449 1
51 | -0.707106 -0.707107 1
52 | -0.649448 -0.760406 1
53 | -0.587785 -0.809017 1
54 | -0.522498 -0.852641 1
55 | -0.453990 -0.891007 1
56 | -0.382683 -0.923880 1
57 | -0.309016 -0.951057 1
58 | -0.233445 -0.972370 1
59 | -0.156434 -0.987688 1
60 | -0.078458 -0.996917 1
61 | 0.000001 -1.000000 1
62 | 0.078460 -0.996917 1
63 | 0.156435 -0.987688 1
64 | 0.233446 -0.972370 1
65 | 0.309018 -0.951056 1
66 | 0.382684 -0.923879 1
67 | 0.453992 -0.891006 1
68 | 0.522500 -0.852640 1
69 | 0.587786 -0.809016 1
70 | 0.649449 -0.760405 1
71 | 0.707108 -0.707106 1
72 | 0.760407 -0.649447 1
73 | 0.809018 -0.587784 1
74 | 0.852641 -0.522497 1
75 | 0.891007 -0.453989 1
76 | 0.923880 -0.382682 1
77 | 0.951057 -0.309016 1
78 | 0.972370 -0.233444 1
79 | 0.987689 -0.156433 1
80 | 0.996917 -0.078458 1
81 | 0.200000 1.800000 2
82 | 0.198458 1.878520 2
83 | 0.193835 1.956918 2
84 | 0.186137 2.035075 2
85 | 0.175377 2.112869 2
86 | 0.161571 2.190181 2
87 | 0.144740 2.266891 2
88 | 0.124910 2.342881 2
89 | 0.102113 2.418034 2
90 | 0.076383 2.492234 2
91 | 0.047759 2.565367 2
92 | 0.016286 2.637319 2
93 | -0.017987 2.707981 2
94 | -0.055008 2.777242 2
95 | -0.094720 2.844997 2
96 | -0.137061 2.911140 2
97 | -0.181966 2.975570 2
98 | -0.229366 3.038188 2
99 | -0.279188 3.098896 2
100 | -0.331355 3.157602 2
101 | -0.385786 3.214214 2
102 | -0.442399 3.268645 2
103 | -0.501104 3.320812 2
104 | -0.561812 3.370634 2
105 | -0.624430 3.418034 2
106 | -0.688860 3.462939 2
107 | -0.755003 3.505280 2
108 | -0.822758 3.544992 2
109 | -0.892019 3.582013 2
110 | -0.962681 3.616287 2
111 | -1.034633 3.647759 2
112 | -1.107766 3.676383 2
113 | -1.181966 3.702113 2
114 | -1.257119 3.724910 2
115 | -1.333110 3.744740 2
116 | -1.409820 3.761571 2
117 | -1.487131 3.775377 2
118 | -1.564926 3.786137 2
119 | -1.643082 3.793835 2
120 | -1.721481 3.798458 2
121 | -1.800001 3.800000 2
122 | -1.878520 3.798458 2
123 | -1.956919 3.793835 2
124 | -2.035075 3.786137 2
125 | -2.112870 3.775377 2
126 | -2.190181 3.761570 2
127 | -2.266891 3.744740 2
128 | -2.342882 3.724910 2
129 | -2.418035 3.702113 2
130 | -2.492235 3.676382 2
131 | -2.565368 3.647759 2
132 | -2.637320 3.616286 2
133 | -2.707982 3.582013 2
134 | -2.777243 3.544992 2
135 | -2.844998 3.505280 2
136 | -2.911141 3.462939 2
137 | -2.975571 3.418034 2
138 | -3.038189 3.370633 2
139 | -3.098897 3.320811 2
140 | -3.157602 3.268644 2
141 | -3.214214 3.214213 2
142 | -3.268646 3.157601 2
143 | -3.320813 3.098895 2
144 | -3.370635 3.038187 2
145 | -3.418035 2.975570 2
146 | -3.462940 2.911139 2
147 | -3.505281 2.844996 2
148 | -3.544993 2.777241 2
149 | -3.582014 2.707980 2
150 | -3.616287 2.637318 2
151 | -3.647760 2.565366 2
152 | -3.676383 2.492233 2
153 | -3.702113 2.418033 2
154 | -3.724911 2.342880 2
155 | -3.744740 2.266889 2
156 | -3.761571 2.190179 2
157 | -3.775377 2.112867 2
158 | -3.786137 2.035073 2
159 | -3.793835 1.956917 2
160 | -3.798458 1.878518 2
161 | -3.800000 1.799998 2
162 | -3.798458 1.721479 2
163 | -3.793834 1.643080 2
164 | -3.786137 1.564924 2
165 | -3.775376 1.487129 2
166 | -3.761570 1.409818 2
167 | -3.744740 1.333107 2
168 | -3.724910 1.257117 2
169 | -3.702112 1.181964 2
170 | -3.676382 1.107764 2
171 | -3.647758 1.034631 2
172 | -3.616286 0.962679 2
173 | -3.582012 0.892017 2
174 | -3.544991 0.822756 2
175 | -3.505279 0.755001 2
176 | -3.462938 0.688858 2
177 | -3.418033 0.624428 2
178 | -3.370633 0.561810 2
179 | -3.320811 0.501102 2
180 | -3.268644 0.442397 2
181 | -3.214212 0.385785 2
182 | -3.157600 0.331353 2
183 | -3.098894 0.279187 2
184 | -3.038186 0.229365 2
185 | -2.975569 0.181965 2
186 | -2.911139 0.137059 2
187 | -2.844995 0.094718 2
188 | -2.777240 0.055007 2
189 | -2.707979 0.017986 2
190 | -2.637317 -0.016287 2
191 | -2.565365 -0.047760 2
192 | -2.492232 -0.076384 2
193 | -2.418031 -0.102114 2
194 | -2.342878 -0.124911 2
195 | -2.266888 -0.144740 2
196 | -2.190178 -0.161571 2
197 | -2.112866 -0.175377 2
198 | -2.035072 -0.186137 2
199 | -1.956915 -0.193835 2
200 | -1.878517 -0.198458 2
201 | -1.799997 -0.200000 2
202 | -1.721478 -0.198458 2
203 | -1.643079 -0.193834 2
204 | -1.564922 -0.186137 2
205 | -1.487128 -0.175376 2
206 | -1.409816 -0.161570 2
207 | -1.333106 -0.144739 2
208 | -1.257116 -0.124910 2
209 | -1.181963 -0.102112 2
210 | -1.107763 -0.076382 2
211 | -1.034630 -0.047758 2
212 | -0.962678 -0.016285 2
213 | -0.892016 0.017988 2
214 | -0.822755 0.055010 2
215 | -0.755000 0.094721 2
216 | -0.688857 0.137063 2
217 | -0.624427 0.181968 2
218 | -0.561809 0.229368 2
219 | -0.501101 0.279190 2
220 | -0.442396 0.331357 2
221 | -0.385784 0.385789 2
222 | -0.331353 0.442401 2
223 | -0.279186 0.501107 2
224 | -0.229364 0.561815 2
225 | -0.181964 0.624432 2
226 | -0.137059 0.688863 2
227 | -0.094718 0.755006 2
228 | -0.055006 0.822761 2
229 | -0.017985 0.892022 2
230 | 0.016288 0.962684 2
231 | 0.047761 1.034637 2
232 | 0.076384 1.107769 2
233 | 0.102114 1.181970 2
234 | 0.124912 1.257123 2
235 | 0.144741 1.333113 2
236 | 0.161571 1.409823 2
237 | 0.175377 1.487135 2
238 | 0.186137 1.564929 2
239 | 0.193835 1.643086 2
240 | 0.198458 1.721485 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2Circle2.txt:
--------------------------------------------------------------------------------
1 | 1.000000 0.000000 1
2 | 0.996917 0.078459 1
3 | 0.987688 0.156434 1
4 | 0.972370 0.233445 1
5 | 0.951057 0.309017 1
6 | 0.923880 0.382683 1
7 | 0.891007 0.453991 1
8 | 0.852640 0.522499 1
9 | 0.809017 0.587785 1
10 | 0.760406 0.649448 1
11 | 0.707107 0.707107 1
12 | 0.649448 0.760406 1
13 | 0.587785 0.809017 1
14 | 0.522499 0.852640 1
15 | 0.453991 0.891006 1
16 | 0.382684 0.923880 1
17 | 0.309017 0.951056 1
18 | 0.233445 0.972370 1
19 | 0.156434 0.987688 1
20 | 0.078459 0.996917 1
21 | -0.000000 1.000000 1
22 | -0.078459 0.996917 1
23 | -0.156435 0.987688 1
24 | -0.233445 0.972370 1
25 | -0.309017 0.951056 1
26 | -0.382684 0.923879 1
27 | -0.453991 0.891006 1
28 | -0.522499 0.852640 1
29 | -0.587785 0.809017 1
30 | -0.649448 0.760406 1
31 | -0.707107 0.707107 1
32 | -0.760406 0.649448 1
33 | -0.809017 0.587785 1
34 | -0.852640 0.522498 1
35 | -0.891007 0.453990 1
36 | -0.923880 0.382683 1
37 | -0.951057 0.309017 1
38 | -0.972370 0.233445 1
39 | -0.987688 0.156434 1
40 | -0.996917 0.078459 1
41 | -1.000000 -0.000001 1
42 | -0.996917 -0.078460 1
43 | -0.987688 -0.156435 1
44 | -0.972370 -0.233446 1
45 | -0.951056 -0.309018 1
46 | -0.923879 -0.382684 1
47 | -0.891006 -0.453991 1
48 | -0.852640 -0.522499 1
49 | -0.809017 -0.587786 1
50 | -0.760405 -0.649449 1
51 | -0.707106 -0.707107 1
52 | -0.649448 -0.760406 1
53 | -0.587785 -0.809017 1
54 | -0.522498 -0.852641 1
55 | -0.453990 -0.891007 1
56 | -0.382683 -0.923880 1
57 | -0.309016 -0.951057 1
58 | -0.233445 -0.972370 1
59 | -0.156434 -0.987688 1
60 | -0.078458 -0.996917 1
61 | 0.000001 -1.000000 1
62 | 0.078460 -0.996917 1
63 | 0.156435 -0.987688 1
64 | 0.233446 -0.972370 1
65 | 0.309018 -0.951056 1
66 | 0.382684 -0.923879 1
67 | 0.453992 -0.891006 1
68 | 0.522500 -0.852640 1
69 | 0.587786 -0.809016 1
70 | 0.649449 -0.760405 1
71 | 0.707108 -0.707106 1
72 | 0.760407 -0.649447 1
73 | 0.809018 -0.587784 1
74 | 0.852641 -0.522497 1
75 | 0.891007 -0.453989 1
76 | 0.923880 -0.382682 1
77 | 0.951057 -0.309016 1
78 | 0.972370 -0.233444 1
79 | 0.987689 -0.156433 1
80 | 0.996917 -0.078458 1
81 | 0.200000 1.800000 2
82 | 0.198458 1.878520 2
83 | 0.193835 1.956918 2
84 | 0.186137 2.035075 2
85 | 0.175377 2.112869 2
86 | 0.161571 2.190181 2
87 | 0.144740 2.266891 2
88 | 0.124910 2.342881 2
89 | 0.102113 2.418034 2
90 | 0.076383 2.492234 2
91 | 0.047759 2.565367 2
92 | 0.016286 2.637319 2
93 | -0.017987 2.707981 2
94 | -0.055008 2.777242 2
95 | -0.094720 2.844997 2
96 | -0.137061 2.911140 2
97 | -0.181966 2.975570 2
98 | -0.229366 3.038188 2
99 | -0.279188 3.098896 2
100 | -0.331355 3.157602 2
101 | -0.385786 3.214214 2
102 | -0.442399 3.268645 2
103 | -0.501104 3.320812 2
104 | -0.561812 3.370634 2
105 | -0.624430 3.418034 2
106 | -0.688860 3.462939 2
107 | -0.755003 3.505280 2
108 | -0.822758 3.544992 2
109 | -0.892019 3.582013 2
110 | -0.962681 3.616287 2
111 | -1.034633 3.647759 2
112 | -1.107766 3.676383 2
113 | -1.181966 3.702113 2
114 | -1.257119 3.724910 2
115 | -1.333110 3.744740 2
116 | -1.409820 3.761571 2
117 | -1.487131 3.775377 2
118 | -1.564926 3.786137 2
119 | -1.643082 3.793835 2
120 | -1.721481 3.798458 2
121 | -1.800001 3.800000 2
122 | -1.878520 3.798458 2
123 | -1.956919 3.793835 2
124 | -2.035075 3.786137 2
125 | -2.112870 3.775377 2
126 | -2.190181 3.761570 2
127 | -2.266891 3.744740 2
128 | -2.342882 3.724910 2
129 | -2.418035 3.702113 2
130 | -2.492235 3.676382 2
131 | -2.565368 3.647759 2
132 | -2.637320 3.616286 2
133 | -2.707982 3.582013 2
134 | -2.777243 3.544992 2
135 | -2.844998 3.505280 2
136 | -2.911141 3.462939 2
137 | -2.975571 3.418034 2
138 | -3.038189 3.370633 2
139 | -3.098897 3.320811 2
140 | -3.157602 3.268644 2
141 | -3.214214 3.214213 2
142 | -3.268646 3.157601 2
143 | -3.320813 3.098895 2
144 | -3.370635 3.038187 2
145 | -3.418035 2.975570 2
146 | -3.462940 2.911139 2
147 | -3.505281 2.844996 2
148 | -3.544993 2.777241 2
149 | -3.582014 2.707980 2
150 | -3.616287 2.637318 2
151 | -3.647760 2.565366 2
152 | -3.676383 2.492233 2
153 | -3.702113 2.418033 2
154 | -3.724911 2.342880 2
155 | -3.744740 2.266889 2
156 | -3.761571 2.190179 2
157 | -3.775377 2.112867 2
158 | -3.786137 2.035073 2
159 | -3.793835 1.956917 2
160 | -3.798458 1.878518 2
161 | -3.800000 1.799998 2
162 | -3.798458 1.721479 2
163 | -3.793834 1.643080 2
164 | -3.786137 1.564924 2
165 | -3.775376 1.487129 2
166 | -3.761570 1.409818 2
167 | -3.744740 1.333107 2
168 | -3.724910 1.257117 2
169 | -3.702112 1.181964 2
170 | -3.676382 1.107764 2
171 | -3.647758 1.034631 2
172 | -3.616286 0.962679 2
173 | -3.582012 0.892017 2
174 | -3.544991 0.822756 2
175 | -3.505279 0.755001 2
176 | -3.462938 0.688858 2
177 | -3.418033 0.624428 2
178 | -3.370633 0.561810 2
179 | -3.320811 0.501102 2
180 | -3.268644 0.442397 2
181 | -3.214212 0.385785 2
182 | -3.157600 0.331353 2
183 | -3.098894 0.279187 2
184 | -3.038186 0.229365 2
185 | -2.975569 0.181965 2
186 | -2.911139 0.137059 2
187 | -2.844995 0.094718 2
188 | -2.777240 0.055007 2
189 | -2.707979 0.017986 2
190 | -2.637317 -0.016287 2
191 | -2.565365 -0.047760 2
192 | -2.492232 -0.076384 2
193 | -2.418031 -0.102114 2
194 | -2.342878 -0.124911 2
195 | -2.266888 -0.144740 2
196 | -2.190178 -0.161571 2
197 | -2.112866 -0.175377 2
198 | -2.035072 -0.186137 2
199 | -1.956915 -0.193835 2
200 | -1.878517 -0.198458 2
201 | -1.799997 -0.200000 2
202 | -1.721478 -0.198458 2
203 | -1.643079 -0.193834 2
204 | -1.564922 -0.186137 2
205 | -1.487128 -0.175376 2
206 | -1.409816 -0.161570 2
207 | -1.333106 -0.144739 2
208 | -1.257116 -0.124910 2
209 | -1.181963 -0.102112 2
210 | -1.107763 -0.076382 2
211 | -1.034630 -0.047758 2
212 | -0.962678 -0.016285 2
213 | -0.892016 0.017988 2
214 | -0.822755 0.055010 2
215 | -0.755000 0.094721 2
216 | -0.688857 0.137063 2
217 | -0.624427 0.181968 2
218 | -0.561809 0.229368 2
219 | -0.501101 0.279190 2
220 | -0.442396 0.331357 2
221 | -0.385784 0.385789 2
222 | -0.331353 0.442401 2
223 | -0.279186 0.501107 2
224 | -0.229364 0.561815 2
225 | -0.181964 0.624432 2
226 | -0.137059 0.688863 2
227 | -0.094718 0.755006 2
228 | -0.055006 0.822761 2
229 | -0.017985 0.892022 2
230 | 0.016288 0.962684 2
231 | 0.047761 1.034637 2
232 | 0.076384 1.107769 2
233 | 0.102114 1.181970 2
234 | 0.124912 1.257123 2
235 | 0.144741 1.333113 2
236 | 0.161571 1.409823 2
237 | 0.175377 1.487135 2
238 | 0.186137 1.564929 2
239 | 0.193835 1.643086 2
240 | 0.198458 1.721485 2
241 | -3.730000 0.232800 4
242 | 0.117400 3.697800 4
243 | -0.229000 -0.878600 4
244 | -0.171800 3.014000 4
245 | -2.428200 2.274600 4
246 | -2.885800 0.064200 4
247 | -2.394400 -0.489600 4
248 | -0.476600 -0.015000 4
249 | -1.003400 2.579600 4
250 | -1.480800 2.811800 4
251 | -2.364200 -0.777800 4
252 | -0.704800 2.706600 4
253 | -2.261400 -0.544600 4
254 | 0.083600 3.595400 4
255 | -1.489600 -0.806000 4
256 | 0.502600 0.591200 4
257 | 0.591000 -0.349400 4
258 | -3.899600 2.504400 4
259 | -1.266400 3.484000 4
260 | -2.923200 1.809400 4
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2CloseS.txt:
--------------------------------------------------------------------------------
1 | 1.810000 0.430000 1
2 | 1.470000 0.440000 1
3 | 0.540000 0.570000 1
4 | 0.890000 0.320000 1
5 | 1.430000 -0.170000 1
6 | 0.290000 0.580000 1
7 | 1.450000 0.030000 1
8 | 0.520000 0.810000 1
9 | 1.000000 0.300000 1
10 | 1.320000 -0.140000 1
11 | 0.990000 -0.780000 1
12 | 1.780000 -0.610000 1
13 | 0.490000 -0.090000 1
14 | 0.720000 0.900000 1
15 | 1.060000 -0.590000 1
16 | 0.780000 -0.650000 1
17 | 0.670000 0.850000 1
18 | 0.580000 -0.040000 1
19 | 0.570000 0.850000 1
20 | 0.560000 -0.090000 1
21 | 1.410000 0.060000 1
22 | 0.760000 -0.050000 1
23 | 1.090000 0.040000 1
24 | 1.690000 0.040000 1
25 | 1.540000 -0.750000 1
26 | 1.110000 -0.720000 1
27 | 0.940000 0.240000 1
28 | 0.220000 0.050000 1
29 | 1.540000 0.650000 1
30 | 0.850000 0.070000 1
31 | 0.870000 0.310000 1
32 | 1.390000 0.870000 1
33 | 0.620000 0.020000 1
34 | 1.330000 0.030000 1
35 | 0.590000 -0.300000 1
36 | 1.560000 0.430000 1
37 | 1.170000 -0.450000 1
38 | 0.880000 0.040000 1
39 | 1.230000 -0.520000 1
40 | 1.230000 -0.920000 1
41 | 0.140000 0.190000 1
42 | 0.770000 0.630000 1
43 | 1.030000 -0.480000 1
44 | 0.270000 0.440000 1
45 | 0.590000 0.730000 1
46 | 1.450000 -0.680000 1
47 | 1.160000 -0.980000 1
48 | 1.530000 -0.510000 1
49 | 1.720000 0.260000 1
50 | 1.430000 0.010000 1
51 | 1.760000 -0.610000 1
52 | 0.410000 0.060000 1
53 | 1.340000 0.790000 1
54 | 0.690000 0.060000 1
55 | 1.380000 0.180000 1
56 | 0.920000 0.520000 1
57 | 1.390000 0.180000 1
58 | 1.760000 0.250000 1
59 | 1.420000 -0.770000 1
60 | 1.110000 0.350000 1
61 | 1.480000 0.750000 1
62 | 1.650000 -0.410000 1
63 | 0.710000 -0.320000 1
64 | 0.700000 -0.580000 1
65 | 1.750000 0.500000 1
66 | 0.710000 -0.290000 1
67 | 1.240000 -0.780000 1
68 | 1.120000 0.760000 1
69 | 1.160000 -0.190000 1
70 | 0.410000 0.340000 1
71 | 0.210000 -0.410000 1
72 | 0.870000 0.370000 1
73 | 1.700000 -0.450000 1
74 | 1.110000 -0.630000 1
75 | 1.860000 -0.370000 1
76 | 1.430000 0.740000 1
77 | 0.200000 -0.300000 1
78 | 0.150000 -0.340000 1
79 | 0.720000 -0.520000 1
80 | 1.500000 -0.670000 1
81 | 0.970000 -0.690000 1
82 | 1.680000 0.100000 1
83 | 0.630000 -0.520000 1
84 | 1.260000 0.670000 1
85 | 0.530000 -0.370000 1
86 | 0.900000 0.130000 1
87 | 1.430000 -0.240000 1
88 | 0.930000 0.240000 1
89 | 1.790000 0.110000 1
90 | 1.370000 -0.020000 1
91 | 1.290000 0.840000 1
92 | 0.810000 0.390000 1
93 | 0.390000 0.530000 1
94 | 0.160000 -0.070000 1
95 | 1.320000 0.210000 1
96 | 0.730000 0.140000 1
97 | 1.400000 0.710000 1
98 | 1.120000 -0.480000 1
99 | 1.200000 -0.540000 1
100 | 1.630000 -0.500000 1
101 | -1.850000 -0.170000 2
102 | -0.910000 0.210000 2
103 | -1.080000 -0.210000 2
104 | -0.680000 0.400000 2
105 | -0.950000 0.290000 2
106 | -1.570000 -0.820000 2
107 | -0.600000 0.150000 2
108 | -1.220000 -0.810000 2
109 | -1.780000 0.110000 2
110 | -1.080000 -0.620000 2
111 | -1.530000 0.280000 2
112 | -0.930000 0.350000 2
113 | -0.900000 -0.190000 2
114 | -1.900000 -0.100000 2
115 | -1.280000 -0.370000 2
116 | -0.380000 0.400000 2
117 | -0.970000 -0.940000 2
118 | -1.580000 0.410000 2
119 | -0.950000 -0.960000 2
120 | -1.460000 0.440000 2
121 | -0.300000 0.600000 2
122 | -0.210000 -0.360000 2
123 | -0.540000 -0.140000 2
124 | -1.070000 0.990000 2
125 | -1.690000 0.030000 2
126 | -0.860000 0.120000 2
127 | -1.140000 0.400000 2
128 | -0.100000 -0.260000 2
129 | -0.910000 0.190000 2
130 | -1.340000 0.110000 2
131 | -1.310000 -0.730000 2
132 | -0.630000 0.010000 2
133 | -1.530000 -0.260000 2
134 | -0.260000 -0.350000 2
135 | -0.820000 0.590000 2
136 | -0.350000 0.710000 2
137 | -1.410000 -0.330000 2
138 | -1.600000 -0.700000 2
139 | -0.560000 -0.800000 2
140 | -0.940000 -0.820000 2
141 | -0.950000 0.610000 2
142 | -0.740000 -0.010000 2
143 | -0.200000 -0.570000 2
144 | -1.710000 -0.460000 2
145 | -1.250000 0.460000 2
146 | -0.410000 0.110000 2
147 | -1.350000 0.700000 2
148 | -1.140000 -0.800000 2
149 | -1.020000 -0.300000 2
150 | -1.680000 -0.720000 2
151 | -1.200000 -0.030000 2
152 | -0.630000 0.100000 2
153 | -0.850000 -0.160000 2
154 | -0.410000 -0.730000 2
155 | -1.050000 -0.500000 2
156 | -0.080000 0.030000 2
157 | -1.370000 0.370000 2
158 | -1.760000 0.090000 2
159 | -0.610000 0.860000 2
160 | -0.850000 0.220000 2
161 | -1.900000 0.370000 2
162 | -0.840000 0.280000 2
163 | -1.100000 0.280000 2
164 | -0.920000 -0.360000 2
165 | -0.230000 -0.130000 2
166 | -1.350000 0.180000 2
167 | -0.160000 -0.220000 2
168 | -0.920000 0.490000 2
169 | -0.910000 -0.370000 2
170 | -1.590000 0.230000 2
171 | -1.260000 -0.470000 2
172 | -0.940000 0.800000 2
173 | -1.050000 -0.250000 2
174 | -1.070000 -0.130000 2
175 | -1.190000 0.930000 2
176 | -1.620000 -0.350000 2
177 | -1.750000 -0.400000 2
178 | -1.660000 -0.680000 2
179 | -1.230000 -0.760000 2
180 | -1.000000 -0.600000 2
181 | -1.100000 0.540000 2
182 | -0.970000 -0.260000 2
183 | -1.390000 -0.610000 2
184 | -1.380000 0.350000 2
185 | -0.550000 0.720000 2
186 | -1.680000 -0.610000 2
187 | -1.060000 0.140000 2
188 | -1.540000 0.170000 2
189 | -1.500000 0.610000 2
190 | -1.880000 -0.150000 2
191 | -0.560000 -0.060000 2
192 | -0.180000 0.210000 2
193 | -1.000000 -0.390000 2
194 | -0.410000 -0.710000 2
195 | -0.880000 -0.610000 2
196 | -0.960000 0.330000 2
197 | -0.530000 -0.440000 2
198 | -0.390000 0.320000 2
199 | -0.880000 -0.860000 2
200 | -1.250000 0.180000 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2CloseS2.txt:
--------------------------------------------------------------------------------
1 | 0.580000 0.710000 1
2 | 1.060000 0.080000 1
3 | 1.380000 -0.430000 1
4 | 1.070000 -0.560000 1
5 | 0.580000 0.090000 1
6 | 0.970000 0.430000 1
7 | 0.970000 -0.790000 1
8 | 1.360000 0.070000 1
9 | 1.440000 -0.010000 1
10 | 1.670000 0.220000 1
11 | 1.850000 -0.260000 1
12 | 0.290000 -0.590000 1
13 | 0.720000 0.750000 1
14 | 1.500000 0.060000 1
15 | 0.660000 -0.760000 1
16 | 1.540000 0.700000 1
17 | 1.410000 0.370000 1
18 | 0.400000 -0.370000 1
19 | 1.430000 0.750000 1
20 | 0.750000 0.480000 1
21 | 0.820000 0.100000 1
22 | 1.600000 -0.290000 1
23 | 1.020000 0.640000 1
24 | 0.520000 -0.140000 1
25 | 1.020000 -0.890000 1
26 | 0.940000 -0.980000 1
27 | 1.310000 -0.880000 1
28 | 0.650000 -0.820000 1
29 | 0.850000 0.730000 1
30 | 0.840000 0.770000 1
31 | 1.010000 -0.710000 1
32 | 1.200000 -0.600000 1
33 | 1.430000 0.070000 1
34 | 0.990000 0.990000 1
35 | 1.600000 -0.470000 1
36 | 1.440000 -0.200000 1
37 | -0.010000 -0.140000 1
38 | 0.940000 -0.850000 1
39 | 1.620000 0.200000 1
40 | 1.320000 0.330000 1
41 | 1.210000 -0.590000 1
42 | 1.390000 -0.580000 1
43 | 0.800000 -0.270000 1
44 | 1.680000 0.370000 1
45 | 1.420000 0.590000 1
46 | 0.900000 0.800000 1
47 | 1.010000 -0.700000 1
48 | 1.480000 -0.470000 1
49 | 1.540000 0.480000 1
50 | 1.380000 0.890000 1
51 | 0.050000 -0.050000 1
52 | 0.480000 0.540000 1
53 | 0.640000 -0.390000 1
54 | 1.630000 -0.370000 1
55 | 1.660000 0.680000 1
56 | 0.790000 -0.300000 1
57 | 1.040000 0.920000 1
58 | 1.000000 -0.280000 1
59 | 0.440000 0.770000 1
60 | 0.490000 -0.430000 1
61 | 0.210000 -0.160000 1
62 | 0.510000 0.790000 1
63 | 1.310000 0.490000 1
64 | 0.760000 -0.680000 1
65 | 1.200000 -0.370000 1
66 | 1.190000 0.010000 1
67 | 0.590000 0.710000 1
68 | 0.780000 0.940000 1
69 | 0.320000 -0.650000 1
70 | 1.160000 -0.490000 1
71 | 1.530000 0.010000 1
72 | 0.410000 -0.330000 1
73 | 0.960000 -0.240000 1
74 | 0.750000 0.040000 1
75 | 1.210000 -0.610000 1
76 | 1.570000 -0.500000 1
77 | 1.450000 0.020000 1
78 | 0.240000 -0.340000 1
79 | 1.260000 0.360000 1
80 | 1.000000 0.510000 1
81 | 0.150000 0.500000 1
82 | 1.460000 0.320000 1
83 | 1.320000 -0.580000 1
84 | 0.890000 0.710000 1
85 | 1.890000 0.330000 1
86 | 0.350000 0.760000 1
87 | 1.040000 0.380000 1
88 | 0.270000 -0.540000 1
89 | 1.250000 -0.370000 1
90 | -0.010000 0.000000 1
91 | 0.050000 -0.270000 1
92 | 0.490000 -0.530000 1
93 | 1.510000 -0.820000 1
94 | 1.190000 -0.650000 1
95 | 1.670000 -0.070000 1
96 | 0.660000 0.900000 1
97 | 0.600000 0.020000 1
98 | 1.330000 -0.190000 1
99 | 0.640000 0.420000 1
100 | 1.590000 0.030000 1
101 | -0.970000 0.550000 2
102 | -1.350000 0.630000 2
103 | -1.030000 -0.760000 2
104 | -1.350000 -0.780000 2
105 | -0.770000 0.500000 2
106 | -0.670000 -0.640000 2
107 | -1.780000 0.330000 2
108 | -0.180000 0.460000 2
109 | -1.110000 0.330000 2
110 | -0.690000 0.640000 2
111 | -0.160000 -0.010000 2
112 | -0.510000 -0.390000 2
113 | -1.190000 0.620000 2
114 | -0.700000 -0.420000 2
115 | -0.760000 -0.400000 2
116 | -1.310000 -0.060000 2
117 | -1.010000 -0.810000 2
118 | -1.300000 0.860000 2
119 | -1.710000 -0.500000 2
120 | -0.200000 0.480000 2
121 | -0.320000 -0.420000 2
122 | -1.700000 -0.070000 2
123 | -1.630000 -0.060000 2
124 | -0.090000 0.210000 2
125 | -1.130000 -0.600000 2
126 | -1.200000 0.760000 2
127 | -0.520000 0.570000 2
128 | -1.070000 0.350000 2
129 | -1.620000 0.220000 2
130 | -1.350000 0.370000 2
131 | -1.050000 0.560000 2
132 | -0.930000 -0.560000 2
133 | -0.310000 -0.650000 2
134 | -0.640000 0.900000 2
135 | -0.920000 0.890000 2
136 | -0.290000 0.720000 2
137 | -1.610000 0.070000 2
138 | -0.180000 -0.400000 2
139 | -1.650000 -0.350000 2
140 | -0.440000 0.550000 2
141 | -1.320000 0.020000 2
142 | -0.290000 0.480000 2
143 | -0.480000 -0.370000 2
144 | -1.740000 -0.330000 2
145 | -0.120000 -0.390000 2
146 | -1.140000 0.620000 2
147 | -1.150000 0.940000 2
148 | -1.000000 -0.370000 2
149 | -1.040000 0.630000 2
150 | -0.950000 -0.430000 2
151 | -1.230000 -0.920000 2
152 | -1.810000 0.350000 2
153 | -0.940000 0.190000 2
154 | -0.600000 -0.210000 2
155 | -0.260000 -0.220000 2
156 | -0.490000 0.600000 2
157 | -0.350000 -0.170000 2
158 | -1.020000 0.040000 2
159 | -1.690000 0.400000 2
160 | -0.570000 -0.210000 2
161 | -0.250000 -0.500000 2
162 | -1.490000 0.510000 2
163 | -0.350000 -0.800000 2
164 | -0.120000 -0.070000 2
165 | -1.050000 0.660000 2
166 | -1.650000 0.570000 2
167 | -0.740000 0.560000 2
168 | -0.170000 -0.150000 2
169 | -0.900000 -0.410000 2
170 | -1.000000 0.470000 2
171 | -0.750000 0.880000 2
172 | -0.300000 0.620000 2
173 | -1.200000 -0.410000 2
174 | -1.550000 -0.080000 2
175 | -1.730000 -0.100000 2
176 | -1.110000 0.520000 2
177 | -0.240000 0.700000 2
178 | -1.130000 0.350000 2
179 | -1.580000 -0.620000 2
180 | -1.280000 -0.150000 2
181 | -1.160000 0.870000 2
182 | -0.290000 0.340000 2
183 | -1.610000 -0.060000 2
184 | -0.700000 -0.070000 2
185 | -1.210000 -0.720000 2
186 | -1.440000 0.260000 2
187 | -1.760000 -0.180000 2
188 | -1.600000 -0.500000 2
189 | -1.650000 -0.230000 2
190 | -1.710000 0.370000 2
191 | -1.110000 -0.340000 2
192 | -0.240000 0.390000 2
193 | -0.760000 0.930000 2
194 | -0.810000 0.220000 2
195 | -1.640000 0.150000 2
196 | -1.660000 0.060000 2
197 | -1.330000 0.280000 2
198 | -0.050000 0.170000 2
199 | -1.140000 0.070000 2
200 | -1.740000 -0.240000 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2Hcircle1.txt:
--------------------------------------------------------------------------------
1 | 1.000000 0.000000 1
2 | 0.996917 0.078459 1
3 | 0.987688 0.156434 1
4 | 0.972370 0.233445 1
5 | 0.951057 0.309017 1
6 | 0.923880 0.382683 1
7 | 0.891007 0.453991 1
8 | 0.852640 0.522499 1
9 | 0.809017 0.587785 1
10 | 0.760406 0.649448 1
11 | 0.707107 0.707107 1
12 | 0.649448 0.760406 1
13 | 0.587785 0.809017 1
14 | 0.522499 0.852640 1
15 | 0.453991 0.891006 1
16 | 0.382684 0.923880 1
17 | 0.309017 0.951056 1
18 | 0.233445 0.972370 1
19 | 0.156434 0.987688 1
20 | 0.078459 0.996917 1
21 | 0.000001 -1.000000 1
22 | 0.078460 -0.996917 1
23 | 0.156435 -0.987688 1
24 | 0.233446 -0.972370 1
25 | 0.309018 -0.951056 1
26 | 0.382684 -0.923879 1
27 | 0.453992 -0.891006 1
28 | 0.522500 -0.852640 1
29 | 0.587786 -0.809016 1
30 | 0.649449 -0.760405 1
31 | 0.707108 -0.707106 1
32 | 0.760407 -0.649447 1
33 | 0.809018 -0.587784 1
34 | 0.852641 -0.522497 1
35 | 0.891007 -0.453989 1
36 | 0.923880 -0.382682 1
37 | 0.951057 -0.309016 1
38 | 0.972370 -0.233444 1
39 | 0.987689 -0.156433 1
40 | 0.996917 -0.078458 1
41 | 0.200000 1.800000 2
42 | 0.198458 1.878520 2
43 | 0.193835 1.956918 2
44 | 0.186137 2.035075 2
45 | 0.175377 2.112869 2
46 | 0.161571 2.190181 2
47 | 0.144740 2.266891 2
48 | 0.124910 2.342881 2
49 | 0.102113 2.418034 2
50 | 0.076383 2.492234 2
51 | 0.047759 2.565367 2
52 | 0.016286 2.637319 2
53 | -0.017987 2.707981 2
54 | -0.055008 2.777242 2
55 | -0.094720 2.844997 2
56 | -0.137061 2.911140 2
57 | -0.181966 2.975570 2
58 | -0.229366 3.038188 2
59 | -0.279188 3.098896 2
60 | -0.331355 3.157602 2
61 | -0.385786 3.214214 2
62 | -0.442399 3.268645 2
63 | -0.501104 3.320812 2
64 | -0.561812 3.370634 2
65 | -0.624430 3.418034 2
66 | -0.688860 3.462939 2
67 | -0.755003 3.505280 2
68 | -0.822758 3.544992 2
69 | -0.892019 3.582013 2
70 | -0.962681 3.616287 2
71 | -1.034633 3.647759 2
72 | -1.107766 3.676383 2
73 | -1.181966 3.702113 2
74 | -1.257119 3.724910 2
75 | -1.333110 3.744740 2
76 | -1.409820 3.761571 2
77 | -1.487131 3.775377 2
78 | -1.564926 3.786137 2
79 | -1.643082 3.793835 2
80 | -1.721481 3.798458 2
81 | -1.800001 3.800000 2
82 | -1.878520 3.798458 2
83 | -1.956919 3.793835 2
84 | -2.035075 3.786137 2
85 | -2.112870 3.775377 2
86 | -2.190181 3.761570 2
87 | -2.266891 3.744740 2
88 | -2.342882 3.724910 2
89 | -2.418035 3.702113 2
90 | -2.492235 3.676382 2
91 | -2.565368 3.647759 2
92 | -2.637320 3.616286 2
93 | -2.707982 3.582013 2
94 | -2.777243 3.544992 2
95 | -2.844998 3.505280 2
96 | -2.911141 3.462939 2
97 | -2.975571 3.418034 2
98 | -3.038189 3.370633 2
99 | -3.098897 3.320811 2
100 | -3.157602 3.268644 2
101 | -3.214214 3.214213 2
102 | -3.268646 3.157601 2
103 | -3.320813 3.098895 2
104 | -3.370635 3.038187 2
105 | -3.418035 2.975570 2
106 | -3.462940 2.911139 2
107 | -3.505281 2.844996 2
108 | -3.544993 2.777241 2
109 | -3.582014 2.707980 2
110 | -3.616287 2.637318 2
111 | -3.647760 2.565366 2
112 | -3.676383 2.492233 2
113 | -3.702113 2.418033 2
114 | -3.724911 2.342880 2
115 | -3.744740 2.266889 2
116 | -3.761571 2.190179 2
117 | -3.775377 2.112867 2
118 | -3.786137 2.035073 2
119 | -3.793835 1.956917 2
120 | -3.798458 1.878518 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2cring.txt:
--------------------------------------------------------------------------------
1 | -1.767 -4.985 1
2 | 0.662 -5.499 1
3 | 4.015 4.213 1
4 | -4.956 -1.143 1
5 | 5.769 0.860 1
6 | 4.845 3.155 1
7 | 5.843 -1.144 1
8 | -4.909 1.237 1
9 | -4.400 2.833 1
10 | -1.262 -5.260 1
11 | -0.579 5.380 1
12 | -4.166 3.155 1
13 | -4.207 2.833 1
14 | 3.369 4.613 1
15 | -4.547 2.582 1
16 | 5.688 1.608 1
17 | 2.531 5.063 1
18 | 1.069 5.470 1
19 | 0.239 -5.492 1
20 | -2.758 4.393 1
21 | 4.407 3.680 1
22 | -3.810 3.310 1
23 | 5.586 -2.149 1
24 | 2.491 5.100 1
25 | 0.808 -5.487 1
26 | 0.563 5.499 1
27 | 5.484 2.411 1
28 | -1.513 5.135 1
29 | 6.006 0.860 1
30 | 1.737 -5.313 1
31 | -5.167 -0.479 1
32 | 0.761 5.497 1
33 | -4.861 -0.670 1
34 | -4.012 -3.076 1
35 | -1.724 -5.100 1
36 | 4.837 3.310 1
37 | -3.472 -3.956 1
38 | 0.723 -5.497 1
39 | 5.944 0.860 1
40 | -1.244 -5.200 1
41 | -0.784 -5.337 1
42 | -4.490 -2.582 1
43 | 3.349 -4.664 1
44 | 4.257 3.956 1
45 | -4.716 1.516 1
46 | 4.914 3.386 1
47 | -1.368 -5.168 1
48 | 5.198 -2.582 1
49 | 4.402 3.821 1
50 | -1.726 5.025 1
51 | 2.841 -4.901 1
52 | 3.067 4.856 1
53 | 1.378 -5.399 1
54 | 5.233 -2.582 1
55 | 1.593 5.359 1
56 | 2.345 -5.200 1
57 | 5.609 -2.237 1
58 | 5.943 0.000 1
59 | 3.766 -4.450 1
60 | 5.832 -0.384 1
61 | 4.754 -3.535 1
62 | 5.544 2.237 1
63 | 5.509 1.881 1
64 | -2.316 4.714 1
65 | 2.841 4.901 1
66 | 5.939 -1.144 1
67 | 5.841 -0.860 1
68 | -1.618 -5.135 1
69 | -4.941 -1.237 1
70 | 5.923 -0.765 1
71 | -1.466 5.168 1
72 | 5.832 -1.237 1
73 | -4.462 2.324 1
74 | 1.895 -5.337 1
75 | -3.377 -3.821 1
76 | 3.272 4.763 1
77 | 5.327 -2.497 1
78 | 3.622 -4.505 1
79 | 1.364 -5.416 1
80 | 4.807 -3.155 1
81 | 5.119 -3.076 1
82 | 5.449 2.411 1
83 | -3.624 3.608 1
84 | -2.447 4.714 1
85 | 5.833 0.288 1
86 | 4.123 4.151 1
87 | -4.680 2.060 1
88 | -0.023 5.487 1
89 | 5.807 -1.331 1
90 | 3.427 4.714 1
91 | 1.361 5.432 1
92 | 5.421 2.060 1
93 | 4.854 3.233 1
94 | -2.344 -4.664 1
95 | -5.007 1.331 1
96 | 5.378 2.666 1
97 | 5.662 -2.149 1
98 | 5.268 -2.833 1
99 | 5.175 2.750 1
100 | -2.002 4.943 1
101 | 5.062 -2.915 1
102 | -2.572 -4.560 1
103 | -2.161 4.856 1
104 | 1.516 5.399 1
105 | -3.855 3.386 1
106 | 5.986 0.860 1
107 | 0.344 -5.499 1
108 | 4.868 -3.233 1
109 | 5.771 1.331 1
110 | -0.561 -5.380 1
111 | -4.388 -2.666 1
112 | 3.819 4.392 1
113 | 0.194 -5.487 1
114 | -4.994 -0.096 1
115 | 0.336 5.500 1
116 | 1.512 5.399 1
117 | 0.004 -5.479 1
118 | -2.613 -4.613 1
119 | -1.145 -5.287 1
120 | -2.722 -4.505 1
121 | 4.199 4.087 1
122 | 4.744 -3.310 1
123 | -4.358 -2.411 1
124 | 1.241 -5.459 1
125 | 6.026 0.479 1
126 | 4.317 3.889 1
127 | -0.938 -5.337 1
128 | 1.242 5.446 1
129 | 5.102 -2.750 1
130 | -4.165 2.915 1
131 | -2.330 -4.664 1
132 | 1.397 -5.432 1
133 | -1.488 5.168 1
134 | 4.488 3.751 1
135 | -1.723 -5.063 1
136 | -3.636 -3.751 1
137 | -2.361 4.664 1
138 | 4.573 -3.680 1
139 | 4.939 -3.233 1
140 | -3.271 4.022 1
141 | -0.228 5.459 1
142 | -3.831 -3.310 1
143 | 5.394 2.666 1
144 | 5.809 1.049 1
145 | -2.824 -4.334 1
146 | -3.341 -4.022 1
147 | 5.795 -1.791 1
148 | 5.205 -2.833 1
149 | 4.455 3.608 1
150 | -3.942 -3.386 1
151 | 3.975 4.213 1
152 | 0.665 5.499 1
153 | -4.879 -1.423 1
154 | -2.257 4.763 1
155 | 5.411 -2.149 1
156 | 5.949 0.096 1
157 | -2.550 4.613 1
158 | -4.956 -1.608 1
159 | 2.949 -4.901 1
160 | 1.564 -5.380 1
161 | 5.832 1.516 1
162 | -5.045 0.479 1
163 | 5.870 0.575 1
164 | -5.019 -0.479 1
165 | -2.776 -4.450 1
166 | 1.619 5.399 1
167 | 5.794 1.608 1
168 | -3.843 -3.535 1
169 | 1.847 -5.313 1
170 | 5.989 -1.049 1
171 | -3.849 3.386 1
172 | -2.719 4.393 1
173 | -5.016 -0.096 1
174 | 1.914 -5.287 1
175 | -3.991 3.386 1
176 | 4.708 3.461 1
177 | -5.167 -0.479 1
178 | -4.665 2.237 1
179 | -4.916 0.000 1
180 | -0.674 5.399 1
181 | 1.766 -5.337 1
182 | -5.181 -0.192 1
183 | 5.839 -1.049 1
184 | -4.155 -3.155 1
185 | 3.325 4.613 1
186 | -5.008 -1.331 1
187 | 3.698 -4.393 1
188 | -4.038 2.996 1
189 | 5.289 2.750 1
190 | -4.946 0.384 1
191 | 5.508 -2.060 1
192 | 4.888 -3.155 1
193 | 4.420 3.821 1
194 | 5.720 1.516 1
195 | 6.011 0.670 1
196 | -0.515 -5.399 1
197 | 3.086 4.856 1
198 | 0.700 5.487 1
199 | 0.744 5.487 1
200 | 1.829 -5.313 1
201 | -15.358 4.390 2
202 | -11.168 3.501 2
203 | -5.314 20.277 2
204 | -20.768 11.025 2
205 | -2.180 14.486 2
206 | -3.778 18.449 2
207 | -2.145 11.025 2
208 | -20.707 15.137 2
209 | -19.729 17.893 2
210 | -14.332 3.915 2
211 | -13.310 22.292 2
212 | -19.343 18.449 2
213 | -19.536 17.893 2
214 | -6.353 20.967 2
215 | -19.979 17.460 2
216 | -2.387 15.778 2
217 | -7.806 21.745 2
218 | -10.413 22.448 2
219 | -11.870 3.513 2
220 | -17.065 20.587 2
221 | -4.520 19.357 2
222 | -18.905 18.717 2
223 | -2.632 9.288 2
224 | -7.910 21.808 2
225 | -10.813 3.523 2
226 | -11.267 22.499 2
227 | -2.820 17.165 2
228 | -14.846 21.869 2
229 | -1.943 14.486 2
230 | -9.127 3.824 2
231 | -21.052 12.172 2
232 | -10.999 22.494 2
233 | -20.731 11.842 2
234 | -19.228 7.688 2
235 | -15.123 4.192 2
236 | -3.868 18.717 2
237 | -18.150 6.166 2
238 | -11.037 3.506 2
239 | -2.005 14.486 2
240 | -14.446 4.018 2
241 | -13.651 3.782 2
242 | -19.922 8.540 2
243 | -6.432 4.944 2
244 | -4.865 19.834 2
245 | -20.461 15.619 2
246 | -3.834 18.849 2
247 | -14.636 4.073 2
248 | -3.170 8.540 2
249 | -4.620 19.599 2
250 | -15.253 21.679 2
251 | -7.243 4.535 2
252 | -6.955 21.388 2
253 | -9.758 3.675 2
254 | -3.135 8.540 2
255 | -9.407 22.257 2
256 | -8.253 4.018 2
257 | -2.636 9.136 2
258 | -1.957 13.000 2
259 | -5.783 5.314 2
260 | -2.078 12.337 2
261 | -4.082 6.893 2
262 | -2.702 16.864 2
263 | -2.632 16.249 2
264 | -16.276 21.143 2
265 | -7.243 21.465 2
266 | -2.049 11.025 2
267 | -2.108 11.514 2
268 | -14.952 4.131 2
269 | -20.739 10.863 2
270 | -2.015 11.678 2
271 | -14.734 21.927 2
272 | -2.170 10.863 2
273 | -19.987 17.015 2
274 | -9.038 3.782 2
275 | -18.155 6.401 2
276 | -6.628 21.227 2
277 | -3.009 8.687 2
278 | -5.984 5.218 2
279 | -9.841 3.644 2
280 | -3.816 7.551 2
281 | -3.465 7.688 2
282 | -2.855 17.165 2
283 | -18.543 19.233 2
284 | -16.407 21.143 2
285 | -2.072 13.497 2
286 | -5.152 20.170 2
287 | -20.288 16.559 2
288 | -12.202 22.477 2
289 | -2.212 10.702 2
290 | -6.413 21.143 2
291 | -9.913 22.383 2
292 | -2.771 16.559 2
293 | -3.810 18.584 2
294 | -16.363 4.944 2
295 | -20.788 15.298 2
296 | -3.023 17.606 2
297 | -2.556 9.288 2
298 | -3.203 8.107 2
299 | -3.261 17.750 2
300 | -15.656 21.539 2
301 | -3.446 7.966 2
302 | -16.708 5.124 2
303 | -15.939 21.388 2
304 | -9.620 22.325 2
305 | -18.907 18.849 2
306 | -1.963 14.486 2
307 | -11.626 3.501 2
308 | -3.796 7.416 2
309 | -2.248 15.298 2
310 | -13.292 3.708 2
311 | -19.787 8.394 2
312 | -5.674 20.587 2
313 | -11.985 3.523 2
314 | -20.894 12.834 2
315 | -11.564 22.500 2
316 | -9.624 22.325 2
317 | -12.245 3.536 2
318 | -16.691 5.033 2
319 | -14.148 3.868 2
320 | -16.916 5.218 2
321 | -5.024 20.060 2
322 | -3.961 7.283 2
323 | -19.854 8.835 2
324 | -10.171 3.571 2
325 | -1.889 13.828 2
326 | -4.754 19.718 2
327 | -13.805 3.782 2
328 | -10.101 22.408 2
329 | -3.334 8.250 2
330 | -19.457 18.034 2
331 | -16.349 4.944 2
332 | -9.877 3.617 2
333 | -14.756 21.927 2
334 | -4.486 19.479 2
335 | -15.186 4.255 2
336 | -18.462 6.521 2
337 | -16.380 21.056 2
338 | -4.354 6.643 2
339 | -3.725 7.416 2
340 | -17.899 19.948 2
341 | -12.616 22.429 2
342 | -18.925 7.283 2
343 | -3.007 17.606 2
344 | -2.165 14.813 2
345 | -17.187 5.514 2
346 | -17.969 6.052 2
347 | -2.323 9.907 2
348 | -3.266 8.107 2
349 | -4.426 19.233 2
350 | -18.994 7.151 2
351 | -5.354 20.277 2
352 | -11.165 22.499 2
353 | -20.642 10.541 2
354 | -16.157 21.227 2
355 | -2.807 9.288 2
356 | -1.951 13.166 2
357 | -16.628 20.967 2
358 | -20.681 10.222 2
359 | -7.135 4.535 2
360 | -9.504 3.708 2
361 | -2.223 15.619 2
362 | -20.930 13.828 2
363 | -2.052 13.993 2
364 | -20.904 12.172 2
365 | -17.027 5.314 2
366 | -9.517 22.325 2
367 | -2.281 15.778 2
368 | -18.807 6.894 2
369 | -9.017 3.824 2
370 | -1.985 11.187 2
371 | -18.901 18.849 2
372 | -17.026 20.587 2
373 | -20.916 12.834 2
374 | -8.883 3.868 2
375 | -19.043 18.849 2
376 | -4.083 18.979 2
377 | -21.052 12.172 2
378 | -20.220 16.864 2
379 | -20.816 13.000 2
380 | -13.338 22.325 2
381 | -9.167 3.782 2
382 | -21.078 12.668 2
383 | -2.135 11.187 2
384 | -19.332 7.551 2
385 | -6.397 20.967 2
386 | -20.789 10.702 2
387 | -5.795 5.413 2
388 | -19.292 18.174 2
389 | -3.147 17.750 2
390 | -20.836 13.663 2
391 | -2.684 9.441 2
392 | -3.735 7.551 2
393 | -4.602 19.599 2
394 | -2.335 15.619 2
395 | -1.919 14.158 2
396 | -13.179 3.675 2
397 | -6.936 21.388 2
398 | -10.921 22.477 2
399 | -10.877 22.477 2
400 | -9.035 3.824 2
401 |
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/2ring.txt:
--------------------------------------------------------------------------------
1 | 0.695 0.976 1
2 | -2.218 -0.875 1
3 | -0.330 -0.956 1
4 | -1.800 0.904 1
5 | 3.077 -0.626 1
6 | 1.089 0.923 1
7 | -1.045 0.929 1
8 | -2.244 -0.845 1
9 | -3.208 -0.547 1
10 | -0.125 -1.046 1
11 | 3.825 -0.333 1
12 | -2.020 -0.841 1
13 | -3.547 -0.466 1
14 | -1.981 0.851 1
15 | -2.172 -0.856 1
16 | -3.674 0.381 1
17 | 2.986 -0.616 1
18 | -0.163 1.038 1
19 | 0.195 -1.039 1
20 | 1.644 0.954 1
21 | 3.248 -0.579 1
22 | -2.737 0.739 1
23 | 2.257 -0.866 1
24 | -0.230 0.952 1
25 | -3.798 0.278 1
26 | -2.764 -0.772 1
27 | -3.977 -0.075 1
28 | -3.517 -0.468 1
29 | 0.034 -1.012 1
30 | -0.526 -1.019 1
31 | 2.892 -0.734 1
32 | -0.964 -0.965 1
33 | 0.694 0.992 1
34 | -1.617 -0.914 1
35 | 2.583 -0.787 1
36 | -0.339 1.003 1
37 | 0.286 -1.013 1
38 | 1.928 -0.859 1
39 | -3.149 -0.635 1
40 | 2.276 0.850 1
41 | -2.062 0.887 1
42 | 1.156 -0.988 1
43 | 3.315 0.596 1
44 | -2.963 -0.702 1
45 | 2.473 -0.740 1
46 | 2.309 0.855 1
47 | 2.440 0.838 1
48 | 0.991 -0.999 1
49 | 0.932 0.929 1
50 | 3.392 0.533 1
51 | -1.951 -0.879 1
52 | 0.311 1.030 1
53 | 0.555 -0.987 1
54 | -3.216 0.587 1
55 | 1.042 -0.952 1
56 | 0.170 0.955 1
57 | -2.185 -0.877 1
58 | -2.235 0.791 1
59 | -3.913 -0.246 1
60 | -2.890 -0.738 1
61 | -2.958 -0.682 1
62 | 1.506 -0.894 1
63 | -2.598 -0.803 1
64 | 3.706 0.381 1
65 | 3.131 -0.608 1
66 | -2.105 -0.861 1
67 | 2.323 0.780 1
68 | 0.327 -0.956 1
69 | 3.374 0.534 1
70 | 3.980 -0.122 1
71 | -0.593 -0.954 1
72 | 1.975 -0.917 1
73 | -0.669 0.952 1
74 | 2.191 0.800 1
75 | 1.748 0.852 1
76 | -0.836 -1.004 1
77 | -3.594 0.393 1
78 | 1.198 -0.939 1
79 | -2.205 0.848 1
80 | -0.581 -1.025 1
81 | 0.070 1.014 1
82 | 1.848 0.921 1
83 | -1.634 -0.948 1
84 | -0.101 -1.035 1
85 | 1.281 0.941 1
86 | 1.057 -0.959 1
87 | 2.892 0.654 1
88 | -1.512 0.960 1
89 | -3.936 0.221 1
90 | 3.957 -0.140 1
91 | 3.290 -0.521 1
92 | -1.956 0.911 1
93 | 1.646 -0.861 1
94 | 3.918 -0.213 1
95 | 1.284 -0.924 1
96 | -0.432 1.042 1
97 | 3.342 0.596 1
98 | -2.615 -0.709 1
99 | 1.843 -0.868 1
100 | -1.618 0.892 1
101 | -0.195 -1.005 1
102 | 3.125 0.620 1
103 | -0.791 -1.024 1
104 | -0.742 0.989 1
105 | -0.235 -1.006 1
106 | -0.692 1.010 1
107 | 0.155 0.950 1
108 | 2.547 0.746 1
109 | 2.963 -0.652 1
110 | -2.457 -0.765 1
111 | 1.117 -0.968 1
112 | 3.428 -0.479 1
113 | 0.539 -0.941 1
114 | -1.939 0.894 1
115 | -3.388 0.516 1
116 | -3.521 0.450 1
117 | -2.886 -0.716 1
118 | -2.356 0.776 1
119 | 1.095 -0.925 1
120 | 0.139 -0.999 1
121 | 2.156 0.822 1
122 | -0.149 -0.988 1
123 | 2.023 -0.884 1
124 | 3.741 0.362 1
125 | 3.934 -0.143 1
126 | -1.762 0.922 1
127 | 0.848 1.022 1
128 | -2.331 -0.857 1
129 | -1.738 -0.897 1
130 | 3.034 -0.634 1
131 | -1.344 0.931 1
132 | -3.446 -0.487 1
133 | 3.026 -0.696 1
134 | -3.093 0.648 1
135 | -1.753 0.946 1
136 | -0.840 1.011 1
137 | -1.907 0.925 1
138 | -2.972 -0.688 1
139 | -2.481 -0.815 1
140 | 0.376 -0.986 1
141 | 2.377 0.839 1
142 | 0.471 0.955 1
143 | -1.730 0.875 1
144 | -1.472 -0.896 1
145 | -3.927 -0.231 1
146 | 0.774 -0.937 1
147 | -1.191 0.935 1
148 | 0.204 -0.994 1
149 | -2.275 -0.776 1
150 | -2.088 0.808 1
151 | -2.421 -0.804 1
152 | 2.541 -0.797 1
153 | 3.363 0.571 1
154 | -1.393 0.907 1
155 | 1.702 0.934 1
156 | -2.336 0.822 1
157 | 3.211 0.560 1
158 | 3.960 0.148 1
159 | -2.488 -0.783 1
160 | -1.246 -0.924 1
161 | 1.660 -0.885 1
162 | 0.612 0.996 1
163 | -3.007 -0.649 1
164 | 2.882 0.648 1
165 | 3.701 0.349 1
166 | -2.089 0.844 1
167 | -1.613 -0.901 1
168 | -3.592 -0.415 1
169 | 2.774 -0.737 1
170 | 1.918 -0.836 1
171 | -2.310 0.840 1
172 | 1.460 0.892 1
173 | -2.209 -0.823 1
174 | -0.154 -0.991 1
175 | 1.294 0.950 1
176 | -2.376 0.759 1
177 | 3.704 -0.380 1
178 | -0.917 -0.934 1
179 | 2.471 -0.774 1
180 | 1.002 -1.006 1
181 | 0.229 2.295 2
182 | -0.107 7.382 2
183 | -0.315 3.270 2
184 | 0.106 1.800 2
185 | -0.244 2.677 2
186 | 0.225 6.689 2
187 | 0.233 2.555 2
188 | -0.140 7.356 2
189 | -0.251 2.392 2
190 | -0.288 3.475 2
191 | -0.292 3.425 2
192 | -0.312 5.580 2
193 | -0.349 4.053 2
194 | 0.044 1.619 2
195 | -0.316 3.428 2
196 | 0.336 3.926 2
197 | -0.357 4.586 2
198 | 0.334 5.437 2
199 | -0.291 5.795 2
200 | 0.174 7.244 2
201 | -0.251 2.848 2
202 | 0.257 2.863 2
203 | -0.120 1.857 2
204 | 0.301 5.370 2
205 | 0.310 3.802 2
206 | -0.308 4.836 2
207 | -0.322 3.623 2
208 | -0.311 4.083 2
209 | -0.329 3.634 2
210 | -0.326 5.074 2
211 | -0.241 6.492 2
212 | -0.314 4.636 2
213 | 0.195 2.294 2
214 | -0.302 3.983 2
215 | -0.332 4.183 2
216 | 0.307 5.261 2
217 | -0.333 3.886 2
218 | -0.065 7.528 2
219 | -0.269 6.451 2
220 | 0.143 1.876 2
221 | 0.072 7.538 2
222 | -0.226 6.756 2
223 | 0.342 4.915 2
224 | -0.328 4.637 2
225 | -0.349 4.073 2
226 | 0.337 3.909 2
227 | 0.313 6.040 2
228 | -0.328 4.591 2
229 | 0.237 6.532 2
230 | 0.308 4.992 2
231 | -0.335 3.649 2
232 | 0.308 5.911 2
233 | -0.263 6.155 2
234 | 0.285 6.384 2
235 | -0.241 2.642 2
236 | 0.288 5.770 2
237 | -0.101 7.415 2
238 | 0.291 3.365 2
239 | -0.304 3.687 2
240 | -0.237 2.710 2
241 | -0.349 4.642 2
242 | -0.190 7.106 2
243 | -0.182 7.002 2
244 | 0.281 3.306 2
245 | -0.224 6.731 2
246 | -0.101 7.495 2
247 | 0.290 5.923 2
248 | -0.315 5.927 2
249 | 0.302 2.974 2
250 | -0.316 3.580 2
251 | -0.292 3.007 2
252 | -0.021 7.575 2
253 | 0.201 6.931 2
254 | 0.294 5.791 2
255 | 0.112 7.348 2
256 | -0.332 4.764 2
257 | 0.306 4.006 2
258 | -0.323 4.798 2
259 | 0.294 3.395 2
260 | -0.272 3.019 2
261 | 0.300 5.670 2
262 | 0.329 5.448 2
263 | -0.287 5.966 2
264 | -0.308 5.499 2
265 | 0.236 6.881 2
266 | -0.223 6.657 2
267 | 0.225 2.492 2
268 | 0.337 4.088 2
269 | 0.086 1.664 2
270 | -0.294 3.557 2
271 | -0.297 2.890 2
272 | 0.071 1.644 2
273 | -0.351 5.246 2
274 | -0.324 3.518 2
275 | -0.214 6.884 2
276 | 0.350 5.168 2
277 | 0.230 6.942 2
278 | -0.354 4.985 2
279 | -0.303 3.443 2
280 | 0.165 1.982 2
281 | -0.325 3.405 2
282 | 0.281 2.725 2
283 | -0.248 2.809 2
284 | 0.200 6.858 2
285 | -0.146 7.365 2
286 | 0.332 4.908 2
287 | 0.284 5.755 2
288 | 0.286 6.147 2
289 | -0.247 6.563 2
290 | -0.327 5.143 2
291 | -0.350 4.717 2
292 | -0.341 5.028 2
293 | -0.311 6.139 2
294 | 0.306 5.661 2
295 | 0.211 2.212 2
296 | 0.181 2.079 2
297 | -0.260 2.714 2
298 | 0.319 5.244 2
299 | -0.270 2.695 2
300 | -0.125 1.739 2
301 |
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/579.txt:
--------------------------------------------------------------------------------
1 | 4.489013 3.949385 1
2 | 3.234519 3.032182 1
3 | 2.339381 3.233512 1
4 | 3.067888 3.272515 1
5 | 3.337977 3.214286 1
6 | 1.623692 1.968673 1
7 | 4.459075 3.803079 1
8 | 2.746071 2.881115 1
9 | 3.022935 3.244224 1
10 | 2.634098 2.410794 1
11 | 2.209555 2.269341 1
12 | 2.938520 4.243461 1
13 | 3.307581 3.077136 1
14 | 4.325037 3.338618 1
15 | 2.868755 2.639683 1
16 | 2.849528 2.990066 1
17 | 3.360591 3.146077 1
18 | 1.935163 2.120289 1
19 | 3.001328 3.005997 1
20 | 2.815287 2.893017 1
21 | 1.970595 2.479919 1
22 | 3.990677 3.728278 1
23 | 3.402707 3.298334 1
24 | 3.945814 2.965621 1
25 | 2.735176 2.449980 1
26 | 3.608432 3.170064 1
27 | 3.252739 3.002152 1
28 | 2.484497 3.060198 1
29 | 3.994705 3.673803 1
30 | 2.799814 2.734718 1
31 | 2.907117 2.647374 1
32 | 3.115223 4.262139 1
33 | 2.973952 2.696356 1
34 | 3.986648 3.551485 1
35 | 3.326075 3.389431 1
36 | 1.859722 1.628361 1
37 | 2.762185 2.475341 1
38 | 2.888989 3.010208 1
39 | 2.817301 3.156148 1
40 | 3.017533 2.841655 1
41 | 3.685522 3.447386 1
42 | 3.414609 3.078967 1
43 | 2.412534 2.670171 1
44 | 3.551576 3.318201 1
45 | 3.119800 3.169698 1
46 | 3.662816 3.273339 1
47 | 1.914106 2.575411 1
48 | 2.720985 2.346248 1
49 | 3.747047 3.591311 1
50 | 4.447722 3.787515 1
51 | 2.788827 2.815561 1
52 | 3.065783 2.989334 1
53 | 3.015519 3.216941 1
54 | 2.533937 2.938429 1
55 | 2.929548 3.161733 1
56 | 3.606601 3.310785 1
57 | 3.961470 3.833018 1
58 | 3.200095 3.341090 1
59 | 3.943892 3.325709 1
60 | 2.584658 2.652593 1
61 | 3.367641 3.577944 1
62 | 2.175130 2.389279 1
63 | 3.093066 3.129780 1
64 | 2.019761 2.741035 1
65 | 4.233482 4.221580 1
66 | 2.910321 2.896588 1
67 | 1.983322 2.480926 1
68 | 3.507996 2.276940 1
69 | 3.990402 4.059343 1
70 | 1.925916 1.847545 1
71 | 3.645787 3.182974 1
72 | 4.467864 3.664098 1
73 | 3.275536 3.071001 1
74 | 4.161977 3.177847 1
75 | 3.095080 2.917920 1
76 | 4.149342 2.954726 1
77 | 3.058275 2.963149 1
78 | 3.212088 3.750984 1
79 | 2.805124 2.793954 1
80 | 4.023911 3.317652 1
81 | 1.784738 2.587313 1
82 | 2.851543 2.983566 1
83 | 3.440977 3.477416 1
84 | 3.884014 3.279107 1
85 | 2.566988 1.667821 1
86 | 3.631870 3.683508 1
87 | 4.088458 3.490051 1
88 | 3.419828 3.199820 1
89 | 1.620579 2.594363 1
90 | 2.707251 2.447600 1
91 | 3.235984 3.104053 1
92 | 3.289636 3.267296 1
93 | 2.412900 2.971023 1
94 | 3.734321 3.365169 1
95 | 3.032090 3.086383 1
96 | 3.335414 2.976608 1
97 | 3.027696 2.906568 1
98 | 4.230003 3.549654 1
99 | 2.794412 2.961592 1
100 | 2.394681 2.819956 1
101 | 3.058641 2.859142 1
102 | 4.406613 3.409665 1
103 | 2.688025 2.837901 1
104 | 3.278008 2.598025 1
105 | 3.077044 3.235527 1
106 | 2.397153 2.696722 1
107 | 3.551210 3.163015 1
108 | 4.190451 3.168416 1
109 | 3.975661 3.483825 1
110 | 2.232810 2.231712 1
111 | 3.067614 2.632267 1
112 | 4.437742 3.717017 1
113 | 3.957350 3.623539 1
114 | 1.619938 2.306330 1
115 | 2.358333 2.488342 1
116 | 2.216697 3.003250 1
117 | 1.918134 2.094745 1
118 | 4.448454 3.367367 1
119 | 4.092486 3.572451 1
120 | 3.174734 3.003067 1
121 | 2.684088 3.011216 1
122 | 2.024979 1.756264 1
123 | 3.234336 3.186087 1
124 | 2.188406 3.151204 1
125 | 3.201285 3.398129 1
126 | 3.079424 3.077868 1
127 | 3.771584 3.194418 1
128 | 3.158528 4.194937 1
129 | 3.240745 2.722175 1
130 | 3.004074 2.656713 1
131 | 4.359004 3.983718 1
132 | 3.045457 3.725257 1
133 | 3.311518 3.196341 1
134 | 3.102863 3.114399 1
135 | 2.704230 2.827280 1
136 | 2.041917 2.068468 1
137 | 3.529603 3.167592 1
138 | 1.794351 2.203787 1
139 | 3.494263 3.562563 1
140 | 4.082690 3.480621 1
141 | 2.457213 3.019456 1
142 | 3.813425 3.711249 1
143 | 3.066973 3.531343 1
144 | 2.773629 2.889630 1
145 | 2.249748 2.807321 1
146 | 3.618595 3.175283 1
147 | 2.797983 2.840190 1
148 | 1.904126 3.045457 1
149 | 3.362239 2.910504 1
150 | 2.943556 2.240318 1
151 | 2.555361 2.811625 1
152 | 3.765175 3.232414 1
153 | 2.491638 2.394314 1
154 | 3.685614 2.645451 1
155 | 3.340632 3.259880 1
156 | 1.918226 2.746071 1
157 | 2.996475 3.052416 1
158 | 2.523499 3.386685 1
159 | 3.628666 3.390255 1
160 | 4.116474 3.218497 1
161 | 2.613132 2.772439 1
162 | 3.207785 3.330836 1
163 | 2.992813 3.088488 1
164 | 3.233055 3.377255 1
165 | 1.767800 2.044023 1
166 | 2.996384 3.115223 1
167 | 3.601840 2.843760 1
168 | 3.942701 3.336421 1
169 | 3.245048 3.634434 1
170 | 2.772988 3.315912 1
171 | 4.425474 3.311792 1
172 | 3.493622 3.076952 1
173 | 3.586550 3.219779 1
174 | 3.369289 3.120167 1
175 | 3.822855 3.334498 1
176 | 2.712561 2.337275 1
177 | 3.655492 3.177847 1
178 | 2.587588 2.708991 1
179 | 3.208426 3.031816 1
180 | 3.306482 3.462127 1
181 | 3.516236 3.213370 1
182 | 2.438810 2.723365 1
183 | 3.334407 3.013596 1
184 | 4.029862 3.311426 1
185 | 3.439787 3.152211 1
186 | 3.083178 3.240837 1
187 | 2.100421 1.732002 1
188 | 3.254204 3.328455 1
189 | 2.785348 3.730201 1
190 | 4.286676 3.583987 1
191 | 1.889660 2.654149 1
192 | 2.709815 2.390561 1
193 | 2.923139 2.828928 1
194 | 2.654332 2.930189 1
195 | 2.894391 2.502533 1
196 | 3.320032 3.080798 1
197 | 2.326014 2.402280 1
198 | 1.332209 0.848247 2
199 | 0.332606 1.522279 2
200 | 1.871746 0.571383 2
201 | 0.207541 1.269402 2
202 | 1.274987 0.755776 2
203 | -0.315058 1.648808 2
204 | 0.344783 0.985763 2
205 | 1.361049 0.866649 2
206 | 2.266167 0.112964 2
207 | 1.621342 0.739845 2
208 | 1.357845 0.763741 2
209 | 0.229057 1.541688 2
210 | 0.090167 2.268548 2
211 | 0.854747 0.964064 2
212 | 1.111011 0.955916 2
213 | 0.646733 1.228477 2
214 | 0.478088 1.719123 2
215 | 2.260125 0.195547 2
216 | 1.244407 0.994827 2
217 | 0.884320 1.153676 2
218 | 1.209342 0.657262 2
219 | 1.785043 0.957106 2
220 | 0.503357 1.339991 2
221 | 0.797342 1.069720 2
222 | -0.031785 1.403989 2
223 | 1.447295 0.832316 2
224 | 0.872784 1.564486 2
225 | 0.167989 1.615665 2
226 | 2.123798 1.055895 2
227 | 0.881756 1.013138 2
228 | 1.551759 0.457488 2
229 | 1.230125 0.906842 2
230 | 0.793588 0.533113 2
231 | 1.406369 0.729133 2
232 | 1.399228 1.232414 2
233 | 0.842662 1.141316 2
234 | -0.146321 1.084460 2
235 | 2.246941 0.728401 2
236 | 1.768929 0.250023 2
237 | 0.961959 0.926069 2
238 | 0.312922 1.584811 2
239 | 0.590243 1.318567 2
240 | 1.702002 0.393399 2
241 | 0.133290 0.976333 2
242 | 1.409116 0.916822 2
243 | 0.187765 1.056169 2
244 | 0.675939 0.721442 2
245 | 1.467528 0.469115 2
246 | 0.868755 0.925977 2
247 | 0.826731 1.108997 2
248 | 2.161336 0.437346 2
249 | 1.886944 0.347163 2
250 | 0.483856 1.694678 2
251 | 1.781289 0.356319 2
252 | 0.980819 0.936048 2
253 | 1.145161 0.524140 2
254 | 0.166158 1.298975 2
255 | -0.324396 1.584536 2
256 | -0.341426 1.224631 2
257 | 1.225364 1.003067 2
258 | -0.391873 1.768654 2
259 | 0.487243 1.501587 2
260 | 0.555727 0.266137 2
261 | 1.356380 0.913251 2
262 | 1.426054 0.948958 2
263 | 0.377010 1.230766 2
264 | 1.322687 0.881298 2
265 | 1.500122 1.665929 2
266 | 0.299554 1.255211 2
267 | 0.599673 1.257958 2
268 | 1.203757 1.232139 2
269 | -0.097888 1.645146 2
270 | 1.097736 1.046007 2
271 | 0.911328 1.066057 2
272 | 1.009110 0.979904 2
273 | 0.693609 0.765481 2
274 | 1.398953 1.091510 2
275 | 1.445647 1.087573 2
276 | 1.269585 1.145619 2
277 | 2.035539 -0.051561 2
278 | -0.315882 2.136799 2
279 | 1.404996 1.620792 2
280 | 0.083392 1.695502 2
281 | -0.300501 1.673162 2
282 | 1.384487 1.113392 2
283 | 0.282800 1.316553 2
284 | 0.106098 1.694678 2
285 | 0.322077 1.729560 2
286 | 1.707404 0.832774 2
287 | 1.344844 1.204581 2
288 | 0.537049 0.909223 2
289 | 2.113269 0.149220 2
290 | 0.928449 0.961592 2
291 | 1.793008 0.092730 2
292 | 0.832316 1.120258 2
293 | 0.886059 0.724006 2
294 | 0.660100 0.851817 2
295 | 0.420316 1.373867 2
296 | 0.638127 1.330836 2
297 | 1.000961 0.957747 2
298 | 0.699927 1.211447 2
299 | 0.949599 0.947493 2
300 | 1.890973 0.519196 2
301 | 1.723426 0.720435 2
302 | 1.515870 1.256035 2
303 | 1.186544 1.440428 2
304 | 0.507019 1.176748 2
305 | 0.225944 1.425779 2
306 | 1.159719 1.032456 2
307 | 1.120533 0.497131 2
308 | 0.635289 1.041520 2
309 | 1.659612 0.721809 2
310 | 0.931745 0.951613 2
311 | 0.488891 1.793649 2
312 | 0.992538 0.840556 2
313 | -0.456511 1.874676 2
314 | 0.868572 0.742409 2
315 | 0.929090 1.108539 2
316 | 1.931257 0.600040 2
317 | 1.494903 0.540437 2
318 | 1.755745 0.369594 2
319 | 1.141133 0.991714 2
320 | 0.834330 1.098834 2
321 | 1.517609 1.001968 2
322 | 0.964156 0.889355 2
323 | 1.650548 0.798074 2
324 | 0.784982 0.945753 2
325 | 1.296777 0.942640 2
326 | 0.968551 1.134449 2
327 | 0.866100 1.078875 2
328 | 0.989883 1.458098 2
329 | 0.128620 1.467162 2
330 | 0.668523 0.963973 2
331 | 1.142232 0.816568 2
332 | 1.325159 0.839824 2
333 | 1.322321 0.588687 2
334 | 1.317011 0.877911 2
335 | 0.956740 1.112201 2
336 | 1.279565 0.934767 2
337 | 1.107990 0.923963 2
338 | 0.078906 1.856182 2
339 | 0.726112 1.119892 2
340 | 0.396146 1.256127 2
341 | 0.209189 0.860790 2
342 | 1.167959 1.000320 2
343 | 0.165700 1.553682 2
344 | 0.695715 1.142964 2
345 | 2.241081 0.369778 2
346 | 2.200613 -0.093585 2
347 | -0.042680 1.140584 2
348 | 0.919202 0.842845 2
349 | 0.003372 1.514771 2
350 | 0.407498 0.821970 2
351 | 0.755226 1.210349 2
352 | 0.615238 1.132618 2
353 | 0.796884 1.184347 2
354 | 1.625828 0.801370 2
355 | 1.418088 0.815744 2
356 | -0.177541 2.055132 2
357 | -0.089007 1.580782 2
358 | 0.308618 0.921308 2
359 | -0.428312 2.089282 2
360 | 1.589938 0.716224 2
361 | 1.155416 1.310327 2
362 | 0.352107 1.350429 2
363 | 0.088153 1.730750 2
364 | 1.129231 0.751839 2
365 | 2.048448 0.202872 2
366 | 1.430448 0.759346 2
367 | 2.012558 -0.068682 2
368 | 1.058275 0.115894 2
369 | 0.677679 1.285607 2
370 | 1.929609 0.365474 2
371 | 0.366573 1.350063 2
372 | 2.025559 0.646733 2
373 | 1.722327 0.960768 2
374 | 1.651280 0.438627 2
375 | 1.366817 0.796793 2
376 | 1.075030 0.974319 2
377 | 2.290521 0.317774 2
378 | 0.984756 0.973678 2
379 | 0.107013 2.156850 2
380 | 0.521210 1.250175 2
381 | 0.947493 1.286615 2
382 | 0.201590 1.429441 2
383 | 1.868816 0.062059 2
384 | 0.665868 1.041154 2
385 | 1.559450 0.707068 2
386 | 0.366573 1.778634 2
387 | 1.060381 1.000320 2
388 | 1.044176 1.323969 2
389 | 1.299524 0.697089 2
390 | 1.588565 0.387906 2
391 | 0.461058 0.879101 2
392 | 0.630345 1.248436 2
393 | 1.538026 0.268700 2
394 | 2.027299 0.041917 2
395 | 1.413785 0.778665 2
396 | 1.009568 0.959944 2
397 | -0.051469 1.881542 2
398 | 0.885128 3.970916 3
399 | 0.515793 3.084201 3
400 | 0.982452 4.144597 3
401 | 0.128422 3.436140 3
402 | -0.030885 3.130161 3
403 | 0.209265 3.584185 3
404 | 0.453169 3.568438 3
405 | 0.616688 3.896664 3
406 | 0.276742 3.416913 3
407 | 0.087405 3.869930 3
408 | -0.271126 3.524674 3
409 | 0.844386 4.075198 3
410 | 0.390912 3.153325 3
411 | 0.971007 3.939055 3
412 | 1.486740 3.036866 3
413 | -0.009552 2.546770 3
414 | -0.074374 3.485946 3
415 | 0.308237 4.558061 3
416 | 0.479720 4.007172 3
417 | 0.964141 3.105716 3
418 | 0.878994 3.106906 3
419 | 0.497665 3.329203 3
420 | 0.480087 4.149724 3
421 | 0.206610 3.510575 3
422 | 1.151738 3.573565 3
423 | 0.041810 3.046205 3
424 | -0.437300 3.074496 3
425 | -0.195502 4.044252 3
426 | 0.768395 3.269051 3
427 | 1.335032 3.786157 3
428 | 0.324900 3.628132 3
429 | 0.338816 3.429365 3
430 | 0.416639 2.573504 3
431 | 0.532548 3.536485 3
432 | 0.408307 2.782891 3
433 | 0.612934 4.453139 3
434 | -0.213355 4.576281 3
435 | -0.685598 3.784326 3
436 | 1.173620 3.855739 3
437 | 0.335246 2.662496 3
438 | 0.622730 3.404187 3
439 | 1.207221 3.432844 3
440 | 0.519822 3.331584 3
441 | 0.507096 3.156346 3
442 | -0.685415 4.379803 3
443 | 0.254677 4.889859 3
444 | -0.051576 3.126133 3
445 | 1.586352 3.733512 3
446 | 1.144322 3.073489 3
447 | 1.824030 4.205390 3
448 | 0.070650 4.699057 3
449 | 0.013611 2.650410 3
450 | 1.365337 3.597186 3
451 | -0.645497 3.334971 3
452 | 0.166051 3.200842 3
453 | -0.453139 2.968017 3
454 | 1.008820 3.778558 3
455 | 0.166417 3.463973 3
456 | 0.410779 4.696951 3
457 | 0.604968 3.457472 3
458 | 0.715934 3.486221 3
459 | 0.057466 3.502335 3
460 | 0.113956 3.519547 3
461 | 1.234596 3.425703 3
462 | 0.120273 3.055086 3
463 | 0.899319 3.914151 3
464 | 0.415448 3.846950 3
465 | 0.562761 3.103702 3
466 | -0.543504 3.972198 3
467 | 0.487869 2.824000 3
468 | -0.583239 3.318125 3
469 | 0.910215 4.157231 3
470 | 0.235176 3.721793 3
471 | -0.126469 2.821894 3
472 | 1.250435 3.059481 3
473 | 0.823511 3.548570 3
474 | 1.797113 3.997833 3
475 | 0.319498 3.042543 3
476 | 0.799890 2.914457 3
477 | 0.447676 3.159459 3
478 | -0.214637 2.469314 3
479 | 0.084017 4.152745 3
480 | 0.190588 2.855861 3
481 | -0.450392 3.270608 3
482 | 1.898007 3.726096 3
483 | -0.358470 3.083651 3
484 | -0.353252 3.164586 3
485 | 0.689474 3.431013 3
486 | 0.253853 3.002716 3
487 | 0.558641 3.082369 3
488 | 0.898312 4.010743 3
489 | 0.475784 3.525681 3
490 | 0.459304 4.237709 3
491 | 1.202185 3.566240 3
492 | 0.382855 3.864620 3
493 | 0.100772 4.439222 3
494 | 0.463424 3.516526 3
495 | 0.476974 3.143345 3
496 | 1.079684 3.525132 3
497 | 0.374615 2.795892 3
498 | -0.538011 3.651753 3
499 | -0.383831 3.331034 3
500 | 1.055696 4.334391 3
501 | 0.993896 4.157872 3
502 | 0.275826 3.702109 3
503 | 0.389904 3.681509 3
504 | 0.464522 3.088961 3
505 | -0.666829 3.808039 3
506 | 0.837794 3.588580 3
507 | -0.698599 2.755791 3
508 | 0.458205 3.403272 3
509 | 0.729392 3.981536 3
510 | 0.313547 2.873348 3
511 | -0.157964 3.197363 3
512 | 0.325907 3.448500 3
513 | -0.121708 4.584704 3
514 | 1.381909 3.329295 3
515 | 1.270943 3.093448 3
516 | 0.495010 3.511124 3
517 | 0.610736 3.299173 3
518 | -0.625080 3.143712 3
519 | 0.497482 3.745140 3
520 | -0.131779 3.730399 3
521 | 0.305124 3.563952 3
522 | 0.940519 3.009491 3
523 | -0.169042 3.394940 3
524 | 0.239021 4.161718 3
525 | 0.185186 2.893033 3
526 | -0.734306 2.758721 3
527 | -0.049837 3.139409 3
528 | -0.332377 2.830409 3
529 | 0.478805 2.878933 3
530 | -0.077303 3.415998 3
531 | 0.457472 4.719565 3
532 | -0.040132 3.198370 3
533 | -0.276620 4.490310 3
534 | -0.228278 3.518357 3
535 | 0.202948 3.230873 3
536 | 0.536485 4.103214 3
537 | 0.495193 3.351360 3
538 | 0.347514 3.261269 3
539 | 0.010224 3.607532 3
540 | 1.292184 3.304483 3
541 | 1.554765 3.235084 3
542 | -0.152104 3.453536 3
543 | 0.277291 4.954680 3
544 | -0.342265 4.141942 3
545 | 1.771569 3.518723 3
546 | 0.856288 3.551775 3
547 | -0.225623 3.630146 3
548 | 0.803644 3.704306 3
549 | 1.124180 3.071383 3
550 | 0.311533 3.328471 3
551 | 1.154851 3.234169 3
552 | 0.700369 3.586200 3
553 | 0.023591 3.808588 3
554 | 0.724540 3.667592 3
555 | 0.784417 3.867550 3
556 | 0.689566 2.997131 3
557 | 0.101596 4.134800 3
558 | 0.275460 3.141057 3
559 | 0.783776 3.478988 3
560 | 1.227454 3.224738 3
561 | -0.328715 3.701010 3
562 | 0.569903 3.740196 3
563 | 0.016449 3.377819 3
564 | -0.155217 4.657857 3
565 | 0.940153 3.380291 3
566 | -0.259682 2.703055 3
567 | -0.327708 4.990020 3
568 | 1.066683 4.007630 3
569 | 0.628315 3.307047 3
570 | 0.431745 3.225471 3
571 | -0.742821 2.961425 3
572 | 0.155522 3.770318 3
573 | 1.997436 4.338694 3
574 | 0.951415 3.466628 3
575 | 0.533647 3.069552 3
576 | -0.196966 3.260994 3
577 | 0.000336 4.792535 3
578 | 0.532273 3.239113 3
579 | 0.403729 3.725913 3
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/5CloseS1.txt:
--------------------------------------------------------------------------------
1 | 1.580000 0.260000 1
2 | 1.200000 0.790000 1
3 | 0.680000 -0.030000 1
4 | 1.210000 0.450000 1
5 | 1.550000 0.470000 1
6 | 1.020000 0.600000 1
7 | 1.630000 -0.450000 1
8 | 2.150000 0.180000 1
9 | 1.240000 0.950000 1
10 | 1.370000 0.750000 1
11 | 1.950000 -0.260000 1
12 | 1.320000 0.890000 1
13 | 1.510000 0.460000 1
14 | 2.210000 0.010000 1
15 | 2.080000 -0.040000 1
16 | 0.730000 0.520000 1
17 | 1.890000 0.690000 1
18 | 1.940000 -0.880000 1
19 | 0.990000 -0.550000 1
20 | 1.820000 0.260000 1
21 | 1.600000 -0.010000 1
22 | 0.860000 -0.710000 1
23 | 1.310000 -0.910000 1
24 | 1.650000 -0.620000 1
25 | 1.960000 -0.760000 1
26 | 2.080000 0.160000 1
27 | 1.180000 0.500000 1
28 | 1.700000 0.900000 1
29 | 0.960000 0.290000 1
30 | 0.970000 -0.420000 1
31 | 1.530000 -0.740000 1
32 | 0.640000 0.410000 1
33 | 0.750000 0.410000 1
34 | 2.260000 -0.170000 1
35 | 2.090000 0.120000 1
36 | 1.410000 0.830000 1
37 | 1.220000 -0.960000 1
38 | 1.520000 0.330000 1
39 | 1.820000 -0.580000 1
40 | 1.070000 -0.820000 1
41 | 1.230000 0.300000 1
42 | 1.170000 0.400000 1
43 | 1.670000 0.960000 1
44 | 2.010000 0.130000 1
45 | 2.470000 0.130000 1
46 | 0.700000 0.370000 1
47 | 1.630000 0.180000 1
48 | 1.120000 0.820000 1
49 | 1.190000 -0.470000 1
50 | 0.560000 0.170000 1
51 | 1.300000 -0.250000 1
52 | 1.330000 0.150000 1
53 | -0.790000 0.030000 2
54 | -1.460000 -0.020000 2
55 | -1.460000 -0.160000 2
56 | -1.310000 0.170000 2
57 | -1.330000 -0.220000 2
58 | -0.670000 0.220000 2
59 | -1.240000 0.310000 2
60 | -1.060000 -0.450000 2
61 | -3.210000 -0.250000 2
62 | -2.860000 -0.260000 2
63 | -3.850000 0.520000 2
64 | -3.610000 0.730000 2
65 | -3.920000 -0.440000 2
66 | -3.640000 0.700000 2
67 | -3.890000 -0.840000 2
68 | -3.180000 -0.690000 2
69 | -4.270000 -0.410000 2
70 | -2.790000 0.340000 2
71 | -4.210000 -0.190000 2
72 | -2.760000 -0.390000 2
73 | -3.430000 -0.310000 2
74 | -4.090000 0.780000 2
75 | -4.040000 -0.060000 2
76 | -3.800000 0.010000 2
77 | -3.770000 0.380000 2
78 | -4.070000 0.740000 2
79 | -2.740000 0.210000 2
80 | -4.210000 -0.510000 2
81 | -3.400000 -0.780000 2
82 | -3.960000 0.570000 2
83 | -3.000000 -0.170000 2
84 | -2.790000 -0.220000 2
85 | -3.860000 -0.380000 2
86 | -3.490000 -0.770000 2
87 | -2.740000 0.570000 2
88 | -4.250000 0.290000 2
89 | -3.200000 -0.300000 2
90 | -2.920000 -0.020000 2
91 | -4.320000 0.520000 2
92 | -3.420000 -0.330000 2
93 | -3.280000 0.570000 2
94 | -3.490000 -0.400000 2
95 | -4.140000 0.530000 2
96 | -3.300000 0.870000 2
97 | -3.960000 0.000000 2
98 | -3.180000 -0.090000 2
99 | -4.290000 -0.600000 2
100 | -3.290000 -0.640000 2
101 | -3.740000 0.280000 2
102 | -2.830000 0.700000 2
103 | -2.860000 0.280000 2
104 | -3.200000 0.140000 2
105 | -3.370000 -0.310000 2
106 | -4.100000 -0.350000 2
107 | -3.750000 -0.140000 2
108 | -3.480000 0.840000 2
109 | -3.600000 0.200000 2
110 | -2.990000 -0.510000 2
111 | -3.400000 0.410000 2
112 | -2.720000 -0.460000 2
113 | -2.540000 -0.180000 2
114 | -3.090000 -0.420000 2
115 | -3.570000 -0.810000 2
116 | -3.930000 -0.090000 2
117 | -3.870000 0.740000 2
118 | -3.350000 -0.210000 2
119 | -3.830000 -0.300000 2
120 | -4.080000 -0.620000 2
121 | -0.040000 2.930000 2
122 | -0.820000 3.210000 2
123 | -0.400000 2.640000 2
124 | -0.130000 2.900000 2
125 | -0.080000 3.020000 2
126 | -0.740000 2.700000 2
127 | -0.300000 2.850000 2
128 | -0.240000 3.260000 2
129 | -0.750000 3.390000 2
130 | -0.500000 2.890000 2
131 | -0.420000 3.470000 2
132 | -0.270000 3.010000 2
133 | -0.070000 -2.670000 2
134 | -0.580000 -3.360000 2
135 | -0.610000 -3.390000 2
136 | -0.980000 -1.790000 2
137 | -1.810000 -2.590000 2
138 | -1.570000 -2.250000 2
139 | -0.920000 -2.930000 2
140 | -0.760000 -2.420000 2
141 | -1.490000 -3.080000 2
142 | -0.560000 -1.910000 2
143 | -0.030000 -2.660000 2
144 | -0.920000 -1.720000 2
145 | -1.750000 -3.030000 2
146 | -1.390000 -2.000000 2
147 | -0.170000 -2.410000 2
148 | -1.770000 -2.700000 2
149 | -1.720000 -2.440000 2
150 | -0.160000 -2.500000 2
151 | -1.510000 -2.540000 2
152 | -1.610000 -2.940000 2
153 | -0.620000 -1.580000 2
154 | -1.320000 -3.330000 2
155 | -1.020000 -3.370000 2
156 | -1.080000 -2.360000 2
157 | -1.240000 -3.060000 2
158 | -0.620000 -3.230000 2
159 | -0.600000 -2.780000 2
160 | -1.000000 -3.370000 2
161 | -1.890000 -2.610000 2
162 | -1.370000 -3.020000 2
163 | -0.640000 -1.980000 2
164 | -1.260000 -2.680000 2
165 | -0.500000 -2.810000 2
166 | -1.580000 -2.710000 2
167 | -0.810000 -3.200000 2
168 | -1.710000 -2.310000 2
169 | -0.990000 -2.740000 2
170 | -1.200000 -3.040000 2
171 | -0.970000 -1.590000 2
172 | -0.420000 -2.400000 2
173 | -0.310000 -3.140000 2
174 | -1.550000 -3.110000 2
175 | -0.740000 -3.010000 2
176 | -0.190000 -2.100000 2
177 | -0.450000 -1.790000 2
178 | -1.220000 -2.660000 2
179 | -1.550000 -1.850000 2
180 | -0.700000 -3.230000 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/customized1.txt:
--------------------------------------------------------------------------------
1 | 0 1 0
2 | 0 -1 1
3 | 1 1 1
4 | 1 -1 0
5 | 2 1 0
6 | 2 -1 1
7 | 3 1 1
8 | 3 -1 0
9 | 4 1 0
10 | 4 -1 1
11 | 5 1 1
12 | 5 -1 0
13 | 6 1 0
14 | 6 -1 1
15 | 7 1 1
16 | 7 -1 0
17 | 8 1 0
18 | 8 -1 1
19 | 9 1 1
20 | 9 -1 0
21 | 10 1 0
22 | 10 -1 1
23 | 11 1 1
24 | 11 -1 0
25 | 12 1 0
26 | 12 -1 1
27 | 13 1 1
28 | 13 -1 0
29 | 14 1 0
30 | 14 -1 1
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/customized3.txt:
--------------------------------------------------------------------------------
1 | 8.448694003531283 -6.986267456859818 8
2 | 6.856228376482321 -7.373341789274847 8
3 | 0.2551224766499874 8.700332011574508 4
4 | 8.549198765775484 -6.779280416510335 8
5 | 11.15490589854993 -8.114391201931166 7
6 | 0.5277049570428076 9.176413916964359 4
7 | 5.305971858935463 -6.443195171983515 1
8 | 8.07961205041158 -4.45639140731888 8
9 | 2.086800920244657 0.5391160474218792 5
10 | 0.9175406055464905 -6.0041606058511885 3
11 | -0.8862878970074615 -6.058762767728969 2
12 | 7.624713915930479 -6.656323496773512 8
13 | 0.2132559765425075 -4.270954734943461 6
14 | -1.4546954286136906 -5.215766088052274 6
15 | 10.004511513125863 6.932634414624444 0
16 | 9.112801690800147 7.569430181427326 0
17 | -0.08374879630147658 -2.771374650560139 6
18 | 4.021553683333264 2.8025171024895483 5
19 | 8.908878596585017 6.916694646078158 0
20 | -0.6494098850861009 8.30613283238526 4
21 | 4.60395912353329 -5.41333991810596 1
22 | 2.686786240092865 -4.671884580063446 3
23 | -3.406880524343429 -8.047943701834315 2
24 | -0.307713585186969 -4.405624617993162 6
25 | 0.2009582595480968 8.514985876022621 4
26 | 9.483896475444235 -7.861830025028514 7
27 | 0.0553329982903199 11.165420982575911 4
28 | 4.4712299664814426 0.1231942943857336 5
29 | 6.922218572642187 -4.812235127828717 8
30 | 7.757755097180605 -6.679224328241403 8
31 | 6.585056720592789 -7.151974727781247 1
32 | -1.2858642442810244 7.915119519402268 4
33 | -2.1291075125886487 -7.4457413701078385 2
34 | 9.231821057280891 -7.031684682497801 7
35 | 8.634676255063368 -7.670661039182789 7
36 | 8.962595739932869 -9.402290327170792 7
37 | -9.259671665422882 -4.583777583786706 9
38 | 9.53253550534046 8.584237622014607 0
39 | 1.6933511692434813 7.7334531015042005 4
40 | 6.188289725283676 -6.400651155906502 1
41 | 10.09211802341612 7.4894504126896955 0
42 | -8.67849297875228 -4.247990560171324 9
43 | 4.603755612398007 -6.6128002319162515 1
44 | 7.078807425705484 -7.065415958980328 8
45 | 4.1200606140744185 -6.584344874060904 1
46 | 3.5921579985366825 2.3179761327138095 5
47 | -2.904956164669033 -6.59007822454881 2
48 | 8.522933783982998 -5.847397127942577 7
49 | -2.674608052650485 -7.577934133045609 2
50 | 6.885461724024333 -6.861889328939859 8
51 | -2.9908233745863946 -7.941221169110123 2
52 | 5.546117775837744 -5.504490150435641 1
53 | 6.682597610739124 -7.066988541948393 1
54 | -6.44671356579045 -4.048918299439101 9
55 | -8.565732487483032 -2.6698215687921936 9
56 | 0.8063736137776225 9.371449235263944 4
57 | 0.504994115981235 -3.3680979380787277 6
58 | 0.7050218185127782 9.66967765616433 4
59 | 0.6504343033462692 7.182870962018828 4
60 | -1.8885103158466048 -5.305727049677518 2
61 | 10.391708205182633 -9.014916729469338 7
62 | 8.6905052558526 8.061769654750591 0
63 | 2.4581475106195843 1.7174032100362262 5
64 | -0.30054561251850714 6.81813415749425 4
65 | 7.946446801259988 -5.785153955207258 7
66 | 3.135213194315289 2.8676124928970785 5
67 | 1.1490169487660982 7.777596010719303 4
68 | -10.02689434779379 -2.2863171706718144 9
69 | 6.821460964845657 -6.3826570707303825 8
70 | 5.050484676391716 -6.614415857610588 1
71 | 3.9228186134889618 0.2859725544340317 5
72 | -0.37063755020893074 10.559112209349372 4
73 | -8.49306948670782 -4.308174763578325 9
74 | 2.4074388679719916 -6.41315357489504 1
75 | 8.013604543771418 -6.308480318352319 7
76 | 9.230201182231866 7.02367135458905 0
77 | -0.04561587610004203 -7.149964092627738 2
78 | 1.9217525655542127 1.8400889122422925 5
79 | 9.441444011645853 8.254851915649963 0
80 | 7.091776403469952 8.76512016773506 0
81 | -2.8442896766156265 -3.5709072723373607 6
82 | 8.154417664484459 -9.776981394606599 7
83 | 4.800233576599807 1.212932887480092 5
84 | 7.615110021223209 -6.882903360359034 8
85 | 0.5383246789666545 8.35730232058361 4
86 | -0.32594703679817594 7.9836682722595 4
87 | -2.0586095981315133 -3.953163757697443 6
88 | 4.81551416030493 -7.518909358430451 1
89 | 6.370766000767626 -5.839921711157462 8
90 | 9.04246954715912 -7.412331968907111 7
91 | -0.06586275884243697 -4.311002706334135 6
92 | 8.172463863215382 -6.121923539017149 8
93 | -3.004418084914471 -6.654876186080374 2
94 | 3.0057137200148616 1.3190003832762125 5
95 | 5.279226146737893 -6.578857423575543 1
96 | 0.7798835915876747 -3.692070034466972 6
97 | 10.880144404842918 -8.118477276290761 7
98 | 5.300176852435344 -6.420154982345092 1
99 | 2.0653647561083313 -5.549942862330606 3
100 | 10.068736015556123 7.817241413368334 0
101 | -7.6051955265486715 -3.36115041105491 9
102 | 6.854269817803745 -5.092247375800393 8
103 | 8.459606248544352 -6.537129141822288 7
104 | 2.9838262034817413 -5.031716046674572 3
105 | 2.963402372026637 2.347408450580784 5
106 | -2.4700457636093813 -6.85372261843269 2
107 | 3.057595147599433 2.0183668414286298 5
108 | -7.764515527717448 -5.912235047471418 9
109 | -0.24824269781228225 -3.620305953487039 6
110 | 4.903951173315553 1.6464627785544057 5
111 | -1.5464541229127389 -8.224648305923887 2
112 | -8.571530085622426 -4.4418298511048215 9
113 | -0.6563586197256923 8.923000619457301 4
114 | 1.7496243186006486 2.9535284186687543 5
115 | 2.928076974515936 -7.217625454173525 3
116 | 10.48068813592006 -6.7727393189798715 7
117 | 4.012863358003847 -5.920599414073532 1
118 | 2.521284330747346 -7.145023864745395 1
119 | 7.204638514172299 -6.3887419233956155 8
120 | 1.7017684120715642 2.342730181140583 5
121 | 4.276656212249875 -5.849928728535914 1
122 | 8.257409319689259 7.455140683620733 0
123 | 5.431001990843069 -5.780110001164464 1
124 | -1.8574090137649562 -6.794632656820661 2
125 | 8.984943748609371 -5.4940674793380335 7
126 | -1.3019308643051328 -3.5809248267953566 6
127 | 0.6883844294563032 8.858549925654243 4
128 | 8.826083784831745 7.2820447918570945 0
129 | -9.111878489685836 -3.433739719269569 9
130 | 8.493922152067341 -7.129462032357705 7
131 | 1.5205025827339669 8.010899540072325 4
132 | 10.049678707370754 -4.7689537182876105 7
133 | 1.2416292519839776 8.752385676863705 4
134 | 3.3908195571758935 -5.523371651555559 3
135 | 2.3964524841953354 -4.467463698487209 3
136 | 6.152950608401259 -3.573723271445612 8
137 | -2.566297836832527 -6.855936697599072 2
138 | 7.539116547047458 -7.750715198139683 7
139 | 2.7814140256352857 -4.912393175592726 1
140 | -2.03604833163268 -4.293384351729502 6
141 | -1.0727223707082678 -3.6226906042360283 6
142 | 4.91825374346555 -7.042331862006244 1
143 | -2.573538735746733 -6.91939750134756 2
144 | 4.99015818185358 -5.466445414312579 1
145 | 10.015564382961303 -6.75788861117374 7
146 | 0.7735963303517286 9.810418545596185 4
147 | 8.033195967231649 -6.739203465767998 7
148 | -2.4014914721848086 -6.541352544695748 2
149 | 3.9192857098751075 -5.677067590637737 1
150 | 5.098237874891242 -6.175149381869451 1
151 | 8.630303206890774 -5.4509236985277205 7
152 | -1.466037608674824 -3.6545303092049477 6
153 | -8.36579040151885 -4.606809434144398 9
154 | 9.07971513830025 8.210493084342017 0
155 | 2.229685566958706 -5.097116571726435 3
156 | 3.688916374049785 -5.648824077476541 3
157 | 4.367762991814666 -6.096504319457589 1
158 | -5.144913762185599 -7.0161401206337946 2
159 | -2.0737390525835995 -4.015654322156537 6
160 | -9.056628149796495 -2.3072117442936744 9
161 | -2.472926805245624 -6.67412711812111 2
162 | 1.7854362926162384 -5.856844166220937 3
163 | 2.9973368754064054 1.3390467566021322 5
164 | 4.629546642572801 -5.893023061987412 1
165 | 9.27470959419363 -7.989933280019921 7
166 | 10.282416979198306 -8.011872971871842 7
167 | 4.1202088369287795 1.0043355782766201 5
168 | -0.6797505305268248 -6.465197388448818 6
169 | 5.684897391431077 -5.373240402819763 8
170 | 2.147891345216278 -6.276223628451348 3
171 | 9.45209342320482 -8.575550962454763 7
172 | 9.309672248613676 7.228881862573436 0
173 | -0.22797466528849775 8.139283624018681 4
174 | -7.9295021067433344 -3.0369007155944723 9
175 | 6.661323248368046 7.409483694796202 0
176 | 9.41378332936421 7.51031796271223 0
177 | -6.634947589082192 -1.6390015337292576 9
178 | 5.156681595785436 -6.356216862907635 8
179 | 7.64854172707538 7.623092210074418 0
180 | -0.01729070580493941 -1.9366233029068947 6
181 | 5.441655993604026 -6.6658604490554785 1
182 | -2.7844102388436895 -6.780190166250672 2
183 | -8.107803794327936 -3.429185273073391 9
184 | 7.402918119511206 -5.748558166333796 8
185 | 3.468919381022255 2.480582143264149 5
186 | 6.916054197488343 -7.228537251340792 1
187 | 1.6458014250572268 -5.398781546450492 3
188 | 8.87569819310211 -6.902035376999604 7
189 | 3.47200870325157 -6.16320849777165 1
190 | 9.968689161256735 -7.122408054261066 7
191 | 1.6315385080830946 -4.927845612242221 3
192 | -9.850943987635057 -3.5782427683388143 9
193 | -2.213248125772071 -8.144094933830704 2
194 | 3.2842043215457952 -5.37099209846776 3
195 | 7.832475117364129 8.503463665866233 0
196 | 0.9987230566891689 -4.889159790602019 3
197 | 4.905422286437496 -5.402108848800513 8
198 | -2.0367842920740653 -3.07137271272778 6
199 | 6.075209059223089 -7.303831644907723 1
200 | 7.666702802875997 -6.76053396014732 8
201 | -2.6759941387222916 -3.4573328912099273 6
202 | 0.9275962280193631 9.173310685778121 4
203 | -0.08669586899702264 -4.090702959245499 6
204 | -0.9420874087634973 -3.818547044774748 6
205 | 8.17871748012151 -4.571040449265208 8
206 | 7.560967272373291 7.227897769627124 0
207 | -3.915043302137844 -7.926849050629255 2
208 | 0.2112287515515144 8.577637955353742 4
209 | 4.602060815138894 -6.014143882708159 1
210 | -1.792305572954547 -6.930238658896179 2
211 | 6.850964543075476 -4.407592275378397 8
212 | 3.6526479426708183 2.1980704921131875 5
213 | 1.4708119312385999 7.3140504662256784 4
214 | 0.11008676293736466 9.163593710144562 4
215 | -1.614439605891256 -4.222336898201655 6
216 | 9.363017491958056 8.413366367473806 0
217 | 10.026324354238653 -7.548988187742585 7
218 | 0.23568714545104474 -4.6319823184244715 6
219 | -7.834252595202104 -5.0108969022621315 9
220 | -0.22751294851637827 7.606709587637587 4
221 | 3.308008770014869 -4.514018013843671 3
222 | 5.0196130498840725 0.6184860134414718 5
223 | 0.09918356689004071 -3.3608101362054277 6
224 | -3.693731050589406 -8.092596708489635 2
225 | 2.6660959213619893 3.181443983731673 5
226 | 5.063588555465392 1.8894349803533372 5
227 | 3.5065818949737526 -6.77389098081391 1
228 | 8.453271674842059 8.054571222670635 0
229 | -0.9446558045307448 -3.170054491956998 6
230 | -1.3509229341930447 -5.368801328067775 2
231 | 2.4972011474312086 -4.008997404921455 3
232 | -1.9326877712158754 -7.328497478337186 2
233 | -0.8811763562799695 6.221406871572756 4
234 | -9.669181460494473 -1.7858094241140867 9
235 | 2.909952777744193 -5.303872843080571 3
236 | -0.39058276420876525 -4.563341489305118 6
237 | 7.469831980179503 -6.736184640226177 8
238 | 5.738107727735903 -6.1255280012915225 1
239 | 1.9761300360035092 10.806101908301994 4
240 | 3.1972822643277055 -6.424978467136772 1
241 | 5.654483508038863 -7.069993820684235 8
242 | -1.653349344859213 -3.6889093477848145 6
243 | 0.7345355168927366 8.36998475175433 4
244 | 4.388106996964485 3.1371432237983017 5
245 | 0.546127228050572 8.75016504080504 4
246 | -3.4166098002656917 -7.075845341539262 2
247 | -9.415295316487057 -3.387621097143349 9
248 | 10.08042201769818 -7.613525643540108 7
249 | 4.3296805745400455 -6.922558106146015 1
250 | 2.3800984225677833 -5.599380140674695 3
251 | -7.195979078639324 -2.7501119780030536 9
252 | -2.428550450891179 -7.376057946458592 2
253 | 9.407348133404781 7.751071459132014 0
254 | 3.9028114265386717 2.766208996205116 5
255 | 5.523543144110674 -6.413944038125844 3
256 | 4.207445900396592 -6.3623455890242715 3
257 | 8.02298003638217 -4.495984426511398 8
258 | -4.691474775448951 -6.239553578447446 2
259 | -9.470104359885184 -3.3399034363452467 9
260 | 7.1683068015102736 -5.3653537496281105 8
261 | -2.134190755865725 -5.491542562955802 6
262 | 1.4907588332156279 -5.125759587866131 3
263 | 4.790509286324634 -6.695524725900909 1
264 | 8.112055248908332 -5.5997658576665446 8
265 | -2.981470653082416 -6.74021567697747 2
266 | 3.8976935246573268 2.565262648870685 5
267 | 9.169188457889561 8.235529553643417 0
268 | 2.419556991447868 -6.725504371730207 3
269 | 2.265996354987695 -6.448594988676931 3
270 | 7.856079873864914 7.068947523312034 0
271 | 9.248198503803732 -6.057312368798749 7
272 | 7.429781718472979 -5.975398418891562 8
273 | -0.4956404435642523 8.874686025927215 4
274 | -3.2970865298149152 -7.132646954790027 2
275 | 2.005059517414948 -5.0605852625949135 3
276 | -0.919184233076205 -5.622310932243479 2
277 | 10.78530296316047 7.997839657551201 0
278 | 7.5611407824922905 -6.552940895343153 8
279 | -0.6103531093798525 -2.2749352476346405 6
280 | 5.2070387076489135 -6.6141620165072466 1
281 | 0.8432820582445292 9.649866794030522 4
282 | 1.2840444795664532 7.9226989711665015 4
283 | 7.914918295778158 -6.874904312631864 8
284 | -7.65402656792147 -2.9623786686711844 9
285 | 3.6569033232758654 1.5280860557245677 5
286 | -0.28909291366879575 -4.406867453856874 6
287 | 3.9096532439625715 2.436540300786576 5
288 | 9.605478768672874 -7.164197608623498 7
289 | -8.251787073134539 -2.4106132376945197 9
290 | 5.031952362729534 -6.607846172390328 1
291 | -8.32360192724574 -6.245852580823209 9
292 | -8.831531282783935 -4.793266533681487 9
293 | 6.772551769706733 -8.130792348103087 8
294 | 6.251154597601639 -5.78075089782246 8
295 | 1.0430109036021604 7.841933737056835 4
296 | 8.487776654899813 9.129977291879078 0
297 | -0.1946402586012832 -4.391110615856346 6
298 | 9.12849975189964 8.293289626981506 0
299 | -0.5235763331080854 8.649661835192301 4
300 | -2.884853035179909 -6.921745551460784 2
301 | -1.2029521606959797 -2.522207635755401 6
302 | 6.183666900146385 -5.045516172549911 1
303 | 1.9557933991504388 -5.096467713661543 3
304 | 3.9966069266006796 -5.444719756822112 3
305 | -2.9565257627339174 -7.1891651726089 2
306 | 2.883265397242557 -5.757131256507414 3
307 | 9.214183015820232 9.405580814991577 0
308 | -7.129370835608716 -3.7637697359169673 9
309 | 0.2937295207693228 8.516321438858707 4
310 | 6.930842061234286 -6.666044799513341 8
311 | 0.12281813271959 7.219476621341242 4
312 | -0.8018551187779204 -4.123318697697528 6
313 | 3.807397280462236 1.3154906298134943 5
314 | 9.183241618427601 -6.306180256746048 7
315 | 4.139246205170156 2.0990448337322447 5
316 | -3.063240690827455 -8.755356466333039 2
317 | 2.138793620527748 -5.567046519079064 3
318 | 6.89802166948548 -6.132638110748511 8
319 | 5.112077946608845 -5.005662404115822 1
320 | -2.2156856968044822 -7.00033120949753 2
321 | 3.254683041439622 2.192929540950775 5
322 | 8.797068924890663 7.523086089458932 0
323 | -0.9999428666468719 9.875245488237864 4
324 | 3.9085734118529194 -6.122656393018399 3
325 | 3.508033597645673 3.452764762129559 5
326 | -1.0046933069954744 -4.342889966740541 6
327 | 2.4240859651714883 0.9448819901929533 5
328 | 7.975361757929751 7.14005801621583 0
329 | 8.090226023777754 -6.680649655261631 7
330 | 1.8371280951336382 -6.075411305754713 3
331 | -2.554712194865649 -7.230261840898628 2
332 | -7.510643203583892 -4.253907310720132 9
333 | 1.323630287953261 -6.1605951372439955 3
334 | 5.396717628315109 1.079353504796861 5
335 | 1.4398842148445559 -6.443865259920385 3
336 | -8.962812911802107 -2.7020924670489226 9
337 | 4.151841450448362 -7.59806329582465 1
338 | 3.4697021234800887 1.467296492793446 5
339 | -3.3723258124281794 -7.130980745063954 2
340 | 3.999919088483472 0.1498745453603354 5
341 | 1.0616298774987099 -5.833241625332788 3
342 | -2.9036801218502237 -8.592104270830001 2
343 | -1.1328920277208894 -3.7709943273490194 6
344 | 7.3136396468509925 -7.183061300586925 7
345 | 4.545786744035622 -4.37404711470198 3
346 | 1.098274315811469 6.062853234310872 4
347 | 0.8455932573147134 8.402398886015852 4
348 | 8.5069322998004 -5.301752546312001 8
349 | 4.672739365381947 -7.287474344316221 3
350 | -0.442437644520829 8.349918520986007 4
351 | 8.762909400471083 -8.161412003271623 8
352 | 4.7800623952177155 -8.402698725773 1
353 | 2.587774842754204 -6.335728862611163 3
354 | -1.5846528605948629 -6.5151368609949785 2
355 | -8.577256272202359 -4.362743968690165 9
356 | 1.2913570645824786 -4.885690580200091 3
357 | 7.697169218790682 -6.8135117955197595 8
358 | 0.11239504429644587 -2.7604174766300122 6
359 | -2.2494795301331623 -7.577701786045467 2
360 | 8.596460051125655 -6.275729435642773 7
361 | 9.466465165953023 8.232180779507917 0
362 | -3.902297781155387 -8.640838105123585 2
363 | 10.81537698278157 8.454475852579565 0
364 | -1.5400538767881544 -6.933597345184097 2
365 | 0.9515862233196604 -5.4961999333812015 3
366 | 2.1594351078133345 -6.030416598100255 3
367 | 3.148306029307972 2.1808790545690764 5
368 | 4.16176423143421 4.15151429261892 5
369 | 3.371328414403221 -6.237093221299843 3
370 | 6.684667453515175 8.934704240271717 0
371 | -2.4696801340724184 -6.207454369014754 2
372 | 4.891540709845046 2.7409755738239037 5
373 | 3.9679434660663406 1.9329291650928202 5
374 | 10.204688295030811 7.850004140104353 0
375 | -4.400712115321347 -7.9709087870750075 2
376 | 5.947981758785031 -7.849283249453038 8
377 | 7.549095584349434 -9.092600084954059 7
378 | -7.683922956612404 -3.0699137474227447 9
379 | 1.8395934920538064 -5.535447624653133 3
380 | 3.197274372867646 1.7432234335727734 5
381 | -2.3774150075372966 -6.649415411769119 2
382 | 8.035031837828102 8.141698344743332 0
383 | -0.111199486359704 -3.486005739952734 6
384 | 4.855040183028393 -7.152578086552972 1
385 | 0.6060418840128661 -5.370900966053947 6
386 | -0.5748505505629382 -3.3500822174724636 6
387 | -8.32767122257876 -2.8529222391464364 9
388 | -8.143515582673306 -2.9900187854296028 9
389 | -0.39403830068924695 7.866422802016492 4
390 | 2.937897816048491 1.8517304898502913 5
391 | 6.798126120027496 -5.315606640624564 8
392 | 5.937184265778608 -5.114966383517847 8
393 | 8.485137063398215 -7.393492746027521 7
394 | -0.564760734338191 8.206813714717573 4
395 | 1.9309398299740108 -6.435606485906676 3
396 | -9.221352159034979 -2.0908664129558225 9
397 | -9.540207864319937 -3.1789926850522536 9
398 | -2.3442200369594026 -4.526093694547143 6
399 | 10.147000349281289 -6.807789554595938 7
400 | 8.901082411375016 -9.047295329518978 7
401 | -9.406387823434407 -3.023543607154728 9
402 | 4.988185735030706 1.6021858198200212 5
403 | -3.80196918356278 -5.208519861304977 2
404 | 8.680987269232752 -6.601897381135487 7
405 | -1.3537577650256991 -3.7367051625578562 6
406 | 9.083592370623386 -9.053465989140522 7
407 | -8.438274006737094 -4.148558863853872 9
408 | 9.046815299749445 8.539280767829656 0
409 | 2.583098525029028 -2.8597638913055685 3
410 | 5.211641126921938 -6.591079439953049 1
411 | -3.4255606921146358 -7.286730747551021 2
412 | 6.588065436439938 -7.01703672926433 8
413 | -9.568333017747007 -4.941325082521213 9
414 | -9.642267822150231 -2.2142621343181066 9
415 | -2.342041745558695 -2.9041790771309075 6
416 | -1.1309277411197245 -5.198141411342898 6
417 | -8.533841462160217 -3.302520140787642 9
418 | 2.940826976606393 -7.039030263555503 3
419 | -9.668669569644935 -2.1348227916935203 9
420 | 5.605445317847733 -6.986048509417535 8
421 | 0.7980016683178519 -4.837771261399768 3
422 | 8.692651358691974 -6.704334425385026 7
423 | 9.008285503837444 8.143611248972675 0
424 | 1.1775391431383038 2.3683821153712903 5
425 | 4.713832593730103 -5.742321477088225 1
426 | 7.351952850610012 -6.224856114989848 8
427 | 1.608385546643686 0.9837884829150114 5
428 | 8.094610011560137 -7.047868195445058 7
429 | 5.753745798758113 -6.238810128476766 1
430 | 8.449299145617287 -8.352684935244316 7
431 | 5.755315912884118 -5.308600388620065 8
432 | 1.6663396865782656 7.475580663838729 4
433 | -1.915780728056411 -3.382751979894031 6
434 | 7.514892287324897 -6.445698814379217 8
435 | 6.548132772139847 8.601283264572212 0
436 | 4.013645305994454 -8.294362701457919 1
437 | 5.327087161236764 -4.780382936875223 1
438 | 2.1246363481169883 0.8789903053057639 5
439 | 7.808711443058611 6.476030384791218 0
440 | -0.417049323331797 -3.608360466618936 6
441 | 7.18046464065574 -8.00599253889936 8
442 | -8.534829517279997 -3.5305643837618543 9
443 | -0.007027821339482682 8.679635366539467 4
444 | 8.343760059477466 -5.250942131055297 7
445 | 1.5403092215023682 9.750327974032338 4
446 | 9.750230324924267 9.265654376682116 0
447 | 10.395983080363434 8.005816076351048 0
448 | 2.655459991041457 -6.087824416548161 3
449 | 10.919511927939798 9.231991555059885 0
450 | 3.8583831879048462 -7.008606319494314 1
451 | 2.481300536507763 -6.0192897466497275 3
452 | 2.8482608331149346 -5.346066109921389 3
453 | 6.99270923258691 6.995357659098013 0
454 | 7.462749725750497 -6.127291251463567 8
455 | -9.340994655401513 -2.477992964220532 9
456 | -3.866436512359611 -6.263475637509224 2
457 | -9.724827526083846 -5.151423075793702 9
458 | 5.871854942154399 -7.1179465482561515 1
459 | 6.895790518441125 -5.7998313982052805 8
460 | -8.794215443724926 -4.112168872680984 9
461 | -1.3060310114286975 8.004624083400966 4
462 | 9.097975448329857 -8.598722492703438 7
463 | 1.5631861112872063 -6.5755609943999875 3
464 | -0.10871813582595846 -3.1148229641154614 6
465 | 0.5919022612469578 -4.3761816660687 6
466 | -1.4232950595677991 -2.770323441004858 6
467 | -8.698197163312345 -4.612923720018851 9
468 | 7.73978484505726 -5.416607246474135 8
469 | -2.8715316228526597 -6.791088454553481 2
470 | -1.0620346376736327 -4.968584539442166 6
471 | 8.671204960846595 7.409287146996787 0
472 | 4.8726846051028625 -5.798473539837854 1
473 | 9.1093114840601 -7.534267942499626 7
474 | 2.6787391219447323 3.382521303552622 5
475 | -8.675488798304434 -4.025361094804247 9
476 | 7.718049834771136 -8.011354590230987 7
477 | 0.9118288593639132 2.467392764151738 5
478 | -10.49630713376627 -3.3502245619767943 9
479 | -10.29282677734523 -1.7566703751995454 9
480 | -5.760016508432483 -5.938791091064069 2
481 | 10.880412110582512 -6.664527081989343 7
482 | 4.366930929080391 2.713781945433186 5
483 | -7.392925409560231 -4.108226787530179 9
484 | 0.3459855275796867 8.249189574255425 4
485 | 9.004922465643128 7.471840302696568 0
486 | 9.793285969278166 7.648546654315732 0
487 | 8.365099568392598 7.8199923788037955 0
488 | -7.428629058165465 -3.833188205989337 9
489 | -1.8402796505262173 -3.278830376017617 6
490 | 8.145351323136858 5.7976589200727275 0
491 | 8.681818399429131 -7.4712342463735615 7
492 | -3.5601678248811863 -6.757778661852039 2
493 | 1.2997233880791579 3.1179024274341387 5
494 | 0.7893717584764006 8.457569883155731 4
495 | 8.672808779111204 -6.933788698634321 7
496 | 4.541231932990785 -5.028821980950191 1
497 | 9.550723101055222 7.076985376783847 0
498 | 0.5309860209336466 6.831297313833857 4
499 | 7.610342263404021 6.954187335864225 0
500 | 4.791538297046683 1.9407339567721498 5
501 |
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/perceptron1.txt:
--------------------------------------------------------------------------------
1 | 1 1 0
2 | 1 0 0
3 | 0 0 1
4 | 0 1 1
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/perceptron2.txt:
--------------------------------------------------------------------------------
1 | 1 1 1
2 | 1 0 0
3 | 0 0 1
4 | 0 1 0
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/perceptron4.txt:
--------------------------------------------------------------------------------
1 | 1 1 0
2 | 1 2 0
3 | 2 1 0
4 | 1 -1 1
5 | 1 -2 1
6 | -1 1 2
7 | -2 1 2
8 | -1 0 2
--------------------------------------------------------------------------------
/nn_sandbox/assets/data/xor.txt:
--------------------------------------------------------------------------------
1 | 1 1 1
2 | 1 0 0
3 | 0 0 1
4 | 0 1 0
--------------------------------------------------------------------------------
/nn_sandbox/assets/images/baseline-check_circle-24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/nn_sandbox/assets/images/baseline-play_arrow-24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/nn_sandbox/assets/images/baseline-stop-24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/seanwu1105/neural-network-sandbox/bebac433f1eb9aa16e17d13c6034319c1ee7fff4/nn_sandbox/backend/__init__.py
--------------------------------------------------------------------------------
/nn_sandbox/backend/algorithms/__init__.py:
--------------------------------------------------------------------------------
1 | from .base_algorithm import TraningAlgorithm, PredictiveAlgorithm
2 | from .perceptron_algorithm import PerceptronAlgorithm
3 | from .mlp_algorithm import MlpAlgorithm
4 | from .rbfn_algorithm import RbfnAlgorithm
5 | from .som_algorithm import SomAlgorithm
6 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/algorithms/base_algorithm.py:
--------------------------------------------------------------------------------
1 | import abc
2 | import copy
3 | import functools
4 | import threading
5 |
6 | import numpy as np
7 |
8 |
9 | class TraningAlgorithm(threading.Thread, abc.ABC):
10 | def __init__(self, dataset, total_epoches):
11 | super().__init__()
12 | self._dataset = np.array(dataset)
13 | self._total_epoches = total_epoches
14 | self._neurons = []
15 | self._should_stop = False
16 |
17 | def stop(self):
18 | self._should_stop = True
19 |
20 |
21 | class PredictiveAlgorithm(TraningAlgorithm, abc.ABC):
22 | def __init__(self, dataset, total_epoches, most_correct_rate,
23 | initial_learning_rate, search_iteration_constant, test_ratio):
24 | super().__init__(dataset, total_epoches)
25 | self.training_dataset: np.ndarray = None
26 | self.testing_dataset: np.ndarray = None
27 | self._most_correct_rate = most_correct_rate
28 | self._initial_learning_rate = initial_learning_rate
29 | self._search_iteration_constant = search_iteration_constant
30 |
31 | self._split_train_test(test_ratio=test_ratio)
32 |
33 | self.current_iterations = 0
34 | self.current_correct_rate = 0
35 | self.best_correct_rate = 0
36 | self._best_neurons = []
37 |
38 | def run(self):
39 | self._initialize_neurons()
40 | for self.current_iterations in range(self._total_epoches * len(self.training_dataset)):
41 | if self._should_stop:
42 | break
43 | if self.current_iterations % len(self.training_dataset) == 0:
44 | np.random.shuffle(self.training_dataset)
45 | self._iterate()
46 | self._save_best_neurons()
47 | if self._most_correct_rate and self.best_correct_rate >= self._most_correct_rate:
48 | break
49 | self._load_best_neurons()
50 |
51 | def test(self):
52 | return self._correct_rate(self.testing_dataset)
53 |
54 | @abc.abstractmethod
55 | def _initialize_neurons(self):
56 | """ initialize neurons and save to self._neurons """
57 |
58 | @abc.abstractmethod
59 | def _iterate(self):
60 | """ do things in each iteration of the training algorithm """
61 |
62 | @abc.abstractmethod
63 | def _correct_rate(self, dataset):
64 | """ calculate the correct rate for given dataset against current neuron network. """
65 |
66 | def _save_best_neurons(self):
67 | self.current_correct_rate = self._correct_rate(self.training_dataset)
68 | if self.current_correct_rate > self.best_correct_rate:
69 | self.best_correct_rate = self.current_correct_rate
70 | self._best_neurons = copy.deepcopy(self._neurons)
71 |
72 | def _load_best_neurons(self):
73 | self._neurons = copy.deepcopy(self._best_neurons)
74 |
75 | @property
76 | def current_data(self):
77 | return self.training_dataset[self.current_iterations % len(self.training_dataset)]
78 |
79 | @property
80 | def current_learning_rate(self):
81 | return self._initial_learning_rate / (1 + self.current_iterations
82 | / self._search_iteration_constant)
83 |
84 | @property
85 | @functools.lru_cache()
86 | def group_types(self):
87 | return np.unique(self._dataset[:, -1:])
88 |
89 | def _split_train_test(self, test_ratio=0.3):
90 | test_size = max(int(len(self._dataset) * test_ratio), 1)
91 | np.random.shuffle(self._dataset)
92 | self.training_dataset = self._dataset[test_size:, :]
93 | self.testing_dataset = self._dataset[:test_size, :]
94 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/algorithms/k_means.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | from ..utils import dist
4 |
5 |
6 | class KMeans:
7 | def __init__(self, num):
8 | self.clusters = [Cluster() for _ in range(num)]
9 |
10 | def fit(self, dataset: np.ndarray, search_times=100, tolerance=0.005):
11 | initial_centers = dataset[np.random.choice(
12 | dataset.shape[0], len(self.clusters), replace=False
13 | ), :-1]
14 | for cluster, init_center in zip(self.clusters, initial_centers):
15 | cluster.center = init_center
16 |
17 | for _ in range(search_times):
18 | self.groupify(dataset)
19 | for cluster in self.clusters:
20 | cluster.update_center()
21 | if max(cluster.diff for cluster in self.clusters) < tolerance:
22 | break
23 |
24 | return self.clusters
25 |
26 | def groupify(self, dataset):
27 | for data in dataset:
28 | distances = {dist(cluster.center, data[:-1]): cluster
29 | for cluster in self.clusters}
30 | distances[min(distances)].member.append(data[:-1])
31 |
32 |
33 | class Cluster:
34 | def __init__(self):
35 | self.center: np.ndarray = None
36 | self.member = []
37 | self.diff = 0
38 |
39 | @property
40 | def avg_distance(self):
41 | if not self.member:
42 | return 0
43 | return sum(dist(self.center, data) for data in self.member) / len(self.member)
44 |
45 | def update_center(self):
46 | if not self.member:
47 | return
48 | new_center = sum(self.member) / len(self.member)
49 | self.diff = max(abs(new_center - self.center))
50 | self.center = new_center
51 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/algorithms/mlp_algorithm.py:
--------------------------------------------------------------------------------
1 | import collections
2 |
3 | import numpy as np
4 |
5 | from . import PredictiveAlgorithm
6 | from ..neurons import Perceptron
7 | from ..utils import sigmoid
8 |
9 |
10 | class MlpAlgorithm(PredictiveAlgorithm):
11 | """ Backpropagation prototype. """
12 |
13 | def __init__(self, dataset, total_epoches=10, most_correct_rate=None,
14 | initial_learning_rate=0.8, search_iteration_constant=10000,
15 | momentum_weight=0.5, test_ratio=0.3, network_shape=None):
16 | super().__init__(dataset, total_epoches, most_correct_rate,
17 | initial_learning_rate, search_iteration_constant,
18 | test_ratio)
19 | self._momentum_weight = momentum_weight
20 |
21 | # the default network shape is (2 * 5)
22 | self.network_shape = network_shape if network_shape else (5, 5)
23 |
24 | # for momentum
25 | self._synaptic_weight_diff = collections.defaultdict(lambda: 0)
26 |
27 | def _iterate(self):
28 | result = self._feed_forward(self.current_data[:-1])
29 | deltas = self._pass_backward(self._normalize(self.current_data[-1]),
30 | result)
31 | self._adjust_synaptic_weights(deltas)
32 |
33 | def _initialize_neurons(self):
34 | """ Build the neuron network with single neuron as output layer. """
35 | self._neurons = tuple((Perceptron(sigmoid),) * size
36 | for size in list(self.network_shape) + [1])
37 |
38 | def _feed_forward(self, data):
39 | results = [None]
40 | for idx, layer in enumerate(self._neurons):
41 | if idx == 0:
42 | results = get_layer_results(layer, data)
43 | continue
44 | results = get_layer_results(layer, results)
45 | return results[0]
46 |
47 | def _pass_backward(self, expect, result):
48 | """ Calculate the delta for each neuron. """
49 | deltas = {}
50 |
51 | deltas[self._neurons[-1][0]] = ((expect - result)
52 | * result * (1 - result))
53 |
54 | for layer_idx, layer in reversed(tuple(enumerate(self._neurons[:-1]))):
55 | for neuron_idx, neuron in enumerate(layer):
56 | deltas[neuron] = (
57 | # sum of (delta) * (synaptic weight) for each neuron in next layer
58 | sum(deltas[n] * n.synaptic_weight[neuron_idx]
59 | for n in self._neurons[layer_idx + 1])
60 | * neuron.result
61 | * (1 - neuron.result)
62 | )
63 | return deltas
64 |
65 | def _adjust_synaptic_weights(self, deltas):
66 | for neuron in deltas:
67 | self._synaptic_weight_diff[neuron] = (
68 | self._synaptic_weight_diff[neuron] * self._momentum_weight
69 | + self.current_learning_rate * deltas[neuron] * neuron.data
70 | )
71 | neuron.synaptic_weight += self._synaptic_weight_diff[neuron]
72 |
73 | def _correct_rate(self, dataset):
74 | if not self._neurons:
75 | return 0
76 | correct_count = 0
77 | for data in dataset:
78 | self._feed_forward(data[:-1])
79 | expect = self._normalize(data[-1])
80 | interval = 1 / (2 * len(self.group_types))
81 | if expect - interval < self._neurons[-1][0].result < expect + interval:
82 | correct_count += 1
83 | if correct_count == 0:
84 | return 0
85 | return correct_count / len(dataset)
86 |
87 | def _normalize(self, value):
88 | """ Normalize expected output. """
89 | return (2 * (value - np.amin(self.group_types)) + 1) / (2 * len(self.group_types))
90 |
91 |
92 | def get_layer_results(layer, data):
93 | for neuron in layer:
94 | neuron.data = data
95 | return np.fromiter((neuron.result for neuron in layer), dtype=float)
96 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/algorithms/perceptron_algorithm.py:
--------------------------------------------------------------------------------
1 | from . import PredictiveAlgorithm
2 | from ..neurons import Perceptron
3 | from ..utils import sign
4 |
5 |
6 | class PerceptronAlgorithm(PredictiveAlgorithm):
7 | def __init__(self, dataset, total_epoches=10, most_correct_rate=None,
8 | initial_learning_rate=0.5, search_iteration_constant=1000,
9 | test_ratio=0.3):
10 | super().__init__(dataset, total_epoches, most_correct_rate,
11 | initial_learning_rate, search_iteration_constant,
12 | test_ratio)
13 |
14 | def _iterate(self):
15 | self._feed_forward(self.current_data[:-1])
16 | self._adjust_synaptic_weights()
17 |
18 | def _initialize_neurons(self):
19 | if len(self.group_types) <= 2:
20 | self._neurons = [Perceptron(sign)]
21 | else:
22 | self._neurons = [Perceptron(sign)
23 | for _ in range(len(self.group_types))]
24 |
25 | def _feed_forward(self, data):
26 | for neuron in self._neurons:
27 | neuron.data = data
28 |
29 | def _adjust_synaptic_weights(self):
30 | expect = self.current_data[-1]
31 | for idx, neuron in enumerate(self._neurons):
32 | if neuron.result == 1 and expect != self.group_types[idx]:
33 | neuron.synaptic_weight -= self.current_learning_rate * neuron.data
34 | elif neuron.result == -1 and expect == self.group_types[idx]:
35 | neuron.synaptic_weight += self.current_learning_rate * neuron.data
36 |
37 | def _correct_rate(self, dataset):
38 | correct_count = 0
39 | for data in dataset:
40 | for idx, neuron in enumerate(self._neurons):
41 | self._feed_forward(data[:-1])
42 | if ((neuron.result == 1 and data[-1] == self.group_types[idx]) or
43 | (neuron.result == -1 and data[-1] != self.group_types[idx])):
44 | correct_count += 1
45 | if correct_count == 0:
46 | return 0
47 | return correct_count / (len(dataset) * len(self._neurons))
48 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/algorithms/rbfn_algorithm.py:
--------------------------------------------------------------------------------
1 | from . import PredictiveAlgorithm
2 | from .k_means import KMeans
3 | from ..neurons import RbfNeuron
4 |
5 |
6 | class RbfnAlgorithm(PredictiveAlgorithm):
7 | def __init__(self, dataset, total_epoches=10, most_correct_rate=None,
8 | acceptable_range=0.5, initial_learning_rate=0.8,
9 | search_iteration_constant=10000, cluster_count=3,
10 | test_ratio=0.3):
11 | super().__init__(dataset, total_epoches, most_correct_rate,
12 | initial_learning_rate, search_iteration_constant,
13 | test_ratio)
14 | self.acceptable_range = acceptable_range
15 | self.cluster_count = cluster_count
16 |
17 | def _iterate(self):
18 | result = self._feed_forward(self.current_data[:-1])
19 | self._adjust_neurons(result)
20 |
21 | def _initialize_neurons(self):
22 | self._neurons = [RbfNeuron(cluster.center, cluster.avg_distance)
23 | for cluster in KMeans(self.cluster_count).fit(self.training_dataset)]
24 | self._neurons.insert(0, RbfNeuron(is_threshold=True))
25 |
26 | def _feed_forward(self, data):
27 | for neuron in self._neurons:
28 | neuron.data = data
29 | return sum(neuron.result for neuron in self._neurons)
30 |
31 | def _adjust_neurons(self, output):
32 | expect = self.current_data[-1]
33 | for neuron in self._neurons:
34 | new_synaptic_weight_diff = self._get_synaptic_weight_diff(
35 | output, expect, neuron
36 | )
37 | if not neuron.is_threshold and neuron.standard_deviation != 0:
38 | data_mean_diff = neuron.data - neuron.mean
39 | new_mean = (neuron.mean
40 | + new_synaptic_weight_diff
41 | * neuron.synaptic_weight
42 | * data_mean_diff
43 | / neuron.standard_deviation**2)
44 | new_standard_deviation = (neuron.standard_deviation
45 | + new_synaptic_weight_diff
46 | * neuron.synaptic_weight
47 | * data_mean_diff.dot(data_mean_diff)
48 | / neuron.standard_deviation**3)
49 | neuron.mean, neuron.standard_deviation = new_mean, new_standard_deviation
50 | neuron.synaptic_weight += new_synaptic_weight_diff
51 |
52 | def _get_synaptic_weight_diff(self, output, expect, neuron):
53 | if neuron.is_threshold:
54 | return self.current_learning_rate * (expect - output)
55 | return self.current_learning_rate * (expect - output) * neuron.activation_function(
56 | neuron.data, neuron.mean, neuron.standard_deviation
57 | )
58 |
59 | def _correct_rate(self, dataset):
60 | correct_count = 0
61 | for data in dataset:
62 | result = self._feed_forward(data[:-1])
63 | if data[-1] - self.acceptable_range < result < data[-1] + self.acceptable_range:
64 | correct_count += 1
65 | if correct_count == 0:
66 | return 0
67 | return correct_count / len(dataset)
68 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/algorithms/som_algorithm.py:
--------------------------------------------------------------------------------
1 | import time
2 | import math
3 | import operator
4 |
5 | import numpy as np
6 |
7 | from . import TraningAlgorithm
8 | from ..neurons import SomNeuron
9 | from ..utils import dist, flatten
10 |
11 |
12 | class SomAlgorithm(TraningAlgorithm):
13 | def __init__(self, dataset, total_epoches=10, initial_learning_rate=0.8,
14 | initial_standard_deviation=1, topology_shape=None):
15 | super().__init__(dataset, total_epoches)
16 | self._initial_learning_rate = initial_learning_rate
17 | self._initial_standard_deviation = initial_standard_deviation
18 |
19 | # the default topology shape is (10 * 10)
20 | self.topology_shape = topology_shape if topology_shape else [10, 10]
21 |
22 | self.current_iterations = 0
23 |
24 | def run(self):
25 | self._initialize_neurons()
26 | for self.current_iterations in range(self._total_epoches * len(self._dataset)):
27 | if self._should_stop:
28 | break
29 | if self.current_iterations % len(self._dataset) == 0:
30 | np.random.shuffle(self._dataset)
31 | self._iterate()
32 |
33 | def _initialize_neurons(self):
34 | data_range = tuple(zip(np.amin(self._dataset[:, :-1], axis=0),
35 | np.amax(self._dataset[:, :-1], axis=0)))
36 | self._neurons = [[SomNeuron(data_range)
37 | for _ in range(self.topology_shape[0])]
38 | for _ in range(self.topology_shape[1])]
39 |
40 | def _iterate(self):
41 | self._feed_forward()
42 | winner = self._get_winner()
43 | self._adjust_synaptic_weight(winner)
44 |
45 | def _feed_forward(self):
46 | for row in self._neurons:
47 | for neuron in row:
48 | neuron.data = self.current_data[:-1]
49 |
50 | def _get_winner(self):
51 | return min(flatten(self._neurons), key=operator.attrgetter('dist'))
52 |
53 | def _adjust_synaptic_weight(self, winner: SomNeuron):
54 | for i, row in enumerate(self._neurons):
55 | if winner in row:
56 | winner_index = (i, row.index(winner))
57 | break
58 |
59 | for i, row in enumerate(self._neurons):
60 | for j, neuron in enumerate(row):
61 | neuron.synaptic_weight += (
62 | self.current_learning_rate
63 | * math.exp(-dist(winner_index, (i, j))**2
64 | / (2 * self.current_standard_deviation**2))
65 | * (self.current_data[:-1] - neuron.synaptic_weight)
66 | )
67 |
68 | @property
69 | def current_data(self):
70 | return self._dataset[self.current_iterations % len(self._dataset)]
71 |
72 | @property
73 | def current_learning_rate(self):
74 | return self._initial_learning_rate * math.exp(
75 | -self.current_iterations /
76 | (self._total_epoches * len(self._dataset))
77 | )
78 |
79 | @property
80 | def current_standard_deviation(self):
81 | return self._initial_standard_deviation * math.exp(
82 | -self.current_iterations /
83 | (self._total_epoches * len(self._dataset))
84 | )
85 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/neurons/__init__.py:
--------------------------------------------------------------------------------
1 | from .perceptron import Perceptron
2 | from .rbf_neuron import RbfNeuron
3 | from .som_neuron import SomNeuron
4 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/neurons/perceptron.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 |
4 | class Perceptron:
5 | def __init__(self, activation_function):
6 | self._data: np.ndarray = None
7 | self.synaptic_weight: np.ndarray = None
8 | self.activation_function = activation_function
9 |
10 | @property
11 | def data(self):
12 | return self._data
13 |
14 | @data.setter
15 | def data(self, value):
16 | if self._data is None:
17 | self._data = value
18 | self._data = np.insert(self._data, 0, -1)
19 | else:
20 | self._data[1:] = value
21 | if self.synaptic_weight is None:
22 | self.synaptic_weight = np.random.uniform(-1, 1, len(self.data))
23 |
24 | @property
25 | def result(self):
26 | return self.activation_function(np.dot(self.synaptic_weight, self.data))
27 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/neurons/rbf_neuron.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | from . import Perceptron
4 |
5 | from ..utils import gaussian
6 |
7 |
8 | class RbfNeuron(Perceptron):
9 | def __init__(self, mean=None, standard_deviation=None,
10 | activation_function=gaussian, is_threshold=False):
11 | super().__init__(activation_function)
12 | self.mean = mean
13 | self.standard_deviation = standard_deviation
14 | self.is_threshold = is_threshold
15 | self.synaptic_weight = np.random.uniform(-1, 1)
16 |
17 | @property
18 | def data(self):
19 | return self._data
20 |
21 | @data.setter
22 | def data(self, value):
23 | self._data = value
24 |
25 | @property
26 | def result(self):
27 | if self.is_threshold:
28 | return self.synaptic_weight
29 | return self.synaptic_weight * self.activation_function(
30 | self.data, self.mean, self.standard_deviation
31 | )
32 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/neurons/som_neuron.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | from ..utils import dist
4 |
5 |
6 | class SomNeuron:
7 | def __init__(self, synaptic_weight_range):
8 | """
9 | A neuron for Self-Organizing Map.
10 |
11 | Args:
12 | synaptic_weight_range: The range for synaptic weight initialization.
13 |
14 | The following creates a neuron with target data, 2-dimension in this
15 | case, rangeing from -10 to 10 in 1st dimension and from 5 to 7.5 in 2nd dimension.
16 |
17 | >>> SomNeuron(((-10, 10), (5, 7.5)))
18 | """
19 | self._data: np.ndarray = None
20 | self.synaptic_weight = np.fromiter(
21 | (np.random.uniform(lower, upper)
22 | for lower, upper in synaptic_weight_range), dtype=float
23 | )
24 |
25 | @property
26 | def data(self):
27 | return self._data
28 |
29 | @data.setter
30 | def data(self, value):
31 | self._data = value
32 |
33 | @property
34 | def dist(self):
35 | """ the distance between input data and synaptic weight """
36 | return dist(self._data, self.synaptic_weight)
37 |
--------------------------------------------------------------------------------
/nn_sandbox/backend/utils.py:
--------------------------------------------------------------------------------
1 | import pathlib
2 | import math
3 |
4 | import numpy as np
5 |
6 |
7 | def sign(value):
8 | return 1 if value >= 0 else -1
9 |
10 |
11 | def sigmoid(value):
12 | return 1 / (1 + math.exp(-value))
13 |
14 |
15 | def gaussian(value: np.ndarray, mean: np.ndarray, standard_deviation):
16 | if standard_deviation == 0:
17 | return 0
18 | return math.exp((value - mean).dot(value - mean) / (-2 * standard_deviation**2))
19 |
20 |
21 | def dist(p1, p2):
22 | return sum((x1 - x2)**2 for x1, x2 in zip(p1, p2))**0.5
23 |
24 |
25 | def flatten(list_or_tuple):
26 | for element in list_or_tuple:
27 | if isinstance(element, (list, tuple)):
28 | yield from flatten(element)
29 | else:
30 | yield element
31 |
32 |
33 | def read_data(folder='nn_sandbox/assets/data'):
34 | data = {}
35 | for filepath in pathlib.Path(folder).glob('**/*.txt'):
36 | with filepath.open() as file_object:
37 | # make sure the data is stored in native Python type in order to
38 | # communicate with QML.
39 | data[filepath.stem] = np.loadtxt(file_object).tolist()
40 | return data
41 |
--------------------------------------------------------------------------------
/nn_sandbox/bridges/__init__.py:
--------------------------------------------------------------------------------
1 | import PyQt5.QtCore
2 |
3 | from .bridge import Bridge, BridgeProperty
4 | from .perceptron_bridge import PerceptronBridge
5 | from .mlp_bridge import MlpBridge
6 | from .rbfn_bridge import RbfnBridge
7 | from .som_bridge import SomBridge
8 |
--------------------------------------------------------------------------------
/nn_sandbox/bridges/bridge.py:
--------------------------------------------------------------------------------
1 | import abc
2 |
3 | import PyQt5.QtCore
4 | from .observer import Observer
5 |
6 |
7 | class BridgeProperty(PyQt5.QtCore.pyqtProperty):
8 | def __init__(self, value, name='', type_=None, notify=None):
9 | if type_ and notify:
10 | super().__init__(type_, self.getter, self.setter, notify=notify)
11 | self.value = value
12 | self.name = name
13 |
14 | def getter(self, instance=None):
15 | return self.value
16 |
17 | def setter(self, instance=None, value=None):
18 | self.value = value
19 | getattr(instance, f'_{self.name}_prop_signal').emit(value)
20 |
21 |
22 | class BridgeMeta(type(PyQt5.QtCore.QObject), abc.ABCMeta):
23 | def __new__(mcs, name, bases, attrs):
24 | for key in tuple(attrs.keys()):
25 | # NOTE: To avoid dictionary changed size during iteration causing
26 | # runiteration error, snapshot the keys by saving to tuple at first place.
27 | if isinstance(attrs[key], BridgeProperty):
28 | value = attrs[key].value
29 | signal = PyQt5.QtCore.pyqtSignal(type(value))
30 | attrs[key] = BridgeProperty(value, key,
31 | _convert2cpp_types(type(value)),
32 | notify=signal)
33 | attrs[f'_{key}_prop_signal'] = signal
34 | return super().__new__(mcs, name, bases, attrs)
35 |
36 |
37 | class Bridge(PyQt5.QtCore.QObject, Observer, metaclass=BridgeMeta):
38 | pass
39 |
40 |
41 | def _convert2cpp_types(python_type):
42 | # XXX: A workaround for PyQt5 5.12.2 not recognizing Python dict.
43 | if python_type == dict:
44 | return PyQt5.QtCore.QVariant
45 | return python_type
46 |
--------------------------------------------------------------------------------
/nn_sandbox/bridges/mlp_bridge.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | import PyQt5.QtCore
4 |
5 | from nn_sandbox.backend.algorithms import MlpAlgorithm
6 | from . import Bridge, BridgeProperty
7 | from .observer import Observable
8 |
9 |
10 | class MlpBridge(Bridge):
11 | ui_refresh_interval = BridgeProperty(0.0)
12 | dataset_dict = BridgeProperty({})
13 | training_dataset = BridgeProperty([])
14 | testing_dataset = BridgeProperty([])
15 | current_dataset_name = BridgeProperty('')
16 | total_epoches = BridgeProperty(10)
17 | most_correct_rate_checkbox = BridgeProperty(True)
18 | most_correct_rate = BridgeProperty(0.98)
19 | initial_learning_rate = BridgeProperty(0.8)
20 | search_iteration_constant = BridgeProperty(10000)
21 | momentum_weight = BridgeProperty(0.5)
22 | test_ratio = BridgeProperty(0.3)
23 | network_shape = BridgeProperty([5, 5])
24 | current_iterations = BridgeProperty(0)
25 | current_learning_rate = BridgeProperty(0.0)
26 | best_correct_rate = BridgeProperty(0.0)
27 | current_correct_rate = BridgeProperty(0.0)
28 | test_correct_rate = BridgeProperty(0.0)
29 | has_finished = BridgeProperty(True)
30 |
31 | def __init__(self):
32 | super().__init__()
33 | self.mlp_algorithm = None
34 |
35 | @PyQt5.QtCore.pyqtSlot()
36 | def start_mlp_algorithm(self):
37 | self.mlp_algorithm = ObservableMlpAlgorithm(
38 | self,
39 | self.ui_refresh_interval,
40 | dataset=self.dataset_dict[self.current_dataset_name],
41 | total_epoches=self.total_epoches,
42 | most_correct_rate=self._most_correct_rate,
43 | initial_learning_rate=self.initial_learning_rate,
44 | search_iteration_constant=self.search_iteration_constant,
45 | momentum_weight=self.momentum_weight,
46 | test_ratio=self.test_ratio,
47 | network_shape=self.network_shape
48 | )
49 | self.mlp_algorithm.start()
50 |
51 | @PyQt5.QtCore.pyqtSlot()
52 | def stop_mlp_algorithm(self):
53 | self.mlp_algorithm.stop()
54 |
55 | @property
56 | def _most_correct_rate(self):
57 | if self.most_correct_rate_checkbox:
58 | return self.most_correct_rate
59 | return None
60 |
61 |
62 | class ObservableMlpAlgorithm(Observable, MlpAlgorithm):
63 | def __init__(self, observer, ui_refresh_interval, **kwargs):
64 | Observable.__init__(self, observer)
65 | MlpAlgorithm.__init__(self, **kwargs)
66 | self.ui_refresh_interval = ui_refresh_interval
67 |
68 | def __setattr__(self, name, value):
69 | super().__setattr__(name, value)
70 | if name == 'current_iterations':
71 | self.notify(name, value)
72 | self.notify('test_correct_rate', self.test())
73 | elif name in ('best_correct_rate', 'current_correct_rate'):
74 | self.notify(name, value)
75 | elif name in ('training_dataset', 'testing_dataset') and value is not None:
76 | self.notify(name, value.tolist())
77 |
78 | def run(self):
79 | self.notify('has_finished', False)
80 | self.notify('test_correct_rate', 0)
81 | super().run()
82 | self.notify('test_correct_rate', self.test())
83 | self.notify('has_finished', True)
84 |
85 | def _iterate(self):
86 | super()._iterate()
87 | # the following line keeps the GUI from blocking
88 | time.sleep(self.ui_refresh_interval)
89 |
90 | @property
91 | def current_learning_rate(self):
92 | ret = super().current_learning_rate
93 | self.notify('current_learning_rate', ret)
94 | return ret
95 |
--------------------------------------------------------------------------------
/nn_sandbox/bridges/observer.py:
--------------------------------------------------------------------------------
1 | import abc
2 |
3 |
4 | class Observer(abc.ABC):
5 | def update(self, name, value):
6 | setattr(self, name, value)
7 |
8 |
9 | class Observable(abc.ABC):
10 | def __init__(self, observer):
11 | self._observer = observer
12 |
13 | @abc.abstractmethod
14 | def __setattr__(self, name, value):
15 | """
16 | Call `notify(name, value)` if the attributes are required by the
17 | observer.
18 | """
19 | super().__setattr__(name, value)
20 |
21 | def notify(self, name, value):
22 | self._observer.update(name, value)
23 |
--------------------------------------------------------------------------------
/nn_sandbox/bridges/perceptron_bridge.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | import PyQt5.QtCore
4 |
5 | from nn_sandbox.backend.algorithms import PerceptronAlgorithm
6 | from . import Bridge, BridgeProperty
7 | from .observer import Observable
8 |
9 |
10 | class PerceptronBridge(Bridge):
11 | ui_refresh_interval = BridgeProperty(0.0)
12 | dataset_dict = BridgeProperty({})
13 | training_dataset = BridgeProperty([])
14 | testing_dataset = BridgeProperty([])
15 | current_dataset_name = BridgeProperty('')
16 | total_epoches = BridgeProperty(5)
17 | most_correct_rate_checkbox = BridgeProperty(True)
18 | most_correct_rate = BridgeProperty(0.98)
19 | initial_learning_rate = BridgeProperty(0.5)
20 | search_iteration_constant = BridgeProperty(1000)
21 | test_ratio = BridgeProperty(0.3)
22 | current_iterations = BridgeProperty(0)
23 | current_learning_rate = BridgeProperty(0.0)
24 | best_correct_rate = BridgeProperty(0.0)
25 | current_correct_rate = BridgeProperty(0.0)
26 | test_correct_rate = BridgeProperty(0.0)
27 | has_finished = BridgeProperty(True)
28 | current_synaptic_weights = BridgeProperty([])
29 |
30 | def __init__(self):
31 | super().__init__()
32 | self.perceptron_algorithm = None
33 |
34 | @PyQt5.QtCore.pyqtSlot()
35 | def start_perceptron_algorithm(self):
36 | self.perceptron_algorithm = ObservablePerceptronAlgorithm(
37 | self,
38 | self.ui_refresh_interval,
39 | dataset=self.dataset_dict[self.current_dataset_name],
40 | total_epoches=self.total_epoches,
41 | most_correct_rate=self._most_correct_rate,
42 | initial_learning_rate=self.initial_learning_rate,
43 | search_iteration_constant=self.search_iteration_constant,
44 | test_ratio=self.test_ratio
45 | )
46 | self.perceptron_algorithm.start()
47 |
48 | @PyQt5.QtCore.pyqtSlot()
49 | def stop_perceptron_algorithm(self):
50 | self.perceptron_algorithm.stop()
51 |
52 | @property
53 | def _most_correct_rate(self):
54 | if self.most_correct_rate_checkbox:
55 | return self.most_correct_rate
56 | return None
57 |
58 |
59 | class ObservablePerceptronAlgorithm(Observable, PerceptronAlgorithm):
60 | def __init__(self, observer, ui_refresh_interval, **kwargs):
61 | Observable.__init__(self, observer)
62 | PerceptronAlgorithm.__init__(self, **kwargs)
63 | self.ui_refresh_interval = ui_refresh_interval
64 |
65 | def __setattr__(self, name, value):
66 | super().__setattr__(name, value)
67 | if name == 'current_iterations':
68 | self.notify(name, value)
69 | self.notify('current_synaptic_weights',
70 | [neuron.synaptic_weight.tolist()
71 | for neuron in self._neurons
72 | if neuron.synaptic_weight is not None])
73 | self.notify('test_correct_rate', self.test())
74 | elif name in ('best_correct_rate', 'current_correct_rate'):
75 | self.notify(name, value)
76 | elif name in ('training_dataset', 'testing_dataset') and value is not None:
77 | self.notify(name, value.tolist())
78 |
79 | def run(self):
80 | self.notify('has_finished', False)
81 | self.notify('test_correct_rate', 0)
82 | super().run()
83 | self.notify('current_synaptic_weights',
84 | [neuron.synaptic_weight.tolist()
85 | for neuron in self._neurons
86 | if neuron.synaptic_weight is not None])
87 | self.notify('test_correct_rate', self.test())
88 | self.notify('has_finished', True)
89 |
90 | def _iterate(self):
91 | super()._iterate()
92 | # the following line keeps the GUI from blocking
93 | time.sleep(self.ui_refresh_interval)
94 |
95 | @property
96 | def current_learning_rate(self):
97 | ret = super().current_learning_rate
98 | self.notify('current_learning_rate', ret)
99 | return ret
100 |
--------------------------------------------------------------------------------
/nn_sandbox/bridges/rbfn_bridge.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | import PyQt5.QtCore
4 |
5 | from nn_sandbox.backend.algorithms import RbfnAlgorithm
6 | from . import Bridge, BridgeProperty
7 | from .observer import Observable
8 |
9 |
10 | class RbfnBridge(Bridge):
11 | ui_refresh_interval = BridgeProperty(0.0)
12 | dataset_dict = BridgeProperty({})
13 | training_dataset = BridgeProperty([])
14 | testing_dataset = BridgeProperty([])
15 | current_dataset_name = BridgeProperty('')
16 | total_epoches = BridgeProperty(10)
17 | most_correct_rate_checkbox = BridgeProperty(True)
18 | most_correct_rate = BridgeProperty(0.98)
19 | acceptable_range = BridgeProperty(0.5)
20 | initial_learning_rate = BridgeProperty(0.8)
21 | search_iteration_constant = BridgeProperty(10000)
22 | cluster_count = BridgeProperty(3)
23 | test_ratio = BridgeProperty(0.3)
24 | current_iterations = BridgeProperty(0)
25 | current_learning_rate = BridgeProperty(0.0)
26 | best_correct_rate = BridgeProperty(0.0)
27 | current_correct_rate = BridgeProperty(0.0)
28 | test_correct_rate = BridgeProperty(0.0)
29 | has_finished = BridgeProperty(True)
30 | current_neurons = BridgeProperty([])
31 |
32 | def __init__(self):
33 | super().__init__()
34 | self.rbfn_algorithm = None
35 |
36 | @PyQt5.QtCore.pyqtSlot()
37 | def start_rbfn_algorithm(self):
38 | self.rbfn_algorithm = ObservableRbfnAlgorithm(
39 | self,
40 | self.ui_refresh_interval,
41 | dataset=self.dataset_dict[self.current_dataset_name],
42 | total_epoches=self.total_epoches,
43 | most_correct_rate=self._most_correct_rate,
44 | acceptable_range=self.acceptable_range,
45 | initial_learning_rate=self.initial_learning_rate,
46 | search_iteration_constant=self.search_iteration_constant,
47 | cluster_count=self.cluster_count,
48 | test_ratio=self.test_ratio
49 | )
50 | self.rbfn_algorithm.start()
51 |
52 | @PyQt5.QtCore.pyqtSlot()
53 | def stop_rbfn_algorithm(self):
54 | self.rbfn_algorithm.stop()
55 |
56 | @property
57 | def _most_correct_rate(self):
58 | if self.most_correct_rate_checkbox:
59 | return self.most_correct_rate
60 | return None
61 |
62 |
63 | class ObservableRbfnAlgorithm(Observable, RbfnAlgorithm):
64 | def __init__(self, observer, ui_refresh_interval, **kwargs):
65 | self.has_initialized = False
66 | Observable.__init__(self, observer)
67 | RbfnAlgorithm.__init__(self, **kwargs)
68 | self.has_initialized = True
69 | self.ui_refresh_interval = ui_refresh_interval
70 |
71 | def __setattr__(self, name, value):
72 | super().__setattr__(name, value)
73 | if name == 'current_iterations' and self.has_initialized:
74 | self.notify(name, value)
75 | self.notify('current_neurons', [{
76 | 'mean': neuron.mean.tolist(),
77 | 'standard_deviation': float(neuron.standard_deviation),
78 | 'synaptic_weight': float(neuron.synaptic_weight)
79 | } for neuron in self._neurons if not neuron.is_threshold])
80 | self.notify('test_correct_rate', self.test())
81 | if name in ('best_correct_rate', 'current_correct_rate'):
82 | self.notify(name, value)
83 | if name in ('training_dataset', 'testing_dataset') and value is not None:
84 | self.notify(name, value.tolist())
85 |
86 | def run(self):
87 | self.notify('has_finished', False)
88 | self.notify('test_correct_rate', 0)
89 | super().run()
90 | self.notify('current_neurons', [{
91 | 'mean': neuron.mean.tolist(),
92 | 'standard_deviation': float(neuron.standard_deviation),
93 | 'synaptic_weight': float(neuron.synaptic_weight)
94 | } for neuron in self._neurons if not neuron.is_threshold])
95 | self.notify('test_correct_rate', self.test())
96 | self.notify('has_finished', True)
97 |
98 | def _iterate(self):
99 | super()._iterate()
100 | # the following line keeps the GUI from blocking
101 | time.sleep(self.ui_refresh_interval)
102 |
103 | @property
104 | def current_learning_rate(self):
105 | ret = super().current_learning_rate
106 | self.notify('current_learning_rate', ret)
107 | return ret
108 |
--------------------------------------------------------------------------------
/nn_sandbox/bridges/som_bridge.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | import PyQt5.QtCore
4 |
5 | from nn_sandbox.backend.algorithms import SomAlgorithm
6 | from . import Bridge, BridgeProperty
7 | from .observer import Observable
8 |
9 |
10 | class SomBridge(Bridge):
11 | ui_refresh_interval = BridgeProperty(0.0)
12 | dataset_dict = BridgeProperty({})
13 | current_dataset_name = BridgeProperty('')
14 | total_epoches = BridgeProperty(10)
15 | initial_learning_rate = BridgeProperty(0.8)
16 | initial_standard_deviation = BridgeProperty(1.0)
17 | topology_shape = BridgeProperty([])
18 | current_iterations = BridgeProperty(0)
19 | current_learning_rate = BridgeProperty(0.0)
20 | current_standard_deviation = BridgeProperty(0.0)
21 | has_finished = BridgeProperty(True)
22 | current_synaptic_weights = BridgeProperty([])
23 |
24 | def __init__(self):
25 | super().__init__()
26 | self.som_algorithm = None
27 |
28 | @PyQt5.QtCore.pyqtSlot()
29 | def start_som_algorithm(self):
30 | self.som_algorithm = ObservableSomAlgorithm(
31 | self,
32 | self.ui_refresh_interval,
33 | dataset=self.dataset_dict[self.current_dataset_name],
34 | total_epoches=self.total_epoches,
35 | initial_learning_rate=self.initial_learning_rate,
36 | initial_standard_deviation=self.initial_standard_deviation,
37 | topology_shape=self.topology_shape
38 | )
39 | self.som_algorithm.start()
40 |
41 | @PyQt5.QtCore.pyqtSlot()
42 | def stop_som_algorithm(self):
43 | self.som_algorithm.stop()
44 |
45 |
46 | class ObservableSomAlgorithm(Observable, SomAlgorithm):
47 | def __init__(self, observer, ui_refresh_interval, **kwargs):
48 | Observable.__init__(self, observer)
49 | SomAlgorithm.__init__(self, **kwargs)
50 | self.ui_refresh_interval = ui_refresh_interval
51 |
52 | def __setattr__(self, name, value):
53 | super().__setattr__(name, value)
54 | if name == 'current_iterations':
55 | self.notify(name, value)
56 | self.notify('current_synaptic_weights',
57 | [[neuron.synaptic_weight.tolist()
58 | for neuron in row] for row in self._neurons])
59 |
60 | def run(self):
61 | self.notify('has_finished', False)
62 | super().run()
63 | self.notify('has_finished', True)
64 |
65 | def _iterate(self):
66 | super()._iterate()
67 | # the following line keeps the GUI from blocking
68 | time.sleep(self.ui_refresh_interval)
69 |
70 | @property
71 | def current_learning_rate(self):
72 | ret = super().current_learning_rate
73 | self.notify('current_learning_rate', ret)
74 | return ret
75 |
76 | @property
77 | def current_standard_deviation(self):
78 | ret = super().current_standard_deviation
79 | self.notify('current_standard_deviation', ret)
80 | return ret
81 |
--------------------------------------------------------------------------------
/nn_sandbox/frontend/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/seanwu1105/neural-network-sandbox/bebac433f1eb9aa16e17d13c6034319c1ee7fff4/nn_sandbox/frontend/__init__.py
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/DataChart.qml:
--------------------------------------------------------------------------------
1 | import QtQuick.Controls 2.5
2 | import QtCharts 2.3
3 |
4 | ChartView {
5 | property var scatterSeriesMap: ({})
6 | property alias xAxis: xAxis
7 | property alias yAxis: yAxis
8 | property alias chartToolTip: chartToolTip
9 |
10 |
11 | antialiasing: true
12 | legend.visible: false
13 | ValueAxis{
14 | id: xAxis
15 | min: -1.0
16 | max: 1.0
17 | }
18 | ValueAxis{
19 | id: yAxis
20 | min: -1.0
21 | max: 1.0
22 | }
23 | ToolTip {
24 | id: chartToolTip
25 | }
26 |
27 | function updateDataset(dataset) {
28 | clear()
29 | addScatterSeries(dataset)
30 | updateAxesRange(dataset)
31 | }
32 |
33 | function updateTrainingDataset(dataset) {
34 | addScatterSeries(dataset)
35 | }
36 |
37 | function updateTestingDataset(dataset) {
38 | dataset.sort((a, b) => {return a[2] - b[2]})
39 | for (let data of dataset) {
40 | if (!(`${data[2]}test` in scatterSeriesMap)) {
41 | scatterSeriesMap[`${data[2]}test`] = createHoverableScatterSeries(`${data[2]}test`)
42 | if (data[2] in scatterSeriesMap)
43 | scatterSeriesMap[`${data[2]}test`].color = Qt.lighter(scatterSeriesMap[data[2]].color)
44 | }
45 | scatterSeriesMap[`${data[2]}test`].append(...data)
46 | }
47 | }
48 |
49 | function addScatterSeries(dataset) {
50 | dataset.sort((a, b) => {return a[2] - b[2]})
51 | for (let data of dataset) {
52 | if (!(data[2] in scatterSeriesMap))
53 | scatterSeriesMap[data[2]] = createHoverableScatterSeries(data[2])
54 | scatterSeriesMap[data[2]].append(...data)
55 | }
56 | }
57 |
58 | function createHoverableScatterSeries(name) {
59 | const newSeries = createSeries(
60 | ChartView.SeriesTypeScatter, name, xAxis, yAxis
61 | )
62 | newSeries.hovered.connect((point, state) => {
63 | const position = mapToPosition(point)
64 | chartToolTip.x = position.x - chartToolTip.width
65 | chartToolTip.y = position.y - chartToolTip.height
66 | chartToolTip.text = `(${point.x}, ${point.y})`
67 | chartToolTip.visible = state
68 | })
69 | return newSeries
70 | }
71 |
72 | function updateAxesRange(dataset) {
73 | let xMax = -Infinity, yMax = -Infinity, xMin = Infinity, yMin = Infinity
74 | for (let row of dataset) {
75 | xMax = Math.max(xMax, row[0])
76 | xMin = Math.min(xMin, row[0])
77 | yMax = Math.max(yMax, row[1])
78 | yMin = Math.min(yMin, row[1])
79 | }
80 | xAxis.max = xMax + 0.1 * (xMax - xMin)
81 | xAxis.min = xMin - 0.1 * (xMax - xMin)
82 | yAxis.max = yMax + 0.1 * (yMax - yMin)
83 | yAxis.min = yMin - 0.1 * (yMax - yMin)
84 | }
85 |
86 | function clear() {
87 | removeAllSeries()
88 | scatterSeriesMap = {}
89 | }
90 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/DoubleSpinBox.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.5
3 |
4 | SpinBox {
5 | id: spinbox
6 | value: 0
7 | from: 0
8 | to: 100
9 | stepSize: 1
10 |
11 | property int decimals: 2
12 |
13 |
14 | validator: DoubleValidator {
15 | bottom: Math.min(spinbox.from, spinbox.to)
16 | top: Math.max(spinbox.from, spinbox.to)
17 | }
18 |
19 | textFromValue: (value, locale) => {
20 | return Number(value / 100).toLocaleString(locale, 'f', spinbox.decimals)
21 | }
22 |
23 | valueFromText: (text, locale) => {
24 | return Number.fromLocaleString(locale, text) * 100
25 | }
26 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/ExecutionControls.qml:
--------------------------------------------------------------------------------
1 | import QtQuick.Controls 2.5
2 | import QtQuick.Layouts 1.12
3 |
4 | Pane {
5 | property alias startButton: startButton
6 | property alias stopButton: stopButton
7 | property alias progressBar: progressBar
8 |
9 | ColumnLayout {
10 | anchors.fill: parent
11 | RowLayout {
12 | RoundButton {
13 | id: startButton
14 | icon.source: '../../assets/images/baseline-play_arrow-24px.svg'
15 | radius: 0
16 | ToolTip.visible: hovered
17 | ToolTip.text: 'Start Training'
18 | }
19 | RoundButton {
20 | id: stopButton
21 | icon.source: '../../assets/images/baseline-stop-24px.svg'
22 | radius: 0
23 | ToolTip.visible: hovered
24 | ToolTip.text: 'Stop Training'
25 | }
26 | }
27 | ProgressBar {
28 | id: progressBar
29 | Layout.fillWidth: true
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/NetworkSetting.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.13
2 | import QtQuick.Controls 2.5
3 | import QtQuick.Layouts 1.12
4 |
5 | GridLayout {
6 | property int totalLayers: 6
7 | property var shape: []
8 |
9 | anchors.fill: parent
10 | columns: 3
11 | Label {
12 | text: 'Number of Layers'
13 | Layout.alignment: Qt.AlignHCenter
14 | }
15 | Slider {
16 | id: slider
17 | from: 1
18 | to: totalLayers
19 | value: 2
20 | stepSize: 1
21 | onValueChanged: updateShape()
22 | Layout.fillWidth: true
23 | }
24 | Label {
25 | text: slider.value
26 | Layout.alignment: Qt.AlignHCenter
27 | }
28 | Label {
29 | text: 'Number of Neurons each Layer'
30 | Layout.alignment: Qt.AlignHCenter
31 | Layout.columnSpan: 3
32 | }
33 | GridLayout {
34 | columns: totalLayers / 2
35 | Repeater {
36 | id: repeater
37 | model: totalLayers
38 | RowLayout {
39 | property alias neuronCount: spinbox.value
40 | enabled: slider.value >= index + 1
41 | Label { text: index + 1 }
42 | SpinBox {
43 | id: spinbox
44 | from: 1
45 | to: 100
46 | value: 5
47 | onValueChanged: updateShape()
48 | Layout.fillWidth: true
49 | }
50 | Layout.fillWidth: true
51 | Layout.fillHeight: true
52 | }
53 | }
54 | Layout.columnSpan: 3
55 | Layout.fillWidth: true
56 | Layout.fillHeight: true
57 | }
58 | function updateShape() {
59 | const newShape = []
60 | for (let i = 0; i < slider.value; i++) {
61 | newShape.push(repeater.itemAt(i).neuronCount)
62 | }
63 | shape = newShape
64 | }
65 | Component.onCompleted: updateShape()
66 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/NoteBook.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.13
2 | import QtQuick.Controls 2.5
3 | import QtQuick.Layouts 1.12
4 |
5 | ColumnLayout {
6 | default property list- pages
7 |
8 | anchors.fill: parent
9 | TabBar {
10 | id: bar
11 | Layout.fillWidth: true
12 |
13 | Repeater {
14 | model: pages.length
15 | TabButton { text: pages[index].name }
16 | }
17 | }
18 | StackLayout {
19 | Layout.fillWidth: true
20 | currentIndex: bar.currentIndex
21 | data: pages
22 | }
23 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/Page.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.5
3 | import QtQuick.Layouts 1.12
4 |
5 | // TODO: after Qt 5.13 release, switch to SplitView for better adjustability.
6 | // XXX: even after PyQt and Qt 5.13 has released, it still can NOT find SplitView type, which seems to be a bug.
7 |
8 | RowLayout {
9 | property string name
10 | property int toFixedValue: 8
11 |
12 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/RateChart.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.5
3 | import QtCharts 2.3
4 |
5 | ChartView {
6 | id: chart
7 | property var bestCorrectRate: LineSeries {
8 | axisX: xAxis
9 | axisY: yAxis
10 | useOpenGL: true
11 | }
12 | property var trainingCorrectRate: LineSeries {
13 | axisX: xAxis
14 | axisY: yAxis
15 | useOpenGL: true
16 | }
17 | property var testingCorrectRate: LineSeries {
18 | axisX: xAxis
19 | axisY: yAxis
20 | useOpenGL: true
21 | }
22 |
23 | antialiasing: true
24 |
25 | ValueAxis{
26 | id: xAxis
27 | titleText: 'Iterations'
28 | min: 1.0
29 | max: 2.0
30 | }
31 | ValueAxis{
32 | id: yAxis
33 | titleText: 'Correct Rate'
34 | min: 0.0
35 | max: 1.0
36 | }
37 |
38 | function updateAxes(point) {
39 | xAxis.max = Math.max(xAxis.max, point.x)
40 | xAxis.min = Math.min(xAxis.min, point.x)
41 | }
42 |
43 | function reset() {
44 | removeAllSeries()
45 | trainingCorrectRate = createSeries(
46 | ChartView.SeriesTypeLine, 'Training', xAxis, yAxis
47 | )
48 | trainingCorrectRate.pointAdded.connect((index) => {
49 | updateAxes(trainingCorrectRate.at(index))
50 | })
51 | testingCorrectRate = createSeries(
52 | ChartView.SeriesTypeLine, 'Testing', xAxis, yAxis
53 | )
54 | testingCorrectRate.pointAdded.connect((index) => {
55 | updateAxes(testingCorrectRate.at(index))
56 | })
57 | bestCorrectRate = createSeries(
58 | ChartView.SeriesTypeLine, 'Best Training', xAxis, yAxis
59 | )
60 | bestCorrectRate.pointAdded.connect((index) => {
61 | updateAxes(bestCorrectRate.at(index))
62 | })
63 | xAxis.max = 1
64 | xAxis.min = 0
65 | yAxis.max = 1
66 | yAxis.min = 0
67 | }
68 |
69 | Component.onCompleted: reset()
70 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/dashboards/Mlp.qml:
--------------------------------------------------------------------------------
1 | import QtQml 2.12
2 | import QtQuick 2.12
3 | import QtQuick.Controls 2.5
4 | import QtQuick.Layouts 1.12
5 |
6 | import '..'
7 |
8 | Page {
9 | name: 'MLP'
10 | ColumnLayout {
11 | GroupBox {
12 | title: 'Dataset'
13 | Layout.fillWidth: true
14 | ComboBox {
15 | id: datasetCombobox
16 | anchors.fill: parent
17 | model: Object.keys(mlpBridge.dataset_dict)
18 | enabled: mlpBridge.has_finished
19 | onActivated: () => {
20 | mlpBridge.current_dataset_name = currentText
21 | dataChart.updateDataset(mlpBridge.dataset_dict[datasetCombobox.currentText])
22 | }
23 | Component.onCompleted: () => {
24 | mlpBridge.current_dataset_name = currentText
25 | dataChart.updateDataset(mlpBridge.dataset_dict[datasetCombobox.currentText])
26 | }
27 | }
28 | }
29 | GroupBox {
30 | title: 'Settings'
31 | Layout.fillWidth: true
32 | GridLayout {
33 | anchors.fill: parent
34 | columns: 2
35 | Label {
36 | text: 'Total Training Epoches'
37 | Layout.alignment: Qt.AlignHCenter
38 | }
39 | SpinBox {
40 | id: totalEpoches
41 | enabled: mlpBridge.has_finished
42 | editable: true
43 | value: 10
44 | to: 999999
45 | onValueChanged: mlpBridge.total_epoches = value
46 | Component.onCompleted: mlpBridge.total_epoches = value
47 | Layout.fillWidth: true
48 | }
49 | CheckBox {
50 | id: mostCorrectRateCheckBox
51 | enabled: mlpBridge.has_finished
52 | text: 'Most Correct Rate'
53 | checked: true
54 | onCheckedChanged: mlpBridge.most_correct_rate_checkbox = checked
55 | Component.onCompleted: mlpBridge.most_correct_rate_checkbox = checked
56 | Layout.alignment: Qt.AlignHCenter
57 | }
58 | DoubleSpinBox {
59 | enabled: mostCorrectRateCheckBox.checked && mlpBridge.has_finished
60 | editable: true
61 | value: 1.00 * 100
62 | onValueChanged: mlpBridge.most_correct_rate = value / 100
63 | Component.onCompleted: mlpBridge.most_correct_rate = value / 100
64 | Layout.fillWidth: true
65 | }
66 | Label {
67 | text: 'Initial Learning Rate'
68 | Layout.alignment: Qt.AlignHCenter
69 | }
70 | DoubleSpinBox {
71 | enabled: mlpBridge.has_finished
72 | editable: true
73 | value: 0.8 * 100
74 | onValueChanged: mlpBridge.initial_learning_rate = value / 100
75 | Component.onCompleted: mlpBridge.initial_learning_rate = value / 100
76 | Layout.fillWidth: true
77 | }
78 | Label {
79 | text: 'Search Iteration Constant'
80 | Layout.alignment: Qt.AlignHCenter
81 | }
82 | SpinBox {
83 | enabled: mlpBridge.has_finished
84 | editable: true
85 | value: 10000
86 | to: 999999
87 | onValueChanged: mlpBridge.search_iteration_constant = value
88 | Component.onCompleted: mlpBridge.search_iteration_constant = value
89 | Layout.fillWidth: true
90 | }
91 | Label {
92 | text: 'Momentum Weight'
93 | Layout.alignment: Qt.AlignHCenter
94 | }
95 | DoubleSpinBox {
96 | enabled: mlpBridge.has_finished
97 | editable: true
98 | value: 0.5 * 100
99 | from: 0
100 | to: 99
101 | Layout.fillWidth: true
102 | }
103 | Label {
104 | text: 'Test-Train Ratio'
105 | Layout.alignment: Qt.AlignHCenter
106 | }
107 | DoubleSpinBox {
108 | enabled: mlpBridge.has_finished
109 | editable: true
110 | value: 0.3 * 100
111 | from: 30
112 | to: 90
113 | onValueChanged: mlpBridge.test_ratio = value / 100
114 | Component.onCompleted: mlpBridge.test_ratio = value / 100
115 | Layout.fillWidth: true
116 | }
117 | Label {
118 | text: 'UI Refresh Interval'
119 | Layout.alignment: Qt.AlignHCenter
120 | }
121 | DoubleSpinBox {
122 | enabled: mlpBridge.has_finished
123 | editable: true
124 | value: 0 * 100
125 | from: 0 * 100
126 | to: 5 * 100
127 | onValueChanged: mlpBridge.ui_refresh_interval = value / 100
128 | Component.onCompleted: mlpBridge.ui_refresh_interval = value / 100
129 | Layout.fillWidth: true
130 | }
131 | }
132 | }
133 | GroupBox {
134 | title: 'Network'
135 | Layout.fillWidth: true
136 | NetworkSetting {
137 | enabled: mlpBridge.has_finished
138 | onShapeChanged: mlpBridge.network_shape = shape
139 | Component.onCompleted: mlpBridge.network_shape = shape
140 | }
141 | }
142 | GroupBox {
143 | title: 'Information'
144 | Layout.fillWidth: true
145 | Layout.fillHeight: true
146 | GridLayout {
147 | anchors.left: parent.left
148 | anchors.right: parent.right
149 | columns: 2
150 | ExecutionControls {
151 | startButton.enabled: mlpBridge.has_finished
152 | startButton.onClicked: () => {
153 | mlpBridge.start_mlp_algorithm()
154 | dataChart.clear()
155 | dataChart.updateTrainingDataset(mlpBridge.training_dataset)
156 | dataChart.updateTestingDataset(mlpBridge.testing_dataset)
157 | rateChart.reset()
158 | }
159 | stopButton.enabled: !mlpBridge.has_finished
160 | stopButton.onClicked: mlpBridge.stop_mlp_algorithm()
161 | progressBar.value: (mlpBridge.current_iterations + 1) / (totalEpoches.value * mlpBridge.training_dataset.length)
162 | Layout.columnSpan: 2
163 | Layout.fillWidth: true
164 | }
165 | Label {
166 | text: 'Current Training Epoch'
167 | Layout.alignment: Qt.AlignHCenter
168 | }
169 | Label {
170 | text: currentEpoch()
171 | horizontalAlignment: Text.AlignHCenter
172 | Layout.fillWidth: true
173 | function currentEpoch() {
174 | const epoch = Math.floor(mlpBridge.current_iterations / mlpBridge.training_dataset.length) + 1
175 | if (isNaN(epoch))
176 | return 1
177 | return epoch
178 | }
179 | }
180 | Label {
181 | text: 'Current Training Iteration'
182 | Layout.alignment: Qt.AlignHCenter
183 | }
184 | Label {
185 | text: mlpBridge.current_iterations + 1
186 | horizontalAlignment: Text.AlignHCenter
187 | onTextChanged: () => {
188 | rateChart.bestCorrectRate.append(
189 | mlpBridge.current_iterations + 1,
190 | mlpBridge.best_correct_rate
191 | )
192 | rateChart.trainingCorrectRate.append(
193 | mlpBridge.current_iterations + 1,
194 | mlpBridge.current_correct_rate
195 | )
196 | rateChart.testingCorrectRate.append(
197 | mlpBridge.current_iterations + 1,
198 | mlpBridge.test_correct_rate
199 | )
200 | }
201 | Layout.fillWidth: true
202 | }
203 | Label {
204 | text: 'Current Learning Rate'
205 | Layout.alignment: Qt.AlignHCenter
206 | }
207 | Label {
208 | text: mlpBridge.current_learning_rate.toFixed(toFixedValue)
209 | horizontalAlignment: Text.AlignHCenter
210 | Layout.fillWidth: true
211 | }
212 | Label {
213 | text: 'Best Training Correct Rate'
214 | Layout.alignment: Qt.AlignHCenter
215 | }
216 | Label {
217 | text: mlpBridge.best_correct_rate.toFixed(toFixedValue)
218 | horizontalAlignment: Text.AlignHCenter
219 | Layout.fillWidth: true
220 | }
221 | Label {
222 | text: 'Current Training Correct Rate'
223 | Layout.alignment: Qt.AlignHCenter
224 | }
225 | Label {
226 | text: mlpBridge.current_correct_rate.toFixed(toFixedValue)
227 | horizontalAlignment: Text.AlignHCenter
228 | Layout.fillWidth: true
229 | }
230 | Label {
231 | text: 'Current Testing Correct Rate'
232 | Layout.alignment: Qt.AlignHCenter
233 | }
234 | Label {
235 | text: mlpBridge.test_correct_rate.toFixed(toFixedValue)
236 | horizontalAlignment: Text.AlignHCenter
237 | Layout.fillWidth: true
238 | }
239 | }
240 | }
241 | }
242 | ColumnLayout {
243 | DataChart {
244 | id: dataChart
245 | width: 700
246 | Layout.fillWidth: true
247 | Layout.fillHeight: true
248 | }
249 | RateChart {
250 | id: rateChart
251 | Layout.fillWidth: true
252 | Layout.fillHeight: true
253 | }
254 | }
255 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/dashboards/Perceptron.qml:
--------------------------------------------------------------------------------
1 | import QtQml 2.12
2 | import QtQuick 2.12
3 | import QtQuick.Controls 2.5
4 | import QtQuick.Layouts 1.12
5 | import QtCharts 2.3
6 |
7 | import '..'
8 |
9 | Page {
10 | name: 'Perceptron'
11 | ColumnLayout {
12 | GroupBox {
13 | title: 'Dataset'
14 | Layout.fillWidth: true
15 | ComboBox {
16 | id: datasetCombobox
17 | anchors.fill: parent
18 | model: Object.keys(perceptronBridge.dataset_dict)
19 | enabled: perceptronBridge.has_finished
20 | onActivated: () => {
21 | perceptronBridge.current_dataset_name = currentText
22 | dataChart.updateDataset(perceptronBridge.dataset_dict[datasetCombobox.currentText])
23 | }
24 | Component.onCompleted: () => {
25 | perceptronBridge.current_dataset_name = currentText
26 | dataChart.updateDataset(perceptronBridge.dataset_dict[datasetCombobox.currentText])
27 | }
28 | }
29 | }
30 | GroupBox {
31 | title: 'Settings'
32 | Layout.fillWidth: true
33 | GridLayout {
34 | anchors.fill: parent
35 | columns: 2
36 | Label {
37 | text: 'Total Training Epoches'
38 | Layout.alignment: Qt.AlignHCenter
39 | }
40 | SpinBox {
41 | id: totalEpoches
42 | enabled: perceptronBridge.has_finished
43 | editable: true
44 | value: 5
45 | to: 999999
46 | onValueChanged: perceptronBridge.total_epoches = value
47 | Component.onCompleted: perceptronBridge.total_epoches = value
48 | Layout.fillWidth: true
49 | }
50 | CheckBox {
51 | id: mostCorrectRateCheckBox
52 | enabled: perceptronBridge.has_finished
53 | text: 'Most Correct Rate'
54 | checked: true
55 | onCheckedChanged: perceptronBridge.most_correct_rate_checkbox = checked
56 | Component.onCompleted: perceptronBridge.most_correct_rate_checkbox = checked
57 | Layout.alignment: Qt.AlignHCenter
58 | }
59 | DoubleSpinBox {
60 | enabled: mostCorrectRateCheckBox.checked && perceptronBridge.has_finished
61 | editable: true
62 | value: 1.00 * 100
63 | onValueChanged: perceptronBridge.most_correct_rate = value / 100
64 | Component.onCompleted: perceptronBridge.most_correct_rate = value / 100
65 | Layout.fillWidth: true
66 | }
67 | Label {
68 | text: 'Initial Learning Rate'
69 | Layout.alignment: Qt.AlignHCenter
70 | }
71 | DoubleSpinBox {
72 | enabled: perceptronBridge.has_finished
73 | editable: true
74 | value: 0.5 * 100
75 | onValueChanged: perceptronBridge.initial_learning_rate = value / 100
76 | Component.onCompleted: perceptronBridge.initial_learning_rate = value / 100
77 | Layout.fillWidth: true
78 | }
79 | Label {
80 | text: 'Search Iteration Constant'
81 | Layout.alignment: Qt.AlignHCenter
82 | }
83 | SpinBox {
84 | enabled: perceptronBridge.has_finished
85 | editable: true
86 | value: 1000
87 | to: 999999
88 | onValueChanged: perceptronBridge.search_iteration_constant = value
89 | Component.onCompleted: perceptronBridge.search_iteration_constant = value
90 | Layout.fillWidth: true
91 | }
92 | Label {
93 | text: 'Test-Train Ratio'
94 | Layout.alignment: Qt.AlignHCenter
95 | }
96 | DoubleSpinBox {
97 | enabled: perceptronBridge.has_finished
98 | editable: true
99 | value: 0.3 * 100
100 | from: 30
101 | to: 90
102 | onValueChanged: perceptronBridge.test_ratio = value / 100
103 | Component.onCompleted: perceptronBridge.test_ratio = value / 100
104 | Layout.fillWidth: true
105 | }
106 | Label {
107 | text: 'UI Refresh Interval'
108 | Layout.alignment: Qt.AlignHCenter
109 | }
110 | DoubleSpinBox {
111 | enabled: perceptronBridge.has_finished
112 | editable: true
113 | value: 0 * 100
114 | from: 0 * 100
115 | to: 5 * 100
116 | onValueChanged: perceptronBridge.ui_refresh_interval = value / 100
117 | Component.onCompleted: perceptronBridge.ui_refresh_interval = value / 100
118 | Layout.fillWidth: true
119 | }
120 | }
121 | }
122 | GroupBox {
123 | title: 'Information'
124 | Layout.fillWidth: true
125 | Layout.fillHeight: true
126 | GridLayout {
127 | anchors.left: parent.left
128 | anchors.right: parent.right
129 | columns: 2
130 | ExecutionControls {
131 | startButton.enabled: perceptronBridge.has_finished
132 | startButton.onClicked: () => {
133 | perceptronBridge.start_perceptron_algorithm()
134 | dataChart.clear()
135 | dataChart.updateTrainingDataset(perceptronBridge.training_dataset)
136 | dataChart.updateTestingDataset(perceptronBridge.testing_dataset)
137 | rateChart.reset()
138 | }
139 | stopButton.enabled: !perceptronBridge.has_finished
140 | stopButton.onClicked: perceptronBridge.stop_perceptron_algorithm()
141 | progressBar.value: (perceptronBridge.current_iterations + 1) / (totalEpoches.value * perceptronBridge.training_dataset.length)
142 | Layout.columnSpan: 2
143 | Layout.fillWidth: true
144 | }
145 | Label {
146 | text: 'Current Training Epoch'
147 | Layout.alignment: Qt.AlignHCenter
148 | }
149 | Label {
150 | text: currentEpoch()
151 | horizontalAlignment: Text.AlignHCenter
152 | Layout.fillWidth: true
153 | function currentEpoch() {
154 | const epoch = Math.floor(perceptronBridge.current_iterations / perceptronBridge.training_dataset.length) + 1
155 | if (isNaN(epoch))
156 | return 1
157 | return epoch
158 | }
159 | }
160 | Label {
161 | text: 'Current Training Iteration'
162 | Layout.alignment: Qt.AlignHCenter
163 | }
164 | Label {
165 | text: perceptronBridge.current_iterations + 1
166 | horizontalAlignment: Text.AlignHCenter
167 | onTextChanged: () => {
168 | dataChart.updateLineSeries()
169 | rateChart.bestCorrectRate.append(
170 | perceptronBridge.current_iterations + 1,
171 | perceptronBridge.best_correct_rate
172 | )
173 | rateChart.trainingCorrectRate.append(
174 | perceptronBridge.current_iterations + 1,
175 | perceptronBridge.current_correct_rate
176 | )
177 | rateChart.testingCorrectRate.append(
178 | perceptronBridge.current_iterations + 1,
179 | perceptronBridge.test_correct_rate
180 | )
181 | }
182 | Layout.fillWidth: true
183 | }
184 | Label {
185 | text: 'Current Learning Rate'
186 | Layout.alignment: Qt.AlignHCenter
187 | }
188 | Label {
189 | text: perceptronBridge.current_learning_rate.toFixed(toFixedValue)
190 | horizontalAlignment: Text.AlignHCenter
191 | Layout.fillWidth: true
192 | }
193 | Label {
194 | text: 'Best Training Correct Rate'
195 | Layout.alignment: Qt.AlignHCenter
196 | }
197 | Label {
198 | text: perceptronBridge.best_correct_rate.toFixed(toFixedValue)
199 | horizontalAlignment: Text.AlignHCenter
200 | Layout.fillWidth: true
201 | }
202 | Label {
203 | text: 'Current Training Correct Rate'
204 | Layout.alignment: Qt.AlignHCenter
205 | }
206 | Label {
207 | text: perceptronBridge.current_correct_rate.toFixed(toFixedValue)
208 | horizontalAlignment: Text.AlignHCenter
209 | Layout.fillWidth: true
210 | }
211 | Label {
212 | text: 'Current Testing Correct Rate'
213 | Layout.alignment: Qt.AlignHCenter
214 | }
215 | Label {
216 | text: perceptronBridge.test_correct_rate.toFixed(toFixedValue)
217 | horizontalAlignment: Text.AlignHCenter
218 | Layout.fillWidth: true
219 | }
220 | }
221 | }
222 | }
223 | ColumnLayout {
224 | DataChart {
225 | id: dataChart
226 | property var perceptronLines: []
227 | width: 600
228 | Layout.fillWidth: true
229 | Layout.fillHeight: true
230 |
231 | function updateLineSeries() {
232 | perceptronLines.forEach(line => {removeSeries(line)})
233 | perceptronLines = []
234 |
235 | let x1, y1, x2, y2
236 | for (let [idx, synaptic_weight] of perceptronBridge.current_synaptic_weights.entries()) {
237 | if (Math.abs(synaptic_weight[1]) < Math.abs(synaptic_weight[2])) {
238 | // the absolute value of slope < 1, and the coordinate-x
239 | // reaches the edge of chart view first.
240 | x1 = xAxis.min
241 | x2 = xAxis.max
242 | y1 = (synaptic_weight[0] - synaptic_weight[1] * x1) / synaptic_weight[2]
243 | y2 = (synaptic_weight[0] - synaptic_weight[1] * x2) / synaptic_weight[2]
244 | } else if (Math.abs(synaptic_weight[1]) > Math.abs(synaptic_weight[2])) {
245 | // the absolute value of slope > 1, and the coordinate-y
246 | // reaches the edge of chart view first.
247 | y1 = yAxis.min
248 | y2 = yAxis.max
249 | x1 = (synaptic_weight[0] - synaptic_weight[2] * y1) / synaptic_weight[1]
250 | x2 = (synaptic_weight[0] - synaptic_weight[2] * y2) / synaptic_weight[1]
251 | }
252 | const line = createHoverablePerceptronLine(
253 | `Perceptron ${idx}`,
254 | synaptic_weight
255 | )
256 | line.append(x1, y1)
257 | line.append(x2, y2)
258 | perceptronLines.push(line)
259 | }
260 | }
261 |
262 | function createHoverablePerceptronLine(name, text) {
263 | const newSeries = createSeries(
264 | ChartView.SeriesTypeLine, name, xAxis, yAxis
265 | )
266 | newSeries.hovered.connect((point, state) => {
267 | const position = mapToPosition(point)
268 | chartToolTip.x = position.x - chartToolTip.width
269 | chartToolTip.y = position.y - chartToolTip.height
270 | chartToolTip.text = JSON.stringify(text)
271 | chartToolTip.visible = state
272 | })
273 | newSeries.useOpenGL = true
274 | return newSeries
275 | }
276 |
277 | // XXX: sadly, QML does not have `super` access to the base class. Thus,
278 | // we cannot call super method in overridden methods.
279 | // Further details: https://bugreports.qt.io/browse/QTBUG-25942
280 | function clear() {
281 | removeAllSeries()
282 | scatterSeriesMap = {}
283 | perceptronLines = []
284 | }
285 | }
286 |
287 | RateChart {
288 | id: rateChart
289 | Layout.fillWidth: true
290 | Layout.fillHeight: true
291 | }
292 | }
293 |
294 | Connections {
295 | target: perceptronBridge
296 | // update the chart line series to the best synaptic weight at the end
297 | // of the training.
298 | onHas_finishedChanged: dataChart.updateLineSeries()
299 | }
300 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/dashboards/Rbfn.qml:
--------------------------------------------------------------------------------
1 | import QtQml 2.13
2 | import QtQuick 2.12
3 | import QtQuick.Controls 2.5
4 | import QtQuick.Layouts 1.12
5 | import QtCharts 2.3
6 |
7 | import '..'
8 |
9 | Page {
10 | name: 'RBFN'
11 | ColumnLayout {
12 | GroupBox {
13 | title: 'Dataset'
14 | Layout.fillWidth: true
15 | ComboBox {
16 | id: datasetCombobox
17 | anchors.fill: parent
18 | model: Object.keys(rbfnBridge.dataset_dict)
19 | enabled: rbfnBridge.has_finished
20 | onActivated: () => {
21 | rbfnBridge.current_dataset_name = currentText
22 | dataChart.updateDataset(rbfnBridge.dataset_dict[datasetCombobox.currentText])
23 | }
24 | Component.onCompleted: () => {
25 | rbfnBridge.current_dataset_name = currentText
26 | dataChart.updateDataset(rbfnBridge.dataset_dict[datasetCombobox.currentText])
27 | }
28 | }
29 | }
30 | GroupBox {
31 | title: 'Settings'
32 | Layout.fillWidth: true
33 | GridLayout {
34 | anchors.fill: parent
35 | columns: 2
36 | Label {
37 | text: 'Total Training Epoches'
38 | Layout.alignment: Qt.AlignHCenter
39 | }
40 | SpinBox {
41 | id: totalEpoches
42 | enabled: rbfnBridge.has_finished
43 | editable: true
44 | value: 10
45 | to: 999999
46 | onValueChanged: rbfnBridge.total_epoches = value
47 | Component.onCompleted: rbfnBridge.total_epoches = value
48 | Layout.fillWidth: true
49 | }
50 | CheckBox {
51 | id: mostCorrectRateCheckBox
52 | enabled: rbfnBridge.has_finished
53 | text: 'Most Correct Rate'
54 | checked: true
55 | onCheckedChanged: rbfnBridge.most_correct_rate_checkbox = checked
56 | Component.onCompleted: rbfnBridge.most_correct_rate_checkbox = checked
57 | Layout.alignment: Qt.AlignHCenter
58 | }
59 | DoubleSpinBox {
60 | enabled: mostCorrectRateCheckBox.checked && rbfnBridge.has_finished
61 | editable: true
62 | value: 1.00 * 100
63 | onValueChanged: rbfnBridge.most_correct_rate = value / 100
64 | Component.onCompleted: rbfnBridge.most_correct_rate = value / 100
65 | Layout.fillWidth: true
66 | }
67 | Label {
68 | text: 'Acceptable Range (±)'
69 | Layout.alignment: Qt.AlignHCenter
70 | }
71 | DoubleSpinBox {
72 | enabled: rbfnBridge.has_finished
73 | editable: true
74 | value: 0.5 * 100
75 | to: 999999 * 100
76 | onValueChanged: rbfnBridge.acceptable_range = value / 100
77 | Component.onCompleted: rbfnBridge.acceptable_range = value / 100
78 | Layout.fillWidth: true
79 | }
80 | Label {
81 | text: 'Initial Learning Rate'
82 | Layout.alignment: Qt.AlignHCenter
83 | }
84 | DoubleSpinBox {
85 | enabled: rbfnBridge.has_finished
86 | editable: true
87 | value: 0.8 * 100
88 | onValueChanged: rbfnBridge.initial_learning_rate = value / 100
89 | Component.onCompleted: rbfnBridge.initial_learning_rate = value / 100
90 | Layout.fillWidth: true
91 | }
92 | Label {
93 | text: 'Search Iteration Constant'
94 | Layout.alignment: Qt.AlignHCenter
95 | }
96 | SpinBox {
97 | enabled: rbfnBridge.has_finished
98 | editable: true
99 | value: 10000
100 | to: 999999
101 | onValueChanged: rbfnBridge.search_iteration_constant = value
102 | Component.onCompleted: rbfnBridge.search_iteration_constant = value
103 | Layout.fillWidth: true
104 | }
105 | Label {
106 | text: 'Number of K-Means Clusters'
107 | Layout.alignment: Qt.AlignHCenter
108 | }
109 | SpinBox {
110 | id: clusterCount
111 | enabled: rbfnBridge.has_finished
112 | editable: true
113 | value: 3
114 | from: 1
115 | to: Math.ceil((rbfnBridge.dataset_dict[datasetCombobox.currentText].length) * (1 - rbfnBridge.test_ratio))
116 | onValueChanged: rbfnBridge.cluster_count = value
117 | Component.onCompleted: rbfnBridge.cluster_count = value
118 | Layout.fillWidth: true
119 | }
120 | Label {
121 | text: 'Test-Train Ratio'
122 | Layout.alignment: Qt.AlignHCenter
123 | }
124 | DoubleSpinBox {
125 | enabled: rbfnBridge.has_finished
126 | editable: true
127 | value: 0.3 * 100
128 | from: 30
129 | to: 90
130 | onValueChanged: rbfnBridge.test_ratio = value / 100
131 | Component.onCompleted: rbfnBridge.test_ratio = value / 100
132 | Layout.fillWidth: true
133 | }
134 | Label {
135 | text: 'UI Refresh Interval'
136 | Layout.alignment: Qt.AlignHCenter
137 | }
138 | DoubleSpinBox {
139 | enabled: rbfnBridge.has_finished
140 | editable: true
141 | value: 0.1 * 100
142 | from: 0 * 100
143 | to: 5 * 100
144 | onValueChanged: rbfnBridge.ui_refresh_interval = value / 100
145 | Component.onCompleted: rbfnBridge.ui_refresh_interval = value / 100
146 | Layout.fillWidth: true
147 | }
148 | }
149 | }
150 | GroupBox {
151 | title: 'Information'
152 | Layout.fillWidth: true
153 | Layout.fillHeight: true
154 | GridLayout {
155 | anchors.left: parent.left
156 | anchors.right: parent.right
157 | columns: 2
158 | ExecutionControls {
159 | startButton.enabled: rbfnBridge.has_finished
160 | startButton.onClicked: () => {
161 | rbfnBridge.start_rbfn_algorithm()
162 | dataChart.clear()
163 | dataChart.updateTrainingDataset(rbfnBridge.training_dataset)
164 | dataChart.updateTestingDataset(rbfnBridge.testing_dataset)
165 | rateChart.reset()
166 | }
167 | stopButton.enabled: !rbfnBridge.has_finished
168 | stopButton.onClicked: rbfnBridge.stop_rbfn_algorithm()
169 | progressBar.value: (rbfnBridge.current_iterations + 1) / (totalEpoches.value * rbfnBridge.training_dataset.length)
170 | Layout.columnSpan: 2
171 | Layout.fillWidth: true
172 | }
173 | Label {
174 | text: 'Current Training Epoch'
175 | Layout.alignment: Qt.AlignHCenter
176 | }
177 | Label {
178 | text: currentEpoch()
179 | horizontalAlignment: Text.AlignHCenter
180 | Layout.fillWidth: true
181 | function currentEpoch() {
182 | const epoch = Math.floor(rbfnBridge.current_iterations / rbfnBridge.training_dataset.length) + 1
183 | if (isNaN(epoch))
184 | return 1
185 | return epoch
186 | }
187 | }
188 | Label {
189 | text: 'Current Training Iteration'
190 | Layout.alignment: Qt.AlignHCenter
191 | }
192 | Label {
193 | text: rbfnBridge.current_iterations + 1
194 | horizontalAlignment: Text.AlignHCenter
195 | onTextChanged: () => {
196 | dataChart.updateNeurons()
197 | neuronChart.updateAxisY()
198 | rateChart.bestCorrectRate.append(
199 | rbfnBridge.current_iterations + 1,
200 | rbfnBridge.best_correct_rate
201 | )
202 | rateChart.trainingCorrectRate.append(
203 | rbfnBridge.current_iterations + 1,
204 | rbfnBridge.current_correct_rate
205 | )
206 | rateChart.testingCorrectRate.append(
207 | rbfnBridge.current_iterations + 1,
208 | rbfnBridge.test_correct_rate
209 | )
210 | }
211 | Layout.fillWidth: true
212 | }
213 | Label {
214 | text: 'Current Learning Rate'
215 | Layout.alignment: Qt.AlignHCenter
216 | }
217 | Label {
218 | text: rbfnBridge.current_learning_rate.toFixed(toFixedValue)
219 | horizontalAlignment: Text.AlignHCenter
220 | Layout.fillWidth: true
221 | }
222 | Label {
223 | text: 'Best Training Correct Rate'
224 | Layout.alignment: Qt.AlignHCenter
225 | }
226 | Label {
227 | text: rbfnBridge.best_correct_rate.toFixed(toFixedValue)
228 | horizontalAlignment: Text.AlignHCenter
229 | Layout.fillWidth: true
230 | }
231 | Label {
232 | text: 'Current Training Correct Rate'
233 | Layout.alignment: Qt.AlignHCenter
234 | }
235 | Label {
236 | text: rbfnBridge.current_correct_rate.toFixed(toFixedValue)
237 | horizontalAlignment: Text.AlignHCenter
238 | Layout.fillWidth: true
239 | }
240 | Label {
241 | text: 'Current Testing Correct Rate'
242 | Layout.alignment: Qt.AlignHCenter
243 | }
244 | Label {
245 | text: rbfnBridge.test_correct_rate.toFixed(toFixedValue)
246 | horizontalAlignment: Text.AlignHCenter
247 | Layout.fillWidth: true
248 | }
249 | }
250 | }
251 | }
252 | ColumnLayout {
253 | DataChart {
254 | id: dataChart
255 | property var neuronScatters: []
256 |
257 |
258 | width: 700
259 | Layout.fillWidth: true
260 | Layout.fillHeight: true
261 |
262 | function updateNeurons() {
263 | neuronScatters.forEach(neuron => {removeSeries(neuron)})
264 | neuronScatters = []
265 |
266 | for (let {mean: m, standardDeviation: sd, synapticWeight: sw} of rbfnBridge.current_neurons) {
267 | neuronScatters.push(createHoverableNeuronSeries(m))
268 | }
269 | }
270 |
271 | function createHoverableNeuronSeries(mean) {
272 | const newSeries = createSeries(
273 | ChartView.SeriesTypeScatter, 'center',
274 | xAxis, yAxis
275 | )
276 | newSeries.color = 'black'
277 | newSeries.hovered.connect((point, state) => {
278 | const position = mapToPosition(point)
279 | chartToolTip.x = position.x - chartToolTip.width
280 | chartToolTip.y = position.y - chartToolTip.height
281 | chartToolTip.text = `Mean: (${point.x}, ${point.y})`
282 | chartToolTip.visible = state
283 | })
284 | newSeries.append(...mean)
285 | newSeries.useOpenGL = true
286 | return newSeries
287 | }
288 |
289 | // XXX: sadly, QML does not have `super` access to the base class. Thus,
290 | // we cannot call super method in overridden methods.
291 | // Further details: https://bugreports.qt.io/browse/QTBUG-25942
292 | function clear() {
293 | removeAllSeries()
294 | scatterSeriesMap = {}
295 | neuronScatters = []
296 | }
297 | }
298 | RowLayout {
299 | ChartView {
300 | id: neuronChart
301 | antialiasing: true
302 | Layout.fillWidth: true
303 | Layout.fillHeight: true
304 | ToolTip {
305 | id: neuronChartToolTip
306 | x: (parent.width - width) / 2
307 | y: (parent.height - height) / 2
308 | }
309 | BarSeries {
310 | id: neuronChartSeries
311 | useOpenGL: true
312 | axisX: BarCategoryAxis {
313 | titleText: 'Neurons'
314 | categories: Array.from(Array(clusterCount.value).keys())
315 | }
316 | axisY: ValueAxis {
317 | id: neuronChartAxisY
318 | max: 0
319 | min: 0
320 | }
321 | BarSet {
322 | id: standardDeviationBarSet
323 | label: 'Standard Deviation'
324 | values: rbfnBridge.current_neurons.map(neuron => neuron.standard_deviation)
325 | }
326 | BarSet {
327 | id: synapticWeightBarSet
328 | label: 'Synaptic Weight'
329 | values: rbfnBridge.current_neurons.map(neuron => neuron.synaptic_weight)
330 | }
331 | onHovered: (status, index, barset) => {
332 | neuronChartToolTip.text = barset.at(index)
333 | neuronChartToolTip.visible = status
334 | }
335 | }
336 | function updateAxisY() {
337 | const max = Math.max(0, ...standardDeviationBarSet.values, ...synapticWeightBarSet.values)
338 | const min = Math.min(0, ...standardDeviationBarSet.values, ...synapticWeightBarSet.values)
339 | neuronChartAxisY.max = isFinite(max) ? max : 0
340 | neuronChartAxisY.min = isFinite(min) ? min : 0
341 | }
342 | }
343 | RateChart {
344 | id: rateChart
345 | Layout.fillWidth: true
346 | Layout.fillHeight: true
347 | }
348 | }
349 | }
350 | Connections {
351 | target: rbfnBridge
352 | // update the chart scatter series to the best neurons at the end of the
353 | // training.
354 | onHas_finishedChanged: dataChart.updateNeurons()
355 | }
356 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/components/dashboards/Som.qml:
--------------------------------------------------------------------------------
1 | import QtQml 2.12
2 | import QtQuick 2.12
3 | import QtQuick.Controls 2.5
4 | import QtQuick.Layouts 1.12
5 | import QtCharts 2.3
6 |
7 | import '..'
8 |
9 | Page {
10 | name: 'SOM'
11 | ColumnLayout {
12 | GroupBox {
13 | title: 'Dataset'
14 | Layout.fillWidth: true
15 | ComboBox {
16 | id: datasetCombobox
17 | anchors.fill: parent
18 | model: Object.keys(somBridge.dataset_dict)
19 | enabled: somBridge.has_finished
20 | onActivated: () => {
21 | somBridge.current_dataset_name = currentText
22 | dataChart.updateDataset(somBridge.dataset_dict[datasetCombobox.currentText])
23 | }
24 | Component.onCompleted: () => {
25 | somBridge.current_dataset_name = currentText
26 | dataChart.updateDataset(somBridge.dataset_dict[datasetCombobox.currentText])
27 | }
28 | }
29 | }
30 | GroupBox {
31 | title: 'Settings'
32 | Layout.fillWidth: true
33 | GridLayout {
34 | anchors.fill: parent
35 | columns: 2
36 | Label {
37 | text: 'Total Training Epoches'
38 | Layout.alignment: Qt.AlignHCenter
39 | }
40 | SpinBox {
41 | id: totalEpoches
42 | enabled: somBridge.has_finished
43 | editable: true
44 | value: 10
45 | to: 999999
46 | onValueChanged: somBridge.total_epoches = value
47 | Component.onCompleted: somBridge.total_epoches = value
48 | Layout.fillWidth: true
49 | }
50 | Label {
51 | text: 'Initial Learning Rate'
52 | Layout.alignment: Qt.AlignHCenter
53 | }
54 | DoubleSpinBox {
55 | enabled: somBridge.has_finished
56 | editable: true
57 | value: 0.8 * 100
58 | onValueChanged: somBridge.initial_learning_rate = value / 100
59 | Component.onCompleted: somBridge.initial_learning_rate = value / 100
60 | Layout.fillWidth: true
61 | }
62 | Label {
63 | text: 'Initial Standard Deviation'
64 | Layout.alignment: Qt.AlignHCenter
65 | }
66 | DoubleSpinBox {
67 | enabled: somBridge.has_finished
68 | editable: true
69 | value: 1 * 100
70 | from: 0.01 * 100
71 | to: 99999 * 100
72 | onValueChanged: somBridge.initial_standard_deviation = value / 100
73 | Component.onCompleted: somBridge.initial_standard_deviation = value / 100
74 | Layout.fillWidth: true
75 | }
76 | Label {
77 | text: 'Topology Shape'
78 | Layout.alignment: Qt.AlignHCenter
79 | }
80 | RowLayout {
81 | Layout.fillWidth: true
82 | SpinBox {
83 | id: topologyRowCount
84 | enabled: somBridge.has_finished
85 | editable: true
86 | value: 10
87 | from: 1
88 | to: 999
89 | onValueChanged: somBridge.topology_shape = [value, topologyColumnCount.value]
90 | Component.onCompleted: somBridge.topology_shape = [value, topologyColumnCount.value]
91 | Layout.fillWidth: true
92 | }
93 | Label { text: '*' }
94 | SpinBox {
95 | id: topologyColumnCount
96 | enabled: somBridge.has_finished
97 | editable: true
98 | value: 10
99 | from: 1
100 | to: 999
101 | onValueChanged: somBridge.topology_shape = [topologyRowCount.value, value]
102 | Component.onCompleted: somBridge.topology_shape = [topologyRowCount.value, value]
103 | Layout.fillWidth: true
104 | }
105 | }
106 | Label {
107 | text: 'UI Refresh Interval'
108 | Layout.alignment: Qt.AlignHCenter
109 | }
110 | DoubleSpinBox {
111 | enabled: somBridge.has_finished
112 | editable: true
113 | value: 0.05 * 100
114 | from: 0 * 100
115 | to: 5 * 100
116 | onValueChanged: somBridge.ui_refresh_interval = value / 100
117 | Component.onCompleted: somBridge.ui_refresh_interval = value / 100
118 | Layout.fillWidth: true
119 | }
120 | }
121 | }
122 | GroupBox {
123 | title: 'Information'
124 | Layout.fillWidth: true
125 | Layout.fillHeight: true
126 | GridLayout {
127 | anchors.left: parent.left
128 | anchors.right: parent.right
129 | columns: 2
130 | ExecutionControls {
131 | startButton.enabled: somBridge.has_finished
132 | startButton.onClicked: somBridge.start_som_algorithm()
133 | stopButton.enabled: !somBridge.has_finished
134 | stopButton.onClicked: somBridge.stop_som_algorithm()
135 | progressBar.value: (somBridge.current_iterations + 1) / (totalEpoches.value * somBridge.dataset_dict[datasetCombobox.currentText].length)
136 | Layout.columnSpan: 2
137 | Layout.fillWidth: true
138 | }
139 | Label {
140 | text: 'Current Training Epoch'
141 | Layout.alignment: Qt.AlignHCenter
142 | }
143 | Label {
144 | text: currentEpoch()
145 | horizontalAlignment: Text.AlignHCenter
146 | Layout.fillWidth: true
147 | function currentEpoch() {
148 | const epoch = Math.floor(somBridge.current_iterations / somBridge.dataset_dict[datasetCombobox.currentText].length) + 1
149 | if (isNaN(epoch))
150 | return 1
151 | return epoch
152 | }
153 | }
154 | Label {
155 | text: 'Current Training Iteration'
156 | Layout.alignment: Qt.AlignHCenter
157 | }
158 | Label {
159 | text: somBridge.current_iterations + 1
160 | horizontalAlignment: Text.AlignHCenter
161 | Layout.fillWidth: true
162 | onTextChanged: () => {
163 | dataChart.updateNeuron()
164 | }
165 | }
166 | Label {
167 | text: 'Current Learning Rate'
168 | Layout.alignment: Qt.AlignHCenter
169 | }
170 | Label {
171 | text: somBridge.current_learning_rate.toFixed(toFixedValue)
172 | horizontalAlignment: Text.AlignHCenter
173 | Layout.fillWidth: true
174 | }
175 | Label {
176 | text: 'Current Standard Deviation'
177 | Layout.alignment: Qt.AlignHCenter
178 | }
179 | Label {
180 | text: somBridge.current_standard_deviation.toFixed(toFixedValue)
181 | horizontalAlignment: Text.AlignHCenter
182 | Layout.fillWidth: true
183 | }
184 | }
185 | }
186 | }
187 | ColumnLayout {
188 | DataChart {
189 | id: dataChart
190 | property var neuronScatter
191 | property var neuronTopology: []
192 |
193 | width: 700
194 | Layout.fillWidth: true
195 | Layout.fillHeight: true
196 |
197 | function updateNeuron() {
198 | updateNeuronTopology()
199 | updateNeuronScatter()
200 | }
201 |
202 | function updateNeuronScatter() {
203 | if (neuronScatter) {
204 | removeSeries(neuronScatter)
205 | }
206 | neuronScatter = createHoverableScatterSeries('SOM')
207 | neuronScatter.color = 'black'
208 | for (let row of somBridge.current_synaptic_weights) {
209 | for (let synaptic_weight of row) {
210 | neuronScatter.append(...synaptic_weight)
211 | }
212 | }
213 | }
214 |
215 | function updateNeuronTopology() {
216 | neuronTopology.forEach(line => {removeSeries(line)})
217 | neuronTopology = []
218 | createMapLines(somBridge.current_synaptic_weights)
219 | if (somBridge.current_synaptic_weights[0]) {
220 | const transposed = somBridge.current_synaptic_weights[0].map(
221 | (col, i) => somBridge.current_synaptic_weights.map(row => row[i])
222 | )
223 | createMapLines(transposed)
224 | }
225 | }
226 |
227 | function createMapLines(synaptic_weights) {
228 | for (let row of synaptic_weights) {
229 | const line = createSeries(
230 | ChartView.SeriesTypeLine, name, xAxis, yAxis
231 | )
232 | line.color = 'grey'
233 | neuronTopology.push(line)
234 | for (let synaptic_weight of row) {
235 | line.append(...synaptic_weight)
236 | }
237 | }
238 | }
239 |
240 | // XXX: sadly, QML does not have `super` access to the base class. Thus,
241 | // we cannot call super method in overridden methods.
242 | // Further details: https://bugreports.qt.io/browse/QTBUG-25942
243 | function clear() {
244 | removeAllSeries()
245 | scatterSeriesMap = {}
246 | neuronTopology = []
247 | }
248 | }
249 | }
250 | }
--------------------------------------------------------------------------------
/nn_sandbox/frontend/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.12
3 | import QtQuick.Layouts 1.12
4 |
5 | import 'components'
6 | import 'components/dashboards'
7 |
8 | ApplicationWindow {
9 | id: window
10 | visible: true
11 | title: 'Neuron Network Sandbox'
12 | // XXX: using body.implicitWidth will cause BadValue and BadWindow error in
13 | // Linux (Kubuntu). Need further research. Currently, I use
14 | // Component.onCompleted instead as a workaround.
15 |
16 | Pane {
17 | id: body
18 | anchors.fill: parent
19 | NoteBook {
20 | Perceptron {}
21 | Mlp {}
22 | Rbfn {}
23 | Som {}
24 | }
25 | }
26 |
27 | Component.onCompleted: () => {
28 | width = minimumWidth = body.implicitWidth
29 | height = minimumHeight = body.implicitHeight
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy>=1.16.4
2 | PyQt5>=5.13.0
3 | PyQtChart>=5.13.0
--------------------------------------------------------------------------------