Back to the main page.

Bug 1274 - complete the CSP implementation in ft_componentanalysis

Reported 2012-01-22 12:24:00 +0100
Modified 2012-06-20 15:03:24 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: All
Importance: P3 enhancement
Assigned to: Boris Reuderink
Depends on:
See also:

Robert Oostenveld - 2012-01-22 12:24:24 +0100

I came across this page, which reminded me that there is an implementation already, but it has not been tested. I think that it only takes a small amount of time to complete it. TODO - verify correctness of the implementation - cerate test script - add documentation to ft_componentanalysis - flag the page as done and move it to the DONE list on OPTIONAL - consider whether (and if so: how) this can be made relevant for realtime processing

Robert Oostenveld - 2012-01-22 12:25:22 +0100

I suggest that Boris takes this enhancement on him, as he has experience with the CSP method (as I learned from his PhD thesis).

Boris Reuderink - 2012-01-23 08:52:30 +0100

I'll take care of this issue, and indeed it won't take much time. BTW, since it hinges mostly on a whitening transform, I was wondering if there are other places that use a whitening transform that could benefit from the factored out and tested implementation? Ft_component_analysis.m mentions a prewhitening_filter2, but I can't find much more.

Robert Oostenveld - 2012-01-23 09:15:15 +0100

I don't see a prewhitening_filter2 in ft_componentanalysis... At this moment the prewhitening is done inside the already existing low-level csp function. I believe this to be appropriate: the intended use of ft_componentanalysis is not to do the spatial unmixing in multiple steps, but rather in one, and the interest is only in the final step.

Boris Reuderink - 2012-01-23 12:51:50 +0100

Sorry, my mistake. I meant ft_sourceanalysis: $ grep -n whiten ft_sourceanalysis.m ... 407: Cf = prewhitening_filter2(squeeze(mean(Cf,1)), squeeze(mean(Cfb,1))); Since I can't find more, there is not much to factor out thus my point is moot.

Robert Oostenveld - 2012-01-23 13:44:15 +0100

(In reply to comment #4) The prewhitening_filter2 function appears to be missing from the repository. I reported the missing function as bug 1277.

Robert Oostenveld - 2012-01-24 20:50:33 +0100

given that % additional options, see CSP for details cfg.csp = ft_getopt(cfg, 'csp', []) cfg.csp.numfilters = ft_getopt(cfg.csp, 'numfilters', 6) I suggest that the cfg.classlabel is moved to cfg.csp.classlabel which is also more consistent with other method-nested options.

Boris Reuderink - 2012-02-01 16:47:24 +0100

Fixed in SVN revision 5218.

Robert Oostenveld - 2012-02-04 11:01:16 +0100

the test_csp script does not test any fieldtrip function. I suggest to keep the current code, but extend it with something like data = []; data.label = {'1', '2', ... data.trial = {X1, X2}; data.time = {1:n, 1:n} and then cfg = []; cfg.method = 'csp' cfg.csp.classlabel= [1 2]; comp = ft_componentanalysis(cfg, data) and subsequently check that the output is consistent with the manually crafted result. Please also add % TEST test_csp % TEST ft_componenanalysis csp to ensure that the test script is correctly triggered upon changes.

Boris Reuderink - 2012-02-23 13:16:52 +0100

I have added a test for ft_component_analysis, and added the 'TEST *' keywords: svn ci -m "bugfix - added extra test for CSP (bug 1274)" test/test_csp.m ft_componentanalysis.m Sending ft_componentanalysis.m Sending test/test_csp.m Transmitting file data .. Committed revision 5313.

Boris Reuderink - 2012-06-20 15:03:24 +0200

Changed my resolved bugs to closed.