Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from AP6YC/release/0.4
Release/0.4.0
- Loading branch information
Showing
34 changed files
with
1,896 additions
and
1,412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: | ||
- master | ||
- develop | ||
tags: '*' | ||
pull_request: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
[deps] | ||
AdaptiveResonance = "3d72adc0-63d3-4141-bf9b-84450dd0395b" | ||
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589" | ||
MLDataUtils = "cc2ba9b6-d476-5e6d-8eaf-a92d5412d41d" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Basic Example | ||
|
||
In the example below, we create a dataset generated from two multivariate Gaussian distributions in two dimensions, showing how an ART module can be used in unsupervised or simple supervised modes alongside an ARTMAP module that is explicitly supervised-only. | ||
|
||
```@example | ||
# Copyright © 2021 Alexander L. Hayes | ||
# MIT License | ||
using AdaptiveResonance | ||
using Distributions, Random | ||
using MLDataUtils | ||
using Plots | ||
""" | ||
Demonstrates Unsupervised DDVFA, Supervised DDVFA, and (Supervised) SFAM on a toy problem | ||
with two multivariate Gaussians. | ||
""" | ||
# Setup two multivariate Gaussians and sampling 1000 points from each. | ||
rng = MersenneTwister(1234) | ||
dist1 = MvNormal([0.0, 6.0], [1.0 0.0; 0.0 1.0]) | ||
dist2 = MvNormal([4.5, 6.0], [2.0 -1.5; -1.5 2.0]) | ||
N_POINTS = 1000 | ||
X = hcat(rand(rng, dist1, N_POINTS), rand(rng, dist2, N_POINTS)) | ||
y = vcat(ones(Int64, N_POINTS), zeros(Int64, N_POINTS)) | ||
p1 = scatter(X[1,:], X[2,:], group=y, title="Original Data") | ||
(X_train, y_train), (X_test, y_test) = stratifiedobs((X, y)) | ||
# Standardize data types | ||
X_train = convert(Matrix{Float64}, X_train) | ||
X_test = convert(Matrix{Float64}, X_test) | ||
y_train = convert(Vector{Int}, y_train) | ||
y_test = convert(Vector{Int}, y_test) | ||
# Unsupervised DDVFA | ||
art = DDVFA() | ||
train!(art, X_train) | ||
y_hat_test = AdaptiveResonance.classify(art, X_test) | ||
p2 = scatter(X_test[1,:], X_test[2,:], group=y_hat_test, title="Unsupervised DDVFA") | ||
# Supervised DDVFA | ||
art = DDVFA() | ||
train!(art, X_train, y=y_train) | ||
y_hat_test = AdaptiveResonance.classify(art, X_test) | ||
p3 = scatter(X_test[1,:], X_test[2,:], group=y_hat_test, title="Supervised DDVFA", xlabel="Performance: " * string(round(performance(y_hat_test, y_test); digits=3))) | ||
# Supervised SFAM | ||
art = SFAM() | ||
train!(art, X_train, y_train) | ||
y_hat_test = AdaptiveResonance.classify(art, X_test) | ||
p4 = scatter(X_test[1,:], X_test[2,:], group=y_hat_test, title="Supervised SFAM", xlabel="Performance: " * string(round(performance(y_hat_test, y_test); digits=3))) | ||
# Performance Measure + display the plots | ||
plot(p1, p2, p3, p4, layout=(1, 4), legend = false, xtickfontsize=6, xguidefontsize=8, titlefont=font(8)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Background | ||
|
||
This page provides a theoretical overview of Adaptive Resonance Theory and what this project aims to accomplish. | ||
|
||
## What is Adaptive Resonance Theory? | ||
|
||
Adaptive Resonance Theory (commonly abbreviated to ART) is both a **neurological theory** and a **family of neurogenitive neural network models for machine learning**. | ||
|
||
ART began as a neurocognitive theory of how fields of cells can continuously learn stable representations, and it evolved into the basis for a myriad of practical machine learning algorithms. | ||
Pioneered by Stephen Grossberg and Gail Carpenter, the field has had contributions across many years and from many disciplines, resulting in a plethora of engineering applications and theoretical advancements that have enabled ART-based algorithms to compete with many other modern learning and clustering algorithms. | ||
|
||
Because of the high degree of interplay between the neurocognitive theory and the engineering models born of it, the term ART is frequently used to refer to both in the modern day (for better or for worse). | ||
|
||
Stephen Grossberg's has recently released a book summarizing the work of him, his wife Gail Carpenter, and his colleagues on Adaptive Resonance Theory in his book [Conscious Brain, Resonant Mind](https://www.amazon.com/Conscious-Mind-Resonant-Brain-Makes/dp/0190070552). | ||
|
||
## ART Basics | ||
|
||
![art](../assets/figures/art.png) | ||
|
||
### ART Dynamics | ||
|
||
Nearly every ART model shares a basic set of dynamics: | ||
|
||
1. ART models typically have two layers/fields denoted F1 and F2. | ||
2. The F1 field is the feature representation field. | ||
Most often, it is simply the input feature sample itself (after some necessary preprocessing). | ||
3. The F2 field is the category representation field. | ||
With some exceptions, each node in the F2 field generally represents its own category. | ||
This is most easily understood as a weight vector representing a prototype for a class or centroid of a cluster. | ||
4. An activation function is used to find the order of categories "most activated" for a given sample in F1. | ||
5. In order of highest activation, a match function is used to compute the agreement between the sample and the categories. | ||
6. If the match function for a category evaluates to a value above a threshold known as the vigilance parameter ($$\rho$$), the weights of that category may be updated according to a learning rule. | ||
7. If there is complete mismatch across all categories, then a new categories is created according to some instantiation rule. | ||
|
||
### ART Considerations | ||
|
||
In addition to the dynamics typical of an ART model, you must know: | ||
|
||
1. ART models are inherently designed for unsupervised learning (i.e., learning in the absense of supervisory labels for samples). | ||
This is also known as clustering. | ||
2. ART models are capable of supervised learning and reinforcement learning through some redesign and/or combination of ART models. | ||
For example, ARTMAP models are combinations of two ART models in a special way, one learning feature-to-category mappings and another learning category-to-label mappingss. | ||
ART modules are used for reinforcement learning by representing the mappings between state, value, and action spaces with ART dynamics. | ||
3. Almost all ART models face the problem of the appropriate selection of the vigilance parameter, which may depend in its optimality according to the problem. | ||
4. Being a class of neurogenitive neural network models, ART models gain the ability for theoretically infinite capacity along with the problem of "category proliferation," which is the undesirable increase in the number of categories as the model continues to learn, leading to increasing computational time. | ||
In contrast, while the evaluation time of a deep neural network is always *exactly the same*, there exist upper bounds in their representational capacity. | ||
5. Nearly every ART model requires feature normalization (i.e., feature elements lying within $$[0,1]$$) and a process known as complement coding where the feature vector is appended to its vector complement $$[1-\bar{x}]$$. | ||
This is because real-numbered vectors can be arbitrarily close to one another, hindering learning performance, which requires a degree of contrast enhancement between samples to ensure their separation. | ||
|
||
To learn about their implementations, nearly every practical ART model is listed in a recent [ART survey paper by Leonardo Enzo Brito da Silva](https://arxiv.org/abs/1905.11437). | ||
|
||
## History and Development | ||
|
||
At a high level, ART began with a neural network model known as the Grossberg Network named after Stephen Grossberg. | ||
This network treats the firing of neurons in frequency domain as basic shunting models, which are recurrently connected to increase their own activity while suppressing the activities of others nearby (i.e., on-center, off-surround). | ||
Using this shunting model, Grossberg shows that autonomous, associative learning can occur with what are known as instar networks. | ||
|
||
By representing categories as a field of instar networks, new categories could be optimally learned by the instantiation of new neurons. | ||
However, it was shown that the learning stability of Grossberg Networks degrades as the number of represented categories increases. | ||
Discoveries in the neurocognitive theory and breakthroughs in their implementation led to the introduction of a recurrent connections between the two fields of the network to stabilize the learning. | ||
These breakthroughs were based upon the discovery that autonomous learning depends on the interplay and agreement between *perception* and *expectation*, frequently referred to as bottom-up and top-down processes. | ||
Furthermore, it is *resonance* between these states in the frequency domain that gives rise to conscious experiences and that permit adaptive weights to change, leading to the phenomenon of learning. | ||
The theory has many explanatory consequences in psychology, such as why attention is required for learning, but its consequences in the engineering models are that it stabilizes learning in cooperative-competitive dynamics, such as interconnected fields of neurons, which are most often chaotic. | ||
|
||
Chapters 18 and 19 of the book by [Neural Network Design by Hagan, Demuth, Beale, and De Jesus](https://hagan.okstate.edu/NNDesign.pdf) provide a good theoretical basis for learning how these network models were eventually implemented into the first binary-vector implementation of ART1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
dce1bb2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
Release notes:
This minor release refactors most internal methods to separate incremental and batch methods along with standardizing numerical types across all modules.
dce1bb2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/49736
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: