_______________________________________________
Hi,
I just did the following test with the current NEST master and NEST 3.1 and there things seem to work as expected. I get different membrane potentials for neurons with seeds 100 and 1000 when initializing on creation:
In [8]: nest.ResetKernel()
In [9]: nest.rng_seed = 100
In [10]: n = nest.Create('iaf_psc_alpha', 10, params={'V_m': nest.random.normal(-51., 10)})
In [11]: n.V_m
Out[11]:
(-48.59349994516202,
-62.391924115381116,
-41.373005254994425,
-57.40416211886578,
-55.00625628226899,
-58.390425179047895,
-55.24506539841326,
-53.025705514351856,
-51.605353014049754,
-55.422455776310166)
In [12]: nest.ResetKernel()
In [13]: nest.rng_seed = 1000
In [14]: n = nest.Create('iaf_psc_alpha', 10, params={'V_m': nest.random.normal(-51., 10)})
In [15]: n.V_m
Out[15]:
(-61.99342803053577,
-43.36557257654475,
-56.96149010671454,
-46.802621999699895,
-38.1809073583283,
-46.72672336036912,
-52.65744001330793,
-54.65343890518882,
-45.195683344187955,
-38.82283445344244)
This also works as expected if I draw at the Python level
In [27]: nest.ResetKernel()
In [28]: nest.rng_seed = 100
In [29]: [nest.random.normal(-51., 10).GetValue() for _ in range(5)]
Out[29]:
[-49.30997769812133,
-49.87958247942526,
-49.81013407516723,
-53.261688886622565,
-57.7916578766182]
In [30]: nest.ResetKernel()
In [31]: nest.rng_seed = 1000
In [32]: [nest.random.normal(-51., 10).GetValue() for _ in range(5)]
Out[32]:
[-34.1615153889346,
-31.487943150805098,
-46.29074242569416,
-49.91770982448142,
-52.23367995498362]
So it seems strange that it does not work for you. Is there any chance you have a mix of older versions? Could you delete all build and install directories and start from scratch (assuming you built NEST yourself; otherwise, how did you install NEST?).
Best,
Hans Ekkehard
--
Prof. Dr. Hans Ekkehard Plesser
Head, Department of Data Science
Faculty of Science and Technology
Norwegian University of Life Sciences
PO Box 5003, 1432 Aas, Norway
Phone +47 6723 1560
Email hans.ekkehard.plesser@nmbu.no
Home http://arken.nmbu.no/~plesser
On 24/11/2021, 18:08, "Maryada Maryada" <er.maryada@gmail.com> wrote:
Hi Stine,
I got the answer from your follow-up questions, So rng_type was default but it's interesting that NEST 3.0 does not really have any effect on randomization when I set rng_seed using nest.rng_seed but only if I use nest.SetKernalStatus.....
if you run the following code
import nest
nest.ResetKernel()
nest.rng_seed = 307
# nest.SetKernelStatus({'rng_seed': 33})
for _ in range(10):
v_m = nest.random.normal(mean=-51., std=10.)
print(v_m.GetValue())
print(nest.rng_seed)
# print(nest.GetKernelStatus('rng_seed'))
No matter what value you set for seed the out is always the same set of 10 values. and nest.rng_seed value is updated for different set values.
However, It works if I use the old syntax.
I am assuming it's not a bug but is what 3.1 offers and was added partially in 3.0 version already.
On Wed, Nov 24, 2021 at 3:22 PM Stine Brekke Vennemo <stine.brekke.vennemo@nmbu.no> wrote:
Dear Maryada,
Am I understanding you correctly that every time you call v_m.GetValue() you get the same results?
I am not able to reproduce your results, I get a new value for V_m every time I switch rng_seed, and also if I call v_m.GetValue() a second time with the same seed without doing a ResetKernel.
To test that you are actually setting a new rng seed, maybe do a print(nest.rng_seed) to make sure?
What is your output if you type print(nest.rng_type)?
Best wishes,
Stine
From: Maryada Maryada <er.maryada@gmail.com>
Sent: Monday, November 22, 2021 12:40
To: NEST User Mailing List <users@nest-simulator.org>
Subject: [NEST Users] Random seed in NEST 3.0
Dear NEST users,
As I understood from the documentation unless you set the seed using nest.rng_seed, nest.random.normal (for instance) should return the same value
nest.ResetKernel()
nest.rng_seed = 21#69696
v_m = nest.random.normal(mean=-51., std=10.)
v_m.GetValue()
In this code, I always receive the same v_m value for both cases, if the seed is set as 21 or 69696. The only time it changes is if I remove ResetKernel() call, which then is expected to return different values irrespective of rng_seed.
With this code below, I also got the same results irrespective of rng_seed value
nest.ResetKernel()
nest.rng_seed = 3333#69696
for _ in range(10):
v_m = nest.random.normal(mean=-51., std=10.)
print(v_m.GetValue())
So, maybe rng_seed doesn't reflect on nest.random.normal distribution. However, then how can I make sure it draws a different set of values?
--
Thanks and Regards
Maryada
_______________________________________________
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org
--Thanks and Regards
Maryada
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org