Non-negative least square method is giving fixed values

I am trying the NNLS with my dataset to solve the a problem. The values are for each column remain same and no changes at all in each column. what is the possible exlanation for this?
I have adde the .mat adn .m file with the question. I could use SVD but the the values need to be positive as hey are concentration.
Any help will be appreciated.

6 Kommentare

Your code does not run. See below.
NNLS
Error using readtable (line 517)
Unable to find or open '/Users/gulfcarbon2/Desktop/BQL_field_data/Validation_HPLC/Reprojected_validation/Validation_Reproject/Total_kernel_size.xlsx'. Check the path and filename or file permissions.

Error in NNLS (line 1)
A = readtable('/Users/gulfcarbon2/Desktop/BQL_field_data/Validation_HPLC/Reprojected_validation/Validation_Reproject/Total_kernel_size.xlsx', 'ReadRowNames', true, 'PreserveVariableNames', true);
Arnab Paul
Arnab Paul am 28 Mai 2024
Bearbeitet: Arnab Paul am 28 Mai 2024
let me attach the excel sheets then.
The A variable is now standardized_aph.xlsx. Kindly change it accordingly.
Thank you
Matt J
Matt J am 28 Mai 2024
Bearbeitet: Matt J am 28 Mai 2024
It doesn't run. Please run the code for us, here in the online Matlab environment, to demonstrate the issue:
%upload the table
A = readtable('Total_kernel_size.xlsx', 'ReadRowNames', true, 'PreserveVariableNames', true);
A_matrix = table2array(A);
A_micro = readtable('interp_kernal_micro.xlsx', 'ReadRowNames', true, 'PreserveVariableNames', true);
A_nano = readtable('interp_kernal_nano.xlsx', 'ReadRowNames', true, 'PreserveVariableNames', true);
A_pico = readtable('interp_kernal_pico.xlsx', 'ReadRowNames', true, 'PreserveVariableNames', true);
%convert the table to array
A_matrix_micro = table2array(A_micro);
A_matrix_nano = table2array(A_nano);
A_matrix_pico = table2array(A_pico);
excel_file_aph = readtable('standardized_aph.xlsx', 'PreserveVariableNames', true);
excel_file_aph(:,1:9) = [];
excel_file_aph = table2array(excel_file_aph);
excel_file_aph = excel_file_aph.';
options = optimset('TolX', 1e-6);
x = zeros(size(A_matrix, 2), size(excel_file_aph, 2));
x_micro = zeros(size(A_matrix_micro, 2), size(excel_file_aph, 2));
x_nano = zeros(size(A_matrix_nano, 2), size(excel_file_aph, 2));
x_pico = zeros(size(A_matrix_pico, 2), size(excel_file_aph, 2));
for j = 1:size(excel_file_aph, 2)
%x(:, j) = lsqnonneg(A_matrix, excel_file_aph(:, j));
x_micro(:, j) = lsqnonneg(A_matrix_micro, excel_file_aph(:, j), options);
x_nano(:, j) = lsqnonneg(A_matrix_nano, excel_file_aph(:, j), options);
x_pico(:, j) = lsqnonneg(A_matrix_pico, excel_file_aph(:, j), options);
end
f_micro = x_micro./(x_micro+x_nano+x_pico);
f_nano = x_nano./(x_micro+x_nano+x_pico);
f_pico = x_pico./(x_micro+x_nano+x_pico);
disp(f_micro)
Columns 1 through 18 0.5506 0.5507 0.5520 0.5542 0.5538 0.5771 0.5689 0.5675 0.5695 0.5697 0.5705 0.5720 0.5647 0.5726 0.5698 0.5779 0.5734 0.5684 Columns 19 through 36 0.5633 0.5618 0.5610 0.5566 0.5544 0.5499 0.5676 0.5679 0.5700 0.5656 0.5660 0.5551 0.5601 0.5469 0.5453 0.5431 0.5445 0.5590 Columns 37 through 54 0.5539 0.5508 0.5664 0.5813 0.5796 0.5793 0.5767 0.5730 0.5715 0.5611 0.5673 0.5563 0.5718 0.5798 0.5811 0.5816 0.5808 0.5722 Columns 55 through 72 0.5662 0.5556 0.5675 0.5672 0.5767 0.5790 0.5755 0.5714 0.5668 0.5740 0.5518 0.5455 0.5408 0.5438 0.5784 0.5707 0.5747 0.5750 Columns 73 through 90 0.5682 0.5794 0.5759 0.5797 0.5661 0.5640 0.5545 0.5505 0.5429 0.5389 0.5695 0.5649 0.5740 0.5399 0.5744 0.5683 0.5502 0.5733 Columns 91 through 108 0.5686 0.5327 0.5664 0.5709 0.5715 0.5523 0.5738 0.5705 0.5463 0.5458 0.5443 0.5407 0.5444 0.5705 0.5597 0.5407 0.5388 0.5641 Columns 109 through 126 0.5385 0.5371 0.5384 0.5682 0.5692 0.5457 0.5345 0.5476 0.5691 0.5617 0.5418 0.5405 0.5435 0.5461 0.5378 0.5420 0.5630 0.5540 Columns 127 through 144 0.5522 0.5560 0.5444 0.5436 0.5427 0.5522 0.5442 0.5576 0.5605 0.5568 0.5503 0.5604 0.5493 0.5432 0.5404 0.5446 0.5528 0.5521 Columns 145 through 162 0.5502 0.5530 0.5559 0.5495 0.5483 0.5435 0.5429 0.5583 0.5341 0.5379 0.5404 0.5328 0.5401 0.5405 0.5484 0.5744 0.5685 0.5716 Columns 163 through 180 0.5727 0.5687 0.5736 0.5640 0.5745 0.5752 0.5726 0.5681 0.5670 0.5667 0.5593 0.5660 0.5657 0.5454 0.5594 0.5725 0.5763 0.5588 Columns 181 through 198 0.5690 0.5676 0.5730 0.5681 0.5710 0.5689 0.5758 0.5773 0.5760 0.5745 0.5723 0.5730 0.5712 0.5699 0.5536 0.5440 0.5454 0.5684 Columns 199 through 205 0.5666 0.5703 0.5628 0.5641 0.5625 0.5582 0.5768
Hi @Matt J I ran it successfully, the question is why f_micro/nano/pico coming almost same throughout the columns? What is the mathematical explanation for this?
Thanks for your help.
Maybe your input data don't differ very much.
They are actually different. Even though is it possible to have the monotonous values all across the column?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Nipun
Nipun am 11 Jun. 2024

0 Stimmen

Hi Arnab,
I understand that you are experience an issue with NNLS (Non-Negative Least Squares) where the values for each column remain unchanged. This issue might be due to several factors, such as:
  1. Insufficient variability in the data.
  2. Constraints not properly applied.
  3. Issues with the initial guess or convergence criteria.
For more details on NNLS, you can refer to the following MathWorks documentation link: https://www.mathworks.com/help/matlab/ref/lsqnonneg.html
Hope this helps.
Regards,
Nipun

Weitere Antworten (0)

Produkte

Version

R2023b

Gefragt:

am 27 Mai 2024

Beantwortet:

am 11 Jun. 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by