Finding the correct coefficients by guessing

1 view (last 30 days)
I have a database of 30 matrices with size 100x100. When these matrices are multiplied with random coefficients between 0 and 1, I want to obtain a matrix whose correlation with my desired output matrix is the highest. For that purpose I wrote the following program
for jj = 1:20
rand_weights = rand(30,1);
trial_output = zeros(100,100);
for kk = 1:30
% database matrices are collected into a cell named "mybaseMatrices"
trial_output = trial_output + (rand_weights(kk) .* mybaseMatrices{kk});
end
trialOutput{jj} = trial_output; % All 20 trialOutput matrices are plotted after the for loop
end
This program creates 20 different random weight array set and also 20 different output matrices. Before looking at the 2D correlation I plotted these 20 output matrices and almost none of them was similar to my desired matrix profile.
I know that an exact solution will not exist under some conditions related to the matrix size and number of database matrices. This is not a problem since an exact solution is not desired in my case and in fact an approximate solution is more preferable: the plot of the matrix created by the program should be visually similar to the real output.
I tried decreasing the size of the matrices but at some point it destroys the image quality and so my intention is to keep it fixed at 100 (at least). Number of database matrices should be increased for a better guess but these matrices are taken from a separate program and their number depends on some other parameters which are chosen for a certain physical problem and it is not advised to change these parameters also. Still, I tried the same program with 50 and 100 database matrices but the results were similar: none of the trialOutput's were similar to the desired output matrix even with a naked eye and that's why I didn't wrote any code for 2D correlation.
So, my question is: are there any better ways for such an optimization problem? I think my problem is examined under a class called genetic algorithms and therefore I may need help from experts studying in that area.
  1 Comment
Rishabh Mishra
Rishabh Mishra on 2 Sep 2020
Can you elaborate on the points below?
  1. What is the criterion for similarity between two matrices?
  2. How is the real output matrix generated?
  3. What more information can be provided about the real output matrix?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!