pyMCR icon indicating copy to clipboard operation
pyMCR copied to clipboard

Is matrix augmentation supported

Open aminsagar opened this issue 3 years ago • 12 comments

Hello.

Is matrix augmentation supported like in MATLAB MCR-ALS? If not, is there a straightforward way to extend the code to allow row and column augmented matrices?

Thanks. Amin.

aminsagar avatar Sep 01 '20 15:09 aminsagar

@aminsagar Thanks for the question!

I'm not 100% familiar with the row- and column-wise data augmentation in the MCR-ALS package.

  • Do you have further information on what that means and your problem that needs it.
  • I have no doubt that the code could be extended to do it.

Thanks!

CCampJr avatar Sep 01 '20 15:09 CCampJr

Thanks for the response. I collect data using different techniques and different experiments. Generally, in MCR-ALS, data from different techniques, i.e. matrices with same concentrations but different spectra are joined row-wise, while data from different experiments, i.e different concentration but common spectra is joined column-wise. All this data augmentation is done to reduce ambiguity of the solutions. Screenshot_2020-09-01 mcr_2005 ppt - MCR_2005 pdf

aminsagar avatar Sep 01 '20 15:09 aminsagar

@aminsagar Great description.

I can see possible ways to implement it -- let me check into that.

I'll see what I can do to make that happen. Do you have the same constraints on your augmented matrices (e.g., sum-to-one, or non-negativity)?

CCampJr avatar Sep 01 '20 17:09 CCampJr

Thanks. It would be awesome if this could be implemented. I use non-negativity on all the matrices, for both concentrations and spectra. I actually don't use sum-to-one on all the matrices but using it is not essential for my problem.

Again, thanks a lot.

aminsagar avatar Sep 01 '20 20:09 aminsagar

@aminsagar

Sorry it's going to take a bit to implement this: just busy with work. If you have any coding expertise and want to take a crack at it, feel free -- always looking for collaborators.

Thanks again for bringing this to my attention: I wasn't aware of this "data augmentation" capabilities.

CCampJr avatar Sep 08 '20 13:09 CCampJr

@CCampJr No problem. I will try to implement a simple version of matrix augmentation first (all matrices having the same set of restraints) to see how hard it is for me.

aminsagar avatar Sep 08 '20 15:09 aminsagar

@CCampJr Sorry, I wanted to say I would try to implement a simple version with different restraints in only one dimension.

aminsagar avatar Sep 08 '20 15:09 aminsagar

@CCampJr @aminsagar

Is there any follow-up/new information on this issue?

HaasCP avatar Feb 19 '21 16:02 HaasCP

@CCampJr @aminsagar

Is there any follow-up/new information on this issue?

@HaasCP I haven't heard anything. Are you, too, interested in this?

CCampJr avatar Feb 19 '21 16:02 CCampJr

@CCampJr I might be but I am not quite sure, yet. Just looking in the pros and cons of implementing this package or using the R/MATLAB packages.

HaasCP avatar Feb 19 '21 16:02 HaasCP

@HaasCP Gotcha.

This package is a lot more flexible (matrix augmentation withstanding) than the MATLAB one because one can choose any algorithm for regression and constraints are easy to implement. That being said if the MATLAB one can do what you want then it's a very solid choice.

Admittedly, I've been too busy to take a crack at coding data augmentation, but I hope to get to it soon.

CCampJr avatar Feb 19 '21 16:02 CCampJr

@HaasCP @CCampJr I tried to modify the code but it was beyond my abilities atleast in the time frame I could dedicate to this. I completely agree with @CCampJr on the advantages of the package. While I couldn't modify pyMCR, I was able to write the code for decomposition with matrix augmentation rather easily using NNLS and some simple restraints that I require. As you know, the only requirement is to separate the decomposition and determination of convergence. Conceptually, it goes like this. while (number of iterations < max interations) for i in range (1,number of matrices) do NNLS for ith matrix apply restraints on ith matrix calculate residuals for the augmented matrix (d - augmented concentrations * augmented spectra) determine convergence

What I have works quite well for my problem but is not general at all. Unfortunately, I don't think I will be able to modify pyMCR to support this. Hoping @CCampJr gets some time to do this.

aminsagar avatar Feb 19 '21 17:02 aminsagar