Back to the main page.

# Bug 2747 - subspace projection not applied in beamformer_lcmv with subspace<1, and inconsistent regularization (lambda)

Status | CLOSED FIXED |

Reported | 2014-10-27 21:23:00 +0100 |

Modified | 2019-04-01 08:56:47 +0200 |

Product: | FieldTrip |

Component: | inverse |

Version: | unspecified |

Hardware: | PC |

Operating System: | Windows |

Importance: | P5 normal |

Assigned to: | Jan-Mathijs Schoffelen |

URL: | |

Tags: | |

Depends on: | |

Blocks: | |

See also: |

## Marc Lalancette - 2014-10-27 21:23:24 +0100

There are some inconsistencies in how regularization (using the lambda parameter) is applied for various types of "subspace projection" in beamformer_lcmv: 1.1 Bug: Line 190 should be end, not else: that "if" block converts a "fraction of largest eigenvalue" to an eigenvalue index, the following lines actually do the projection. So as is, no projection is done for subspace<1. 1.2 Regularization is absent in invCy with "data-specific" subspace projection: line 194: invCy = diag(1./diag(Cy)); 1.3 With "dip.subspace" (source-specific subspace projection) the covariance includes regularization: line 235: Cy = dip.subspace{i} * (Cy_pre_subspace + lambda * eye(size(Cy_pre_subspace))) * dip.subspace{i}'; So power and such have regularization as well as the filter. Other subspace options (including no subspace) do not add regularization to covariance (as I think it should be), only in the inverse covariance for filter computation.

## Jan-Mathijs Schoffelen - 2014-10-30 13:15:34 +0100

Hi Marc, We did not manage to discuss your points during yesterday's meeting. If I have some spare time this week, I'll look into it myself. At first glance your points seem very reasonable indeed.

## Robert Oostenveld - 2014-11-08 12:50:35 +0100

Hi Marc, Re 1.1, fixed. Re 1.2, I changed that into invCy = diag(1./diag(Cy + lambda * eye(size(Cy)))); Re 1.3, it is not clear to me what the exact issue is and whether something needs to be done. Perhaps you or Jan-Mathijs can comment. --- mac011> svn commit beamformer_lcmv.m Sending beamformer_lcmv.m Transmitting file data . Committed revision 9943.

## Marc Lalancette - 2014-11-10 17:15:41 +0100

Created attachment 674 Further fixed beamformer_lcmv for source-specific subspace projection Made "source-specific" subspace projection compatible with "data-specific" subspace projection in terms of keepfilter and keepleadfield options. Also removed "regularization" of the covariance matrix with this projection method, only inverse matrix should be regularized, as is the case when this option is not used.

## Marc Lalancette - 2014-11-10 17:17:38 +0100

(In reply to Robert Oostenveld from comment #2) Thanks for the updates Robert. To clarify 1.3, without getting too technical, only the inverse covariance should have the regularization added. Adding regularization to the covariance matrix is equivalent to adding noise in the data after computing the weights, which I am pretty sure has no beneficial effect at all and reduces SNR. So I'd replace line 232: Cy = dip.subspace{i} * (Cy_pre_subspace + lambda * eye(size(Cy_pre_subspace))) * dip.subspace{i}'; with: Cy = dip.subspace{i} * Cy_pre_subspace * dip.subspace{i}'; Although I don't use it, I also saw that the "source-specific subspace projection", i.e. isfield(dip, 'subspace'), wasn't completely implemented with some other options: keepfilter keeps the projected filter with "data-specific" and non-projected with "source-specific"; and keepleadfield keeps the non-projected leadfield with "data-specific" and the projected one with "source-specific". Thus I've fixed this (and the above) in the file I just attached. Cheers, Marc

## Marc Lalancette - 2014-11-10 17:25:01 +0100

Created attachment 675 Fixed beamformer_lcmv (As previous submission, which was missing the covariance fix.)