ProbabilisticNN 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. probabilisticnn-0.0.1/LICENCE +19 -0
  2. probabilisticnn-0.0.1/PKG-INFO +344 -0
  3. probabilisticnn-0.0.1/README.md +315 -0
  4. probabilisticnn-0.0.1/pyproject.toml +53 -0
  5. probabilisticnn-0.0.1/setup.cfg +4 -0
  6. probabilisticnn-0.0.1/src/ProbabilisticNN.egg-info/PKG-INFO +344 -0
  7. probabilisticnn-0.0.1/src/ProbabilisticNN.egg-info/SOURCES.txt +35 -0
  8. probabilisticnn-0.0.1/src/ProbabilisticNN.egg-info/dependency_links.txt +1 -0
  9. probabilisticnn-0.0.1/src/ProbabilisticNN.egg-info/requires.txt +39 -0
  10. probabilisticnn-0.0.1/src/ProbabilisticNN.egg-info/top_level.txt +1 -0
  11. probabilisticnn-0.0.1/src/probabilisticnn/__init__.py +0 -0
  12. probabilisticnn-0.0.1/src/probabilisticnn/base/__init__.py +35 -0
  13. probabilisticnn-0.0.1/src/probabilisticnn/base/kernels.py +370 -0
  14. probabilisticnn-0.0.1/src/probabilisticnn/base/loss.py +444 -0
  15. probabilisticnn-0.0.1/src/probabilisticnn/base/optim.py +325 -0
  16. probabilisticnn-0.0.1/src/probabilisticnn/base/types.py +15 -0
  17. probabilisticnn-0.0.1/src/probabilisticnn/base/utils.py +103 -0
  18. probabilisticnn-0.0.1/src/probabilisticnn/common/__init__.py +8 -0
  19. probabilisticnn-0.0.1/src/probabilisticnn/common/pattern_layer.py +215 -0
  20. probabilisticnn-0.0.1/src/probabilisticnn/grnn/__init__.py +8 -0
  21. probabilisticnn-0.0.1/src/probabilisticnn/grnn/grnn.py +207 -0
  22. probabilisticnn-0.0.1/src/probabilisticnn/grnn/layers.py +13 -0
  23. probabilisticnn-0.0.1/src/probabilisticnn/numba_backend/__init__.py +9 -0
  24. probabilisticnn-0.0.1/src/probabilisticnn/numba_backend/inference/__init__.py +7 -0
  25. probabilisticnn-0.0.1/src/probabilisticnn/numba_backend/inference/grnn.py +29 -0
  26. probabilisticnn-0.0.1/src/probabilisticnn/numba_backend/inference/pnn.py +34 -0
  27. probabilisticnn-0.0.1/src/probabilisticnn/numba_backend/kernels.py +458 -0
  28. probabilisticnn-0.0.1/src/probabilisticnn/pnn/__init__.py +8 -0
  29. probabilisticnn-0.0.1/src/probabilisticnn/pnn/layers.py +83 -0
  30. probabilisticnn-0.0.1/src/probabilisticnn/pnn/pnn.py +239 -0
  31. probabilisticnn-0.0.1/tests/test_experiment_utils.py +136 -0
  32. probabilisticnn-0.0.1/tests/test_grnn.py +249 -0
  33. probabilisticnn-0.0.1/tests/test_kernels.py +318 -0
  34. probabilisticnn-0.0.1/tests/test_layers.py +436 -0
  35. probabilisticnn-0.0.1/tests/test_numba_backend.py +391 -0
  36. probabilisticnn-0.0.1/tests/test_optim.py +812 -0
  37. probabilisticnn-0.0.1/tests/test_pnn.py +331 -0
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Grigorii Vinogradov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,344 @@
1
+ Metadata-Version: 2.4
2
+ Name: ProbabilisticNN
3
+ Version: 0.0.1
4
+ Summary: Python package for Probabilistic Neural Networks and General Regression Neural Networks
5
+ Author-email: Grigorii Vinogradov <vinogradov.gr.s@gmail.com>
6
+ License-Expression: MIT
7
+ Keywords: PNN,GRNN,Probabilistic Neural Network,General Regression Neural Network,Machine Learning,Adaptive PNN,Adaptive GRNN,Kernels
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENCE
11
+ Requires-Dist: numpy>=1.26.0; python_version == "3.12"
12
+ Requires-Dist: numpy>=2.1.0; python_version == "3.13"
13
+ Requires-Dist: numpy>=2.3.3; python_version >= "3.14"
14
+ Requires-Dist: scipy>=1.11.2; python_version == "3.12"
15
+ Requires-Dist: scipy>=1.14.1; python_version == "3.13"
16
+ Requires-Dist: scipy>=1.17.0; python_version >= "3.14"
17
+ Requires-Dist: scikit-learn>=1.6.1; python_version < "3.14"
18
+ Requires-Dist: scikit-learn>=1.8.0; python_version >= "3.14"
19
+ Provides-Extra: numba
20
+ Requires-Dist: numba>=0.59.0; python_version == "3.12" and extra == "numba"
21
+ Requires-Dist: numba>=0.61.0; python_version == "3.13" and extra == "numba"
22
+ Requires-Dist: numba>=0.63.0; python_version >= "3.14" and extra == "numba"
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=6; extra == "dev"
25
+ Requires-Dist: numba>=0.59.0; python_version == "3.12" and extra == "dev"
26
+ Requires-Dist: numba>=0.61.0; python_version == "3.13" and extra == "dev"
27
+ Requires-Dist: numba>=0.63.0; python_version >= "3.14" and extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # ProbabilisticNN
31
+
32
+ `ProbabilisticNN` is a Python library for Probabilistic Neural Networks and General Regression Neural Networks with an sklearn-like interface.
33
+
34
+ At the current stage, the library is published on TestPyPI and supports:
35
+
36
+ - `PNN` for classification;
37
+ - `AdaptivePNN` with kernel bandwidth parameter tuning;
38
+ - `GRNN` for regression;
39
+ - `AdaptiveGRNN` with kernel bandwidth optimization;
40
+ - execution using the standard `numpy` implementation;
41
+ - accelerated inference via `numba`.
42
+
43
+ ## Main Features
44
+
45
+ - sklearn-like interface: `fit`, `predict`, `predict_proba`;
46
+ - several kernel functions:
47
+ - `gaussian`;
48
+ - `laplacian`;
49
+ - `exponential`;
50
+ - several kernel bandwidth parameterization schemes for `AdaptivePNN`:
51
+ - `per_feature`;
52
+ - `per_class`;
53
+ - `per_class_per_feature`;
54
+ - accelerated `numba` backend for the computationally heavy part of inference;
55
+ - testing via `pytest` and `tox`.
56
+
57
+ ## Requirements
58
+
59
+ - Python `3.12+`
60
+ - `numpy`
61
+ - `scipy`
62
+ - `scikit-learn`
63
+
64
+ For the accelerated backend, `numba` is additionally required.
65
+
66
+ ## Installation
67
+
68
+ ### Installation from TestPyPI
69
+
70
+ For regular usage without `numba`:
71
+
72
+ ```bash
73
+ python -m pip install \
74
+ --index-url https://test.pypi.org/simple/ \
75
+ --extra-index-url https://pypi.org/simple/ \
76
+ "ProbabilisticNN"
77
+ ```
78
+
79
+ For installation with the `numba` backend:
80
+
81
+ ```bash
82
+ python -m pip install \
83
+ --index-url https://test.pypi.org/simple/ \
84
+ --extra-index-url https://pypi.org/simple/ \
85
+ "ProbabilisticNN[numba]"
86
+ ```
87
+
88
+ For development and testing:
89
+
90
+ ```bash
91
+ python -m pip install \
92
+ --index-url https://test.pypi.org/simple/ \
93
+ --extra-index-url https://pypi.org/simple/ \
94
+ "ProbabilisticNN[dev]"
95
+ ```
96
+
97
+ ### Local Installation from the Repository
98
+
99
+ This requires `setuptools`.
100
+
101
+ ```bash
102
+ python -m build
103
+ python -m pip install -e ".[dev]"
104
+ ```
105
+
106
+ ## Quick Start
107
+
108
+ ### Classification with `PNN`
109
+
110
+ ```python
111
+ import numpy as np
112
+
113
+ from probabilisticnn.pnn import PNN
114
+
115
+ X_train = np.array([
116
+ [0.0, 0.0],
117
+ [0.0, 0.2],
118
+ [1.0, 1.0],
119
+ [1.0, 1.2],
120
+ ])
121
+ y_train = np.array(["class_a", "class_a", "class_b", "class_b"])
122
+
123
+ X_test = np.array([
124
+ [0.0, 0.1],
125
+ [1.0, 1.1],
126
+ ])
127
+
128
+ model = PNN(
129
+ bandwidth=0.25,
130
+ kernel="gaussian",
131
+ normalize=False,
132
+ )
133
+
134
+ model.fit(X_train, y_train)
135
+
136
+ labels = model.predict(X_test)
137
+ proba = model.predict_proba(X_test)
138
+
139
+ print(labels)
140
+ print(proba)
141
+ ```
142
+
143
+ ### Classification with `AdaptivePNN`
144
+
145
+ ```python
146
+ import numpy as np
147
+
148
+ from probabilisticnn.pnn import AdaptivePNN
149
+
150
+ X_train = np.array([
151
+ [0.0, 0.0],
152
+ [0.0, 0.2],
153
+ [1.0, 1.0],
154
+ [1.0, 1.2],
155
+ ])
156
+ y_train = np.array([0, 0, 1, 1])
157
+
158
+ model = AdaptivePNN(
159
+ kernel="gaussian",
160
+ bandwidth_sharing="per_feature",
161
+ loss="correct_class_probability",
162
+ solver="auto",
163
+ normalize=False,
164
+ )
165
+
166
+ model.fit(X_train, y_train)
167
+
168
+ print(model.predict(X_train))
169
+ print(model.predict_proba(X_train))
170
+ print(model.bandwidth_)
171
+ ```
172
+
173
+ ### Regression with `GRNN`
174
+
175
+ ```python
176
+ import numpy as np
177
+
178
+ from probabilisticnn.grnn import GRNN
179
+
180
+ X_train = np.array([
181
+ [0.0, 0.0],
182
+ [0.0, 0.2],
183
+ [1.0, 1.0],
184
+ [1.0, 1.2],
185
+ ])
186
+ y_train = np.array([1.0, 1.1, 3.0, 3.1])
187
+
188
+ X_test = np.array([
189
+ [0.0, 0.1],
190
+ [1.0, 1.1],
191
+ ])
192
+
193
+ model = GRNN(
194
+ bandwidth=0.5,
195
+ kernel="gaussian",
196
+ normalize=False,
197
+ )
198
+
199
+ model.fit(X_train, y_train)
200
+ pred = model.predict(X_test)
201
+
202
+ print(pred)
203
+ ```
204
+
205
+ ### Regression with `AdaptiveGRNN`
206
+
207
+ ```python
208
+ import numpy as np
209
+
210
+ from probabilisticnn.grnn import AdaptiveGRNN
211
+
212
+ X_train = np.array([
213
+ [0.0, 0.0],
214
+ [0.0, 0.2],
215
+ [1.0, 1.0],
216
+ [1.0, 1.2],
217
+ ])
218
+ y_train = np.array([1.0, 1.1, 3.0, 3.1])
219
+
220
+ model = AdaptiveGRNN(
221
+ kernel="gaussian",
222
+ loss="mse",
223
+ solver="auto",
224
+ normalize=False,
225
+ )
226
+
227
+ model.fit(X_train, y_train)
228
+
229
+ print(model.predict(X_train))
230
+ print(model.bandwidth_)
231
+ ```
232
+
233
+ ## Acceleration with `numba`
234
+
235
+ For `PNN`, `AdaptivePNN`, `GRNN`, and `AdaptiveGRNN`, you can choose:
236
+
237
+ - `backend="numpy"` — the main option;
238
+ - `backend="numba"` — the accelerated option.
239
+
240
+ Example:
241
+
242
+ ```python
243
+ from probabilisticnn.pnn import PNN
244
+
245
+ model = PNN(
246
+ bandwidth=0.25,
247
+ kernel="gaussian",
248
+ backend="numba",
249
+ normalize=False,
250
+ )
251
+ ```
252
+
253
+ Important:
254
+
255
+ - the first `predict` call for the `numba` branch may be slower because of JIT compilation;
256
+ - the main speed gain is achieved during the computation of kernel function values;
257
+ - if `numba` is not installed, the `numba` backend will be unavailable.
258
+
259
+ ## Public Interface
260
+
261
+ Models should be imported like this:
262
+
263
+ ```python
264
+ from probabilisticnn.pnn import PNN, AdaptivePNN
265
+ from probabilisticnn.grnn import GRNN, AdaptiveGRNN
266
+ ```
267
+
268
+ ## Model Parameters
269
+
270
+ ### `PNN`
271
+
272
+ Main parameters:
273
+
274
+ - `bandwidth` — fixed kernel bandwidth;
275
+ - `kernel` — kernel type;
276
+ - `losses` — class weighting scheme / misclassification cost for classes;
277
+ - `normalize` — whether to use L2 normalization of inputs;
278
+ - `backend` — `numpy` or `numba`;
279
+ - `compute_dtype` — `auto`, `float32`, `float64`.
280
+
281
+ ### `AdaptivePNN`
282
+
283
+ Additionally supports:
284
+
285
+ - `loss` — optimization objective function;
286
+ - `bandwidth_sharing` — method for defining bandwidth parameters;
287
+ - `max_iter` — maximum number of optimization steps;
288
+ - `solver` — optimization method;
289
+ - `solver_options` — additional optimizer parameters.
290
+
291
+ ### `GRNN`
292
+
293
+ Main parameters:
294
+
295
+ - `bandwidth`;
296
+ - `kernel`;
297
+ - `backend`;
298
+ - `compute_dtype`;
299
+ - `normalize`.
300
+
301
+ ### `AdaptiveGRNN`
302
+
303
+ Additionally supports:
304
+
305
+ - `loss` — loss function for regression;
306
+ - `max_iter`;
307
+ - `solver`;
308
+ - `solver_options`;
309
+ - `normalize`.
310
+
311
+ `AdaptiveGRNN` optimizes the kernel bandwidth using the `per_feature` scheme.
312
+
313
+ ## Testing
314
+
315
+ Preferred way to run tests:
316
+
317
+ ```bash
318
+ tox
319
+ ```
320
+
321
+ Or run a specific test file:
322
+
323
+ ```bash
324
+ pytest tests/test_pnn.py
325
+ ```
326
+
327
+ Since the tests import the installed package, it is most convenient to run them in a prepared environment after installing the dependencies.
328
+
329
+ ## Performance
330
+
331
+ The repository contains separate materials for measuring performance:
332
+
333
+ - [benchmarks/inference_bemchmarks.py](benchmarks/inference_bemchmarks.py)
334
+ - [benchmarks/benchmarking.ipynb](benchmarks/benchmarking.ipynb)
335
+
336
+ ## Examples
337
+
338
+ An additional usage example is located at:
339
+
340
+ - [examples/basic_usage.ipynb](examples/basic_usage.ipynb)
341
+
342
+ ## License
343
+
344
+ The project is distributed under the MIT license. See the [LICENCE](LICENCE) file.
@@ -0,0 +1,315 @@
1
+ # ProbabilisticNN
2
+
3
+ `ProbabilisticNN` is a Python library for Probabilistic Neural Networks and General Regression Neural Networks with an sklearn-like interface.
4
+
5
+ At the current stage, the library is published on TestPyPI and supports:
6
+
7
+ - `PNN` for classification;
8
+ - `AdaptivePNN` with kernel bandwidth parameter tuning;
9
+ - `GRNN` for regression;
10
+ - `AdaptiveGRNN` with kernel bandwidth optimization;
11
+ - execution using the standard `numpy` implementation;
12
+ - accelerated inference via `numba`.
13
+
14
+ ## Main Features
15
+
16
+ - sklearn-like interface: `fit`, `predict`, `predict_proba`;
17
+ - several kernel functions:
18
+ - `gaussian`;
19
+ - `laplacian`;
20
+ - `exponential`;
21
+ - several kernel bandwidth parameterization schemes for `AdaptivePNN`:
22
+ - `per_feature`;
23
+ - `per_class`;
24
+ - `per_class_per_feature`;
25
+ - accelerated `numba` backend for the computationally heavy part of inference;
26
+ - testing via `pytest` and `tox`.
27
+
28
+ ## Requirements
29
+
30
+ - Python `3.12+`
31
+ - `numpy`
32
+ - `scipy`
33
+ - `scikit-learn`
34
+
35
+ For the accelerated backend, `numba` is additionally required.
36
+
37
+ ## Installation
38
+
39
+ ### Installation from TestPyPI
40
+
41
+ For regular usage without `numba`:
42
+
43
+ ```bash
44
+ python -m pip install \
45
+ --index-url https://test.pypi.org/simple/ \
46
+ --extra-index-url https://pypi.org/simple/ \
47
+ "ProbabilisticNN"
48
+ ```
49
+
50
+ For installation with the `numba` backend:
51
+
52
+ ```bash
53
+ python -m pip install \
54
+ --index-url https://test.pypi.org/simple/ \
55
+ --extra-index-url https://pypi.org/simple/ \
56
+ "ProbabilisticNN[numba]"
57
+ ```
58
+
59
+ For development and testing:
60
+
61
+ ```bash
62
+ python -m pip install \
63
+ --index-url https://test.pypi.org/simple/ \
64
+ --extra-index-url https://pypi.org/simple/ \
65
+ "ProbabilisticNN[dev]"
66
+ ```
67
+
68
+ ### Local Installation from the Repository
69
+
70
+ This requires `setuptools`.
71
+
72
+ ```bash
73
+ python -m build
74
+ python -m pip install -e ".[dev]"
75
+ ```
76
+
77
+ ## Quick Start
78
+
79
+ ### Classification with `PNN`
80
+
81
+ ```python
82
+ import numpy as np
83
+
84
+ from probabilisticnn.pnn import PNN
85
+
86
+ X_train = np.array([
87
+ [0.0, 0.0],
88
+ [0.0, 0.2],
89
+ [1.0, 1.0],
90
+ [1.0, 1.2],
91
+ ])
92
+ y_train = np.array(["class_a", "class_a", "class_b", "class_b"])
93
+
94
+ X_test = np.array([
95
+ [0.0, 0.1],
96
+ [1.0, 1.1],
97
+ ])
98
+
99
+ model = PNN(
100
+ bandwidth=0.25,
101
+ kernel="gaussian",
102
+ normalize=False,
103
+ )
104
+
105
+ model.fit(X_train, y_train)
106
+
107
+ labels = model.predict(X_test)
108
+ proba = model.predict_proba(X_test)
109
+
110
+ print(labels)
111
+ print(proba)
112
+ ```
113
+
114
+ ### Classification with `AdaptivePNN`
115
+
116
+ ```python
117
+ import numpy as np
118
+
119
+ from probabilisticnn.pnn import AdaptivePNN
120
+
121
+ X_train = np.array([
122
+ [0.0, 0.0],
123
+ [0.0, 0.2],
124
+ [1.0, 1.0],
125
+ [1.0, 1.2],
126
+ ])
127
+ y_train = np.array([0, 0, 1, 1])
128
+
129
+ model = AdaptivePNN(
130
+ kernel="gaussian",
131
+ bandwidth_sharing="per_feature",
132
+ loss="correct_class_probability",
133
+ solver="auto",
134
+ normalize=False,
135
+ )
136
+
137
+ model.fit(X_train, y_train)
138
+
139
+ print(model.predict(X_train))
140
+ print(model.predict_proba(X_train))
141
+ print(model.bandwidth_)
142
+ ```
143
+
144
+ ### Regression with `GRNN`
145
+
146
+ ```python
147
+ import numpy as np
148
+
149
+ from probabilisticnn.grnn import GRNN
150
+
151
+ X_train = np.array([
152
+ [0.0, 0.0],
153
+ [0.0, 0.2],
154
+ [1.0, 1.0],
155
+ [1.0, 1.2],
156
+ ])
157
+ y_train = np.array([1.0, 1.1, 3.0, 3.1])
158
+
159
+ X_test = np.array([
160
+ [0.0, 0.1],
161
+ [1.0, 1.1],
162
+ ])
163
+
164
+ model = GRNN(
165
+ bandwidth=0.5,
166
+ kernel="gaussian",
167
+ normalize=False,
168
+ )
169
+
170
+ model.fit(X_train, y_train)
171
+ pred = model.predict(X_test)
172
+
173
+ print(pred)
174
+ ```
175
+
176
+ ### Regression with `AdaptiveGRNN`
177
+
178
+ ```python
179
+ import numpy as np
180
+
181
+ from probabilisticnn.grnn import AdaptiveGRNN
182
+
183
+ X_train = np.array([
184
+ [0.0, 0.0],
185
+ [0.0, 0.2],
186
+ [1.0, 1.0],
187
+ [1.0, 1.2],
188
+ ])
189
+ y_train = np.array([1.0, 1.1, 3.0, 3.1])
190
+
191
+ model = AdaptiveGRNN(
192
+ kernel="gaussian",
193
+ loss="mse",
194
+ solver="auto",
195
+ normalize=False,
196
+ )
197
+
198
+ model.fit(X_train, y_train)
199
+
200
+ print(model.predict(X_train))
201
+ print(model.bandwidth_)
202
+ ```
203
+
204
+ ## Acceleration with `numba`
205
+
206
+ For `PNN`, `AdaptivePNN`, `GRNN`, and `AdaptiveGRNN`, you can choose:
207
+
208
+ - `backend="numpy"` — the main option;
209
+ - `backend="numba"` — the accelerated option.
210
+
211
+ Example:
212
+
213
+ ```python
214
+ from probabilisticnn.pnn import PNN
215
+
216
+ model = PNN(
217
+ bandwidth=0.25,
218
+ kernel="gaussian",
219
+ backend="numba",
220
+ normalize=False,
221
+ )
222
+ ```
223
+
224
+ Important:
225
+
226
+ - the first `predict` call for the `numba` branch may be slower because of JIT compilation;
227
+ - the main speed gain is achieved during the computation of kernel function values;
228
+ - if `numba` is not installed, the `numba` backend will be unavailable.
229
+
230
+ ## Public Interface
231
+
232
+ Models should be imported like this:
233
+
234
+ ```python
235
+ from probabilisticnn.pnn import PNN, AdaptivePNN
236
+ from probabilisticnn.grnn import GRNN, AdaptiveGRNN
237
+ ```
238
+
239
+ ## Model Parameters
240
+
241
+ ### `PNN`
242
+
243
+ Main parameters:
244
+
245
+ - `bandwidth` — fixed kernel bandwidth;
246
+ - `kernel` — kernel type;
247
+ - `losses` — class weighting scheme / misclassification cost for classes;
248
+ - `normalize` — whether to use L2 normalization of inputs;
249
+ - `backend` — `numpy` or `numba`;
250
+ - `compute_dtype` — `auto`, `float32`, `float64`.
251
+
252
+ ### `AdaptivePNN`
253
+
254
+ Additionally supports:
255
+
256
+ - `loss` — optimization objective function;
257
+ - `bandwidth_sharing` — method for defining bandwidth parameters;
258
+ - `max_iter` — maximum number of optimization steps;
259
+ - `solver` — optimization method;
260
+ - `solver_options` — additional optimizer parameters.
261
+
262
+ ### `GRNN`
263
+
264
+ Main parameters:
265
+
266
+ - `bandwidth`;
267
+ - `kernel`;
268
+ - `backend`;
269
+ - `compute_dtype`;
270
+ - `normalize`.
271
+
272
+ ### `AdaptiveGRNN`
273
+
274
+ Additionally supports:
275
+
276
+ - `loss` — loss function for regression;
277
+ - `max_iter`;
278
+ - `solver`;
279
+ - `solver_options`;
280
+ - `normalize`.
281
+
282
+ `AdaptiveGRNN` optimizes the kernel bandwidth using the `per_feature` scheme.
283
+
284
+ ## Testing
285
+
286
+ Preferred way to run tests:
287
+
288
+ ```bash
289
+ tox
290
+ ```
291
+
292
+ Or run a specific test file:
293
+
294
+ ```bash
295
+ pytest tests/test_pnn.py
296
+ ```
297
+
298
+ Since the tests import the installed package, it is most convenient to run them in a prepared environment after installing the dependencies.
299
+
300
+ ## Performance
301
+
302
+ The repository contains separate materials for measuring performance:
303
+
304
+ - [benchmarks/inference_bemchmarks.py](benchmarks/inference_bemchmarks.py)
305
+ - [benchmarks/benchmarking.ipynb](benchmarks/benchmarking.ipynb)
306
+
307
+ ## Examples
308
+
309
+ An additional usage example is located at:
310
+
311
+ - [examples/basic_usage.ipynb](examples/basic_usage.ipynb)
312
+
313
+ ## License
314
+
315
+ The project is distributed under the MIT license. See the [LICENCE](LICENCE) file.
@@ -0,0 +1,53 @@
1
+ [project]
2
+ name = "ProbabilisticNN"
3
+ version = "0.0.1"
4
+ description = "Python package for Probabilistic Neural Networks and General Regression Neural Networks"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "numpy>=1.26.0; python_version == '3.12'",
9
+ "numpy>=2.1.0; python_version == '3.13'",
10
+ "numpy>=2.3.3; python_version >= '3.14'",
11
+ "scipy>=1.11.2; python_version == '3.12'",
12
+ "scipy>=1.14.1; python_version == '3.13'",
13
+ "scipy>=1.17.0; python_version >= '3.14'",
14
+ "scikit-learn>=1.6.1; python_version < '3.14'",
15
+ "scikit-learn>=1.8.0; python_version >= '3.14'",
16
+ ]
17
+ license = "MIT"
18
+ authors = [
19
+ {name = "Grigorii Vinogradov", email = "vinogradov.gr.s@gmail.com"},
20
+ ]
21
+ keywords = [
22
+ "PNN",
23
+ "GRNN",
24
+ "Probabilistic Neural Network",
25
+ "General Regression Neural Network",
26
+ "Machine Learning",
27
+ "Adaptive PNN",
28
+ "Adaptive GRNN",
29
+ "Kernels"
30
+ ]
31
+
32
+ [project.optional-dependencies]
33
+ numba = [
34
+ "numba>=0.59.0; python_version == '3.12'",
35
+ "numba>=0.61.0; python_version == '3.13'",
36
+ "numba>=0.63.0; python_version >= '3.14'",
37
+ ]
38
+ dev = [
39
+ "pytest>=6",
40
+ "numba>=0.59.0; python_version == '3.12'",
41
+ "numba>=0.61.0; python_version == '3.13'",
42
+ "numba>=0.63.0; python_version >= '3.14'",
43
+ ]
44
+
45
+ [build-system]
46
+ requires = ["setuptools>=61.0", "wheel"]
47
+ build-backend = "setuptools.build_meta"
48
+
49
+ [tool.setuptools]
50
+ package-dir = {"" = "src"}
51
+
52
+ [tool.setuptools.packages.find]
53
+ where = ["src"]