Rev | Line | |
---|
[37] | 1 | function y = error_free_tests(F,P,r,IP,n) |
---|
| 2 | % Create a rank r FxP matrix by multiplying random Fxr and rxP matrices together. |
---|
| 3 | % IP is fraction of data that will be missing from this matrix. We check |
---|
| 4 | % error produced by Shum algorithm n times, and return results. |
---|
| 5 | |
---|
| 6 | % KNOWN PROBLEM: If incidence matrix is so sparse that there aren't enough |
---|
| 7 | % values in each column and row something odd is happening. |
---|
| 8 | |
---|
| 9 | global Mexternal INCexternal |
---|
| 10 | |
---|
| 11 | for j = 1:n |
---|
| 12 | U = rand(F,r); |
---|
| 13 | V = rand(P,r); |
---|
| 14 | M = U*V'; |
---|
| 15 | INC = rand(F,P)>IP; |
---|
| 16 | valid_cols = find(sum(INC)>r); |
---|
| 17 | valid_rows = find(sum(INC')>r); |
---|
| 18 | M = M(valid_rows,valid_cols); |
---|
| 19 | Mexternal = M; |
---|
| 20 | INC = INC(valid_rows,valid_cols); |
---|
| 21 | INCexternal = INC; |
---|
| 22 | error_shum = shum(M,INC,r) |
---|
| 23 | y_shum = [y_shum;error_shum]; |
---|
| 24 | error_rank2 = rank2(M,INC) |
---|
| 25 | y_rank2 = [y_rank2;error_rank2]; |
---|
| 26 | end |
---|
| 27 | |
---|
| 28 | y = [y_shum, y_rank2]; |
---|
Note: See
TracBrowser
for help on using the repository browser.