1
1
"""
2
2
Radial Basis Function Neural Network (RBFNN)
3
3
4
- A Radial Basis Function Neural Network (RBFNN) is a type of artificial
5
- neural network that uses radial basis functions as activation functions.
6
- RBFNNs are particularly effective for function approximation, regression,
7
- and classification tasks.
4
+ A Radial Basis Function Neural Network (RBFNN) is a type of artificial neural
5
+ network that uses radial basis functions as activation functions.
6
+ RBFNNs are particularly effective for function approximation, regression, and
7
+ classification tasks. The architecture typically consists of an input layer,
8
+ a hidden layer with radial basis functions, and an output layer.
9
+
10
+ In an RBFNN:
11
+ - The hidden layer applies a radial basis function (often Gaussian) to the
12
+ input data, transforming it into a higher-dimensional space.
13
+ - The output layer combines the results from the hidden layer using
14
+ weighted sums to produce the final output.
8
15
9
16
#### Reference
10
-
11
17
- Wikipedia: https://en.wikipedia.org/wiki/Radial_basis_function_network
12
18
"""
13
19
@@ -34,7 +40,7 @@ def __init__(self, num_centers: int, spread: float) -> None:
34
40
spread (float): Spread of the radial basis functions.
35
41
36
42
Examples:
37
- >>> rbf_nn = RadialBasisFunctionNeuralNetwork(num_centers=3, spread=1.0)
43
+ >>> rbf_nn = RadialBasisFunctionNeuralNetwork(num_centers=3,spread=1.0)
38
44
>>> rbf_nn.num_centers
39
45
3
40
46
"""
@@ -61,7 +67,7 @@ def _gaussian_rbf(self, input_vector: np.ndarray, center: np.ndarray) -> float:
61
67
0.1353352832366127
62
68
"""
63
69
# Calculate the squared distances
64
- distances = np .linalg .norm (input_data [:, np .newaxis ] - centers , axis = 2 ) ** 2
70
+ distances = np .linalg .norm (input_vector [:, np .newaxis ] - center , axis = 2 )** 2
65
71
return np .exp (- distances / (2 * self .spread ** 2 ))
66
72
67
73
def _compute_rbf_outputs (self , input_data : np .ndarray ) -> np .ndarray :
0 commit comments