-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryError in unfolding for many bins #97
Comments
Thanks for reporting this
Do you have an interest in implementing this? Perhaps @zhampel has some thoughts on this topic as well. |
Unfortunately I doubt that I have the skills to do that. But I had two questions/comments/ideas: First, on the implementation in RooUnfold:I tried to understand the implementation in I tried it out (with Now, if I understand it correctly, doesn't that implementation "only" need a matrix of shape if (_dosys) _dnCidPjk.ResizeTo(_nc,_ne*_nc);
if (_dosys) _dnCidPjk.ResizeTo(_nc,_ne*_nc);
https://github.com/hep-mirrors/RooUnfold/blob/fa7c56cb1a55da75c7879119cbb93b2862e9f480/src/RooUnfoldBayes.cxx#L179
if (_dosys) {
if (verbose()>=1) cout << "Calculating covariance due to unfolding matrix..." << endl;
const TMatrixD& Eres= _res->Eresponse();
TVectorD Vjk(_ne*_nc); // vec(Var(j,k))
for (Int_t j = 0 ; j < _ne ; j++) {
Int_t j0= j*_nc;
for (Int_t i = 0 ; i < _nc ; i++) {
Double_t e= Eres(j,i);
Vjk[j0+i]= e*e;
}
}
if (_dosys!=2) {
TMatrixD covres(_nc,_nc);
ABAT (_dnCidPjk, Vjk, covres);
_cov += covres;
} else {
_cov.ResizeTo (_nc, _nc);
ABAT (_dnCidPjk, Vjk, _cov);
}
} Computation time:Now, when calculating the systematic errors wit h RooUnfold for a larger matrix (#effect bins = #cause bins = 700), this was still possible (so, no memory error), but it takes a considerable amount of cpu time; about 1h-2h on this pc for 2 iterations. As I want to use the unfolding on a problem where I expect to unfold between 20-10.000 different spectra, I think it may be interesting to be able to turn off the systematic error calculation. At least for a rough data-analysis with the possibility to get back to a more precise answer later. |
I tried running the tutorial (Basic API Tutorial) with more bins. Above ~200 bins, I receive a MemoryError when I run
iterative_unfold
.I tried another implementation of the iterative Bayesian unfolding algorithm in
RooUnfold
, which easily runs more then 1000s of bins -- of course taking some time. A difference there is that the systematic errors are not computed.Now I see that creating a covariance matrix of type
CovPP = np.zeros((cbins * ebins, cbins * ebins))
takes lots of memory. Still, in multidimensional problems, one quickly runs over 100 bins. So I wonder if one could turn off systematic error calculation with a keyword.A more advances version would be if one could (optionally) handle the covariance matrix through submatrices, eg fox algorithm or numpy.memmap to memory map a file on disk. This would slow down the calculations, but maybe better slow than impossible.
Alternatively I have to look for a nice cluster with some hugemem coputer nodes.)
The text was updated successfully, but these errors were encountered: