source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/error_free_tests.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 830 bytes
Line 
1function 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
9global Mexternal INCexternal
10
11for 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);
19Mexternal = M;
20  INC = INC(valid_rows,valid_cols);
21INCexternal = 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];
26end
27
28y = [y_shum, y_rank2];
Note: See TracBrowser for help on using the repository browser.