Multiplying two matrices of probabilities with different sizes.
Afficher commentaires plus anciens
Hi guys,
I have two matrices, with different sizes,that represents the probabilities of occurrence for two independent events. I want to create a new matrix that represent the probability of occurrence for these two events together. I tried multiplying the matrices,but the sum of the probabilities did not produce 1.
any Ideas? this is the code :
attributesize=4;
FileNumber=10;
BSTotal=7;
Files=exprnd(1,attributesize,FileNumber);
Files=Files./repmat(sum(Files,1),attributesize,1);
BS=exprnd(1,BSTotal,attributesize);
BS=BS./repmat(sum(BS,2),1,attributesize);
R= BS*Files;
5 commentaires
madhan ravi
le 23 Août 2018
Could you upload your code?
Walter Roberson
le 23 Août 2018
Are they 2D matrices, or are they vectors?
Haya A
le 23 Août 2018
Haya A
le 23 Août 2018
Réponses (1)
Kaushik Lakshminarasimhan
le 24 Août 2018
Modifié(e) : Kaushik Lakshminarasimhan
le 24 Août 2018
0 votes
I don't think there is anything wrong with your code. What is wrong is your interpretation of the outcome of multiplying your matrices.
Each entry of R denotes the probability that the file actually contains the attribute that the user requests. Specifically, R(i,j) denotes the probability that file number j contains the attribute that user number i requested. This number need not be 1. Also, the sum of columns or sum of rows of R need not be 1 --- the sums are not even probability values because they represent a sum of probabilities of events that are not mutually exclusive.
1 commentaire
Haya A
le 24 Août 2018
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!