Skip to content

Commit f66b55f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5fbe96d commit f66b55f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

neural_network/radial_basis_function_neural_network.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
from typing import List, Optional
33

4+
45
class RadialBasisFunctionNeuralNetwork:
56
"""
67
A simple implementation of a Radial Basis Function Neural Network (RBFNN).
@@ -36,13 +37,13 @@ def _gaussian(self, x: np.ndarray, center: np.ndarray) -> float:
3637
3738
Returns:
3839
float: The output of the RBF evaluated at x.
39-
40+
4041
>>> import numpy as np
4142
>>> rbf_nn = RadialBasisFunctionNeuralNetwork(n_centers=2, sigma=0.5)
4243
>>> rbf_nn._gaussian(np.array([0, 0]), np.array([1, 1]))
4344
0.1353352832366127
4445
"""
45-
return np.exp(-np.linalg.norm(x - center)**2 / (2 * self.sigma**2))
46+
return np.exp(-(np.linalg.norm(x - center) ** 2) / (2 * self.sigma**2))
4647

4748
def _compute_rbf(self, X: np.ndarray) -> np.ndarray:
4849
"""
@@ -97,6 +98,7 @@ def predict(self, X: np.ndarray) -> np.ndarray:
9798
rbf_outputs = self._compute_rbf(X)
9899
return rbf_outputs.dot(self.weights)
99100

101+
100102
# Example Usage
101103
if __name__ == "__main__":
102104
# Sample dataset

0 commit comments

Comments
 (0)