Skip to content

Commit fbff160

Browse files
Update adaptive_resonance_theory.py
1 parent fa54a2d commit fbff160

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

neural_network/adaptive_resonance_theory.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
References:
1616
1. Carpenter, G. A., & Grossberg, S. (1987). "A Adaptive Resonance Theory."
1717
In: Neural Networks for Pattern Recognition, Oxford University Press,
18-
pp. 194–203.
18+
pp.
1919
2. Carpenter, G. A., & Grossberg, S. (1988). "The ART of Adaptive Pattern
2020
Recognition by a Self-Organizing Neural Network." IEEE Transactions on
21-
Neural Networks, 1(2), 115-130. DOI: 10.1109/TNN.1988.82656
21+
Neural Networks, 1(2) DOI: 10.1109/TNN.1988.82656
2222
2323
"""
2424

@@ -34,7 +34,7 @@ class ART1:
3434
num_features (int): Number of features in the input data.
3535
vigilance (float): Threshold for similarity that determines whether
3636
an input matches an existing cluster.
37-
weights (List[np.ndarray]): List of cluster weights representing the learned categories.
37+
weights (List[np.ndarray]): List of cluster weights representing learned categories.
3838
"""
3939

4040
def __init__(self, num_features: int, vigilance: float = 0.7) -> None:
@@ -73,14 +73,13 @@ def _similarity(self, weight_vector: np.ndarray, input_vector: np.ndarray) -> fl
7373
or len(input_vector) != self.num_features
7474
):
7575
raise ValueError(
76-
"Both weight_vector and input_vector must have the same number of features."
76+
"Both weight_vector and input_vector must have the same features."
7777
)
7878

7979
return np.dot(weight_vector, input_vector) / self.num_features
8080

8181
def _learn(
82-
self, w: np.ndarray, x: np.ndarray, learning_rate: float = 0.5
83-
) -> np.ndarray:
82+
self, w: np.ndarray, x: np.ndarray, learning_rate: float = 0.5) -> np.ndarray:
8483
"""
8584
Update cluster weights using the learning rate.
8685
@@ -153,7 +152,7 @@ def art1_example() -> None:
153152
"""
154153
Example function demonstrating the usage of the ART1 model.
155154
156-
This function creates a dataset, trains the ART1 model, and prints assigned clusters.
155+
This function creates a dataset, trains the ART1 model, and prints clusters.
157156
158157
Examples:
159158
>>> art1_example()

0 commit comments

Comments
 (0)