Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add topographical placement and connectivity #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ Evaluate the model before and after training:

Optional: Maybe evaluate in depth

for ((i=0;i<20;i+=2)); do
for ((i=1;i<2;i+=2)); do
echo "Evaluating at $i"
py neurosim/main.py eval $WDIR --resume_tidx=$i
done

Run all evaluation:

WDIR=results/20210713
WDIR=results/20210805
py neurosim/tools/evaluate.py frequency $WDIR --timestep 10000
py neurosim/tools/evaluate.py medians $WDIR
py neurosim/tools/evaluate.py rewards $WDIR
Expand Down
108 changes: 54 additions & 54 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"savemp4": 0,
"render": 0,
"observation_map": [
{"type": "rf_normal", "bins": 5, "mean": -0.00645789, "std": 0.06894682},
{"type": "rf_normal", "bins": 5, "mean": -0.03634136, "std": 0.53989509},
{"type": "rf_normal", "bins": 10, "mean": 0.00529333, "std": 0.09129902},
{"type": "rf_normal", "bins": 20, "mean": -0.00645789, "std": 1.0},
{"type": "rf_normal", "bins": 20, "mean": -0.03634136, "std": 0.53989509},
{"type": "rf_normal", "bins": 20, "mean": 0.00529333, "std": 0.09129902},
{"type": "rf_normal", "bins": 20, "mean": 0.04752025, "std": 0.82070579}
],
"episodes": 21,
Expand All @@ -24,9 +24,13 @@
"rewardsToKeep": 100,
"critic": {
"angv_bias": 0.2,
"total_gain": 5.0,
"max_reward": 2.0,
"posRewardBias": 2.0
"total_gain": 6.0,
"max_reward": 3.0,
"posRewardBias": 2.0,
"modulation": {
"type": "linear",
"steps": 25
}
},
"verbose": 0,
"stayStepLim": 0,
Expand All @@ -35,12 +39,13 @@
"ResumeSimFromFile": "...pkl"
},
"sim": {
"duration": 1000,
"duration": 2000,
"dt": 0.6,
"verbose": 0,
"recordStep": 1.0,
"recordStim": 0,
"recordWeightStepSize": 1000,
"normalizeStepSize": 2333,
"RLFakeUpRule": 0,
"RLFakeDownRule": 0,
"RLFakeStayRule": 0,
Expand Down Expand Up @@ -114,15 +119,43 @@
"I": 0.0
},
"allpops": {
"ES": 40,
"ES": 80,

"EA": 40,
"IA": 10,
"IAL": 10,

"EM": 40,
"IM": 10,
"IML": 10
"EM": 60,
"IM": 15,
"IML": 15
},
"out_pop_sort_tag": "x",
"topographic": {
"stimModES": {
"xnormRange": [0.4, 0.6],
"ynormRange": [0.0, 0.1]
},
"ES": {
"ynormRange": [0.1, 0.3]
},
"EA": {
"ynormRange": [0.35, 0.45]
},
"IA": {
"ynormRange": [0.50, 0.55]
},
"IAL": {
"ynormRange": [0.55, 0.60]
},
"EM": {
"ynormRange": [0.70, 0.90]
},
"IM": {
"ynormRange": [0.90, 0.95]
},
"IML": {
"ynormRange": [0.95, 1.0]
}
},
"inputPop": "ES",
"STDPconns": {
Expand Down Expand Up @@ -161,18 +194,18 @@
"IA":{"GA2": 2.25,"p": 0.2},
"IAL":{"GA2": 5.5,"p": 0.1}},
"EM":{
"EM":{"AM2": 0.01,"NM2": 0.001, "conv": 1},
"IM":{"AM2": 1.95,"NM2":0.0195, "conv": 8},
"IML":{"AM2": 0.98,"NM2":0.098, "conv": 8},
"EA":{"AM2": 0.5,"NM2": 0.01,"conv": 6}},
"EM":{"AM2": 0.01,"NM2": 0.001, "p": "0.2*exp(-dist_xnorm*3)"},
"IM":{"AM2": 1.95,"NM2":0.0195, "p": "0.4*(1.0-exp(-dist_xnorm*3))"},
"IML":{"AM2": 0.98,"NM2":0.098, "p": "0.4*(1.0-exp(-dist_xnorm*3))"},
"EA":{"AM2": 0.5,"NM2": 0.01,"conv": 4}},
"IM":{
"EM":{"GA": 9.0,"p": 0.4},
"IM":{"GA": 4.5,"p": 0.1},
"IML":{"GA": 4.5,"p": 0.2}},
"EM":{"GA": 9.0,"p": "0.5*exp(-dist_xnorm*3)"},
"IM":{"GA": 4.5,"p": "0.2*(1.0-exp(-dist_xnorm*3))"},
"IML":{"GA": 4.5,"p": "0.05*(1.0-exp(-dist_xnorm*3))"}},
"IML":{
"EM":{"GA2": 2.5,"p": 0.4},
"IM":{"GA2": 2.25,"p": 0.2},
"IML":{"GA2": 5.5,"p": 0.1}}
"EM":{"GA2": 2.5,"p": "0.5*exp(-dist_xnorm*3)"},
"IM":{"GA2": 2.25,"p": "0.2*(1.0-exp(-dist_xnorm*3))"},
"IML":{"GA2": 5.5,"p": "0.05*(1.0-exp(-dist_xnorm*3))"}}
},
"weightVar": 0.5,
"delays": {
Expand Down Expand Up @@ -241,38 +274,5 @@
"softthresh": 0,
"verbose": 0
}
},
"noise": {
"EMLEFT": {
"AM": {"w":0, "rate":0},
"NM": {"w":0, "rate":0},
"GA": {"w":1.875, "rate": 100},
"AM2": {"w": 3.938, "rate": 200},
"NM2": {"w": 0, "rate": 0},
"GA2": {"w": 1.875, "rate": 100}},
"EMRIGHT": {"AM": {"w":0, "rate":0},
"NM": {"w":0, "rate":0},
"GA": {"w":1.875, "rate": 100},
"AM2": {"w": 3.938, "rate": 200},
"NM2": {"w": 0, "rate": 0},
"GA2": {"w": 1.875, "rate": 100}},
"EA": {"AM": {"w":0, "rate":0},
"NM": {"w":0, "rate":0},
"GA": {"w":1.875, "rate": 100},
"AM2": {"w": 3.938, "rate": 200},
"NM2": {"w": 0, "rate": 0},
"GA2": {"w": 1.875, "rate": 100}},
"IA": {"AM": {"w":1.875, "rate": 100},
"NM": {"w":0, "rate":0},
"GA": {"w":0, "rate":0},
"AM2": {"w": 4.125, "rate": 200},
"NM2": {"w": 0, "rate": 0},
"GA2": {"w": 1.875, "rate": 100}},
"IAL": {"AM": {"w":1.875, "rate": 100},
"NM": {"w":0, "rate":0},
"GA": {"w":0, "rate":0},
"AM2": {"w": 3.0, "rate": 200},
"NM2": {"w": 0, "rate": 0},
"GA2": {"w": 1.875, "rate": 100}}
}
}
5 changes: 3 additions & 2 deletions neurosim/critic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ def _modulate_linear(mod_steps, reward, min_steps=1):
k_pos = len([st for st in mod_steps if st > EPS])
k_neg = len([st for st in mod_steps if st < -EPS])
if reward >= 0:
return reward * (M - k_pos) / M
new_reward = reward * (M - k_pos + 1) / (M+1)
else:
return reward * (M - k_neg) / M
new_reward = reward * (M - k_neg + 1) / (M+1)
return new_reward

class Critic:

Expand Down
Loading