-
Notifications
You must be signed in to change notification settings - Fork 32
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 #1915 from PrincetonUniversity/devel
Devel
- Loading branch information
Showing
26 changed files
with
723 additions
and
399 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 |
---|---|---|
|
@@ -46,7 +46,7 @@ jobs: | |
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir) | ||
- name: Wheels cache | ||
uses: actions/[email protected].3 | ||
uses: actions/[email protected].4 | ||
with: | ||
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels | ||
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }} | ||
|
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 |
---|---|---|
|
@@ -46,7 +46,7 @@ jobs: | |
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir) | ||
- name: Wheels cache | ||
uses: actions/[email protected].3 | ||
uses: actions/[email protected].4 | ||
with: | ||
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels | ||
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }} | ||
|
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,64 @@ | ||
import psyneulink as pnl | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
#sample Hebb | ||
|
||
FeatureNames=['small','medium','large','red','yellow','blue','circle','rectangle','triangle'] | ||
|
||
# create a variable that corresponds to the size of our feature space | ||
sizeF = len(FeatureNames) | ||
small_red_circle = [1,0,0,1,0,0,1,0,0] | ||
src = small_red_circle | ||
|
||
|
||
Hebb_comp = pnl.Composition() | ||
|
||
Hebb_mech=pnl.RecurrentTransferMechanism( | ||
size=sizeF, | ||
function=pnl.Linear, | ||
#integrator_mode = True, | ||
#integration_rate = 0.5, | ||
enable_learning = True, | ||
learning_rate = .1, | ||
name='Hebb_mech', | ||
#matrix=pnl.AutoAssociativeProjection, | ||
auto=0, | ||
hetero=0 | ||
) | ||
|
||
Hebb_comp.add_node(Hebb_mech) | ||
|
||
Hebb_comp.execution_id = 1 | ||
|
||
# Use print_info to show numerical values and vis_info to show graphs of the changing values | ||
|
||
def print_info(): | ||
print('\nWeight matrix:\n', Hebb_mech.matrix.base, '\nActivity: ', Hebb_mech.value) | ||
|
||
|
||
def vis_info(): | ||
ub=1#np.amax(np.amax(np.abs(Hebb_mech.matrix.modulated))) | ||
lb=-ub | ||
plt.figure() | ||
plt.imshow(Hebb_mech.matrix.modulated,cmap='RdBu_r',vmin=lb,vmax=ub) | ||
plt.title('PNL Hebbian Matrix') | ||
plt.xticks(np.arange(0,sizeF),FeatureNames,rotation=35) | ||
plt.yticks(np.arange(0,sizeF),FeatureNames,rotation=35) | ||
|
||
plt.colorbar() | ||
plt.show() | ||
|
||
plt.figure() | ||
plt.stem(Hebb_mech.value[0]) | ||
plt.title('Activation from Stimulus with PNL Hebbian Matrix') | ||
plt.xticks(np.arange(0,sizeF),FeatureNames,rotation=35) | ||
plt.xlabel('Feature') | ||
plt.ylabel('Activation') | ||
plt.show() | ||
|
||
inputs_dict = {Hebb_mech:np.array(src)} | ||
out=Hebb_comp.learn(num_trials=5, | ||
# call_after_trial=vis_info, | ||
inputs=inputs_dict) | ||
|
||
print_info() |
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,10 +1,11 @@ | ||
Mechanisms | ||
========== | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
|
||
.. container:: subclasses | ||
*Subclasses* | ||
ProcessingMechanisms | ||
ModulatoryMechanisms | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
|
||
*Subclasses:* | ||
ProcessingMechanisms | ||
ModulatoryMechanisms |
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
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.