In [1]:
from locore.identifiability import crit_nuclear

In [2]:
n1 = 30
n2 = n1
n = n1 * n2
rand_rank = lambda r: dot(randn(n1,r), randn(r,n2))

Plot transition curve as function of #measurements.


In [3]:
r = 4

Phase transition is bounded by Candes around $p=p0$


In [4]:
p0 = r*(3*n1 + 3*n2 - 5*r)

In [5]:
Plist = map(lambda x: int(round(x)), linspace(max(1,0.8*p0), min(n,1.2*p0), 20))
q = 5 # number of replication
IC = zeros((len(Plist), q))
for i in range(len(Plist)):
    p = Plist[i]
    for j in range(q):
        Phi = randn(p,n)
        X = rand_rank(r)
        IC[i, j] = crit_nuclear(Phi, X)[0]

In [6]:
plot( Plist, IC, 'k.' );
plot(Plist, mean(IC,axis=1));
plot( [min(Plist), max(Plist)], [1, 1], 'r--' );
plot( [p0, p0], [0, 2], 'g--' );
xlabel('P'); ylabel('mean IC');