Skip to content

Commit 6716b43

Browse files
Update adaptive_resonance_theory.py
1 parent 0975456 commit 6716b43

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

neural_network/adaptive_resonance_theory.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
"""
22
adaptive_resonance_theory.py
33
4-
This module implements the Adaptive Resonance Theory 1 (ART1) model, a type
5-
of neural network designed for unsupervised learning and clustering of binary
6-
input data. The ART1 algorithm continuously learns to categorize inputs based
7-
on their similarity while preserving previously learned categories. This is
8-
achieved through a vigilance parameter that controls the strictness of
4+
This module implements the Adaptive Resonance Theory 1 (ART1) model, a type
5+
of neural network designed for unsupervised learning and clustering of binary
6+
input data. The ART1 algorithm continuously learns to categorize inputs based
7+
on their similarity while preserving previously learned categories. This is
8+
achieved through a vigilance parameter that controls the strictness of
99
category matching, allowing for flexible and adaptive clustering.
1010
11-
ART1 is particularly useful in applications where it is critical to learn new
12-
patterns without forgetting previously learned ones, making it suitable for
11+
ART1 is particularly useful in applications where it is critical to learn new
12+
patterns without forgetting previously learned ones, making it suitable for
1313
real-time data clustering and pattern recognition tasks.
1414
1515
References:
16-
1. Carpenter, G. A., & Grossberg, S. (1987). "A Adaptive Resonance Theory."
17-
In: Neural Networks for Pattern Recognition, Oxford University Press,
18-
pp.
19-
2. Carpenter, G. A., & Grossberg, S. (1988). "The ART of Adaptive Pattern
20-
Recognition by a Self-Organizing Neural Network." IEEE Transactions on
21-
Neural Networks, 1(2)DOI: 10.1109/TNN.1988.82656
16+
1. Carpenter, G. A., & Grossberg, S. (1987). "A Adaptive Resonance Theory."
17+
In: Neural Networks for Pattern Recognition, Oxford University Press,
18+
pp. 194–203.
19+
2. Carpenter, G. A., & Grossberg, S. (1988). "The ART of Adaptive Pattern
20+
Recognition by a Self-Organizing Neural Network." IEEE Transactions on
21+
Neural Networks, 1(2), 115-130. 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 cluster weights representing learned categories.
37+
weights (List[np.ndarray]): List of cluster weights representing the learned categories.
3838
"""
3939

4040
def __init__(self, num_features: int, vigilance: float = 0.7) -> None:
@@ -55,7 +55,7 @@ def __init__(self, num_features: int, vigilance: float = 0.7) -> None:
5555

5656
self.vigilance = vigilance
5757
self.num_features = num_features
58-
self.weights: List[np.ndarray] = [] # Type annotation added here
58+
self.weights: List[np.ndarray] = [] # Correctly typed list of numpy arrays
5959

6060
def _similarity(self, weight_vector: np.ndarray, input_vector: np.ndarray) -> float:
6161
"""
@@ -73,7 +73,7 @@ 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 features."
76+
"Both weight_vector and input_vector must have the same number of features."
7777
)
7878

7979
return np.dot(weight_vector, input_vector) / self.num_features
@@ -153,7 +153,7 @@ def art1_example() -> None:
153153
"""
154154
Example function demonstrating the usage of the ART1 model.
155155
156-
This function creates a dataset, trains the ART1 model, and prints clusters.
156+
This function creates a dataset, trains the ART1 model, and prints assigned clusters.
157157
158158
Examples:
159159
>>> art1_example()

0 commit comments

Comments
 (0)