Skip to content

A General Framework for Unsupervised Learning with Hebbian/Anti-Hebbian Plasticity

License

Notifications You must be signed in to change notification settings

RunzheYang/CorrGame

Repository files navigation

A General Framework for Unsupervised Learning with Hebbian/Anti-Hebbian Plasticity

A Unified Framework

Given multiple input steams (or just one) X i R n i × T , the goal is to learn k -dimensional outputs Y R k × T such that

max Y i Φ i ( Y X i T ) 1 2 Ψ ( Y Y T ) ,

where Φ ( ) , Ψ ( ) are Legendre transforms of

strictly convex functions Φ ( ) , Ψ ( ) (so that the optimal dual variables exist)

Φ ( C Y X ) := max W D W Tr ( W C Y X ) Φ ( W ) ,

Ψ ( C Y Y ) := max M D M Tr ( M C Y Y ) Ψ ( M ) .

The these functions are non-decreasing when the optimal dual variables W and M are non-negative. Then, we can interpret the objective as maximizing the correlation between inputs and outputs, while minimizing the auto-correlation of outputs.

Neural Network Algorithms

We can use projected gradient descent / ascent to solve a dual problem of the above problem in an online fasion, which leads to a bio-plausible neural network algorithm.

The steady activities of output neurons can be solve by offline projected gradient ascent:

y proj D y [ y + η y ( W x M y ) ] .

The synaptic learning rule:

W proj D W [ W + η W ( y t x t Φ ( W ) ) ] ,

M proj D M [ M + η M 2 ( y t y t Ψ ( M ) ) ] .

Choices of Φ and Ψ

We can implemented different algorithms from similarity matching famility by specifying different Φ , Ψ , and constraints on Y , W , and M . For example:

When W , M , Y are unbounded, and Φ ( W ) = 1 2 Tr W W ,  and  Ψ ( M ) = 1 2 Tr M M , we get the similarity matching principle. We can simply create a similarity matching instance with the following code

sim_match = CorrGame(n=n, k=k, 
                Phi=lambda W, X: (W*W).sum()/2,
                Psi=lambda M, X: (M*M).sum()/2,
                dPhi = lambda W, X:W,
                dPsi = lambda M, X:M,
                constraints = {'Y': lambda x:x,
                               'W': lambda x:x,
                               'M': lambda x:x},
                eta= {'Y': eta_Y, 'W': eta_W, 'M': eta_M},
                device=device)

where the derivatives dPhi and dPsi are optional. The algorithm will be more efficient if the analytical derivatives are provided, otherwise they will be approximated solved by auto-grad. We can also specify closed-form solutions to the online or the offline trainer to speed up convergence.

When Y is non-negative, and we have two input streams X 1 and X 2 , by setting Φ i ( W i ) = 1 2 Tr W i C X i X i W i , i { 1 , 2 }  and  Ψ ( M ) = 1 2 Tr M M , we get the nonnegative cannonical correlation analysis. We can simply create a NCCA instance with the following code

ncca = CorrGame(n=[n1, n2], k=top_k, 
                Phi=lambda W, X: (W.mm(X.mm(X.t())/X.size(1))*W).sum()/2,
                Psi=lambda M, X: (M*M).sum()/2,
                dPhi = lambda W, X:W.mm(X.mm(X.t())/X.size(1)),
                dPsi = lambda M, X:M,
                constraints = {'Y': F.relu,
                               'W': lambda x:x,
                               'M': lambda x:x},
                eta= {'Y': eta_Y, 'W': eta_W, 'M': eta_M},
                device=device)

Please see general-correlation-game.ipynb and multi-source-correlation-game.ipynb for more examples.

References

...

About

A General Framework for Unsupervised Learning with Hebbian/Anti-Hebbian Plasticity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published