-
Notifications
You must be signed in to change notification settings - Fork 2
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 #30 from Saran-nns/freezefix
Freeze fix
- Loading branch information
Showing
13 changed files
with
343 additions
and
59 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 |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from sorn import Simulator\n", | ||
"import numpy as np\n", | ||
"\n", | ||
"# Sample input\n", | ||
"num_features = 10\n", | ||
"time_steps = 200\n", | ||
"inputs = np.random.rand(num_features,time_steps)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Network Initialized\n", | ||
"Number of connections in Wee 3894 , Wei 1580, Wie 8000\n", | ||
"Shapes Wee (200, 200) Wei (40, 200) Wie (200, 40)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"# To simulate the network;\n", | ||
"matrices_dict, E, I, R, C = Simulator.simulate_sorn(inputs = inputs, phase='plasticity', \n", | ||
" matrices=None, noise = True, \n", | ||
" time_steps=time_steps,\n", | ||
" _ne = 200, _nu=num_features)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"matrices_dict, E, I, R, C = Simulator.simulate_sorn(inputs = inputs, phase='plasticity', \n", | ||
" matrices=matrices_dict, noise= True, \n", | ||
" time_steps=time_steps,_ne = 200, \n", | ||
" _nu=num_features)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"matrices_dict, E, I, R, C = Simulator.simulate_sorn(inputs = inputs, phase='plasticity', \n", | ||
" matrices=matrices_dict, noise= True, \n", | ||
" time_steps=time_steps,_ne = 200, \n", | ||
" _nu=num_features, freeze=['ip'])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "AttributeError", | ||
"evalue": "'dict' object has no attribute 'Wee'", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", | ||
"\u001b[1;32m<ipython-input-6-a4c248d62b08>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mmatrices_dict\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mWee\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | ||
"\u001b[1;31mAttributeError\u001b[0m: 'dict' object has no attribute 'Wee'" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"matrices_dict.Wee" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "AttributeError", | ||
"evalue": "'MatrixCollection' object has no attribute 'Wee'", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", | ||
"\u001b[1;32m<ipython-input-5-ed9a72c6207e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 4\u001b[0m matrices_dict, E, I, R, C = Trainer.train_sorn(inputs = inputs, phase='Training', \n\u001b[0;32m 5\u001b[0m \u001b[0mmatrices\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mmatrices_dict\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0m_nu\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnum_features\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m time_steps=1)\n\u001b[0m", | ||
"\u001b[1;32mN:\\sorn\\sorn\\sorn.py\u001b[0m in \u001b[0;36mtrain_sorn\u001b[1;34m(self, inputs, phase, matrices, time_steps, noise, freeze, **kwargs)\u001b[0m\n\u001b[0;32m 1135\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1136\u001b[0m Wee, Wei, Wie = (\n\u001b[1;32m-> 1137\u001b[1;33m \u001b[0mmatrix_collection\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mWee\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1138\u001b[0m \u001b[0mmatrix_collection\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mWei\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1139\u001b[0m \u001b[0mmatrix_collection\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mWie\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | ||
"\u001b[1;31mAttributeError\u001b[0m: 'MatrixCollection' object has no attribute 'Wee'" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from sorn import Trainer\n", | ||
"inputs = np.random.rand(num_features,1)\n", | ||
"\n", | ||
"matrices_dict, E, I, R, C = Trainer.train_sorn(inputs = inputs, phase='training', \n", | ||
" matrices=matrices_dict,_nu=num_features, \n", | ||
" time_steps=1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
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 |
---|---|---|
@@ -0,0 +1,140 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from sorn import Simulator\n", | ||
"import numpy as np\n", | ||
"\n", | ||
"# Sample input\n", | ||
"num_features = 10\n", | ||
"time_steps = 200\n", | ||
"inputs = np.random.rand(num_features,time_steps)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Network Initialized\n", | ||
"Number of connections in Wee 3894 , Wei 1580, Wie 8000\n", | ||
"Shapes Wee (200, 200) Wei (40, 200) Wie (200, 40)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"# To simulate the network;\n", | ||
"matrices_dict, E, I, R, C = Simulator.simulate_sorn(inputs = inputs, phase='plasticity', \n", | ||
" matrices=None, noise = True, \n", | ||
" time_steps=time_steps,\n", | ||
" _ne = 200, _nu=num_features)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"matrices_dict, E, I, R, C = Simulator.simulate_sorn(inputs = inputs, phase='plasticity', \n", | ||
" matrices=matrices_dict, noise= True, \n", | ||
" time_steps=time_steps,_ne = 200, \n", | ||
" _nu=num_features)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from sorn import Trainer\n", | ||
"inputs = np.random.rand(num_features,1)\n", | ||
"\n", | ||
"matrices_dict, E, I, R, C = Trainer.train_sorn(inputs = inputs, phase='training', \n", | ||
" matrices=matrices_dict,_nu=num_features, \n", | ||
" time_steps=1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Network Initialized\n", | ||
"Number of connections in Wee 3891 , Wei 1580, Wie 8000\n", | ||
"Shapes Wee (200, 200) Wei (40, 200) Wie (200, 40)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"matrices_dict, E, I, R, C = Simulator.simulate_sorn(inputs = inputs, phase='plasticity', \n", | ||
" matrices=None, noise = True, time_steps=1, \n", | ||
" _ne = 200, _nu=num_features, \n", | ||
" freeze=['ip'])\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Network Initialized\n", | ||
"Number of connections in Wee 3900 , Wei 1582, Wie 8000\n", | ||
"Shapes Wee (200, 200) Wei (40, 200) Wie (200, 40)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"matrices_dict, E, I, R, C = Simulator.simulate_sorn(inputs = inputs, phase='plasticity', \n", | ||
" matrices=None, noise = True, time_steps=1, \n", | ||
" _ne = 200, _nu=num_features, \n", | ||
" freeze=['ip','sp','ss'])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
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.