[FieldTrip] Setting cfg.randomseed for FT_COMPONENTANALYSIS() doesn't reproduce components for cfg.method='runica'

Holger Krause Holger.Krause at med.uni-duesseldorf.de
Wed Feb 4 17:24:15 CET 2015


Dear all,

documentation of FT_COMPONENTANALYSIS states:

> You may specify a particular seed for random numbers called by
> rand/randn/randi, or the random state used by a previous call to this
> function to replicate results. For example:
>   cfg.randomseed   = integer seed value of user's choice
>   cfg.randomseed   = comp.cfg.callinfo.randomseed (from previous call)

Aiming at reproducing independent components, I would expect

    cfg.method       = 'runica';     
    cfg.randomseed   = 5;
    comp = ft_componentanalysis(cfg, some_preprocessed_data); 

to yield the same results as

    cfg.method       = 'runica';     
    cfg.randomseed   = 5;
    comp = ft_componentanalysis(cfg, some_preprocessed_data); 

Unfortunately, this is not (always) the case. As far as I can see, all the FT 
functions seem to handle the 'randomseed' option properly. It is 
'external/eeglab/runica.m', which is nasty, and sets the state of the prng to 
a value depending on system time (line 812):

>    rand('state',sum(100*clock));  % set the random number generator state to
>                               % a position dependent on the system clock

I'm not sure, what's FT's policy regarding making changes to external 
toolboxes. In this case, I would recommend to delete the aforementioned line, 
as it effectively renders fieldtrip's aims to have reproducible pseudo random 
numbers void. And, without this line, two consecutive calls of 
ft_componentanalysis() seem to produce identical results (checked by eye in 
ft_databrowser()).

Could some FT developer please comment on this?

Cheers,

Holger

-- 
Dr. rer. nat. Holger Krause                       MEG-Labor, Raum 13.54.-1.84
Telefon: +49 211 81-19031          Institut für klinische Neurowissenschaften
http://www.uniklinik-duesseldorf.de/klinneurowiss        Uniklinik Düsseldorf




More information about the fieldtrip mailing list