Skip to content

Instantly share code, notes, and snippets.

View tachim's full-sized avatar

Tudor Achim tachim

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tachim on github.
  • I am 10 (https://keybase.io/10) on keybase.
  • I have a public key whose fingerprint is B634 EA44 D87C 6992 A07E 2EFF 125C 4B84 7BAA C5B2

To claim this, I am signing this object:

def soft_threshold(x, t):
x = x.copy()
x[np.where(np.abs(x) < t)] = 0 x[np.where(x > 0)] -= t
x[np.where(x < 0)] += t
return x
def render_vector_sparsity(final_z):
zb = final_z.copy()
zb[zb != 0] = 1
wb = w.copy()
wb[wb != 0] = 1
plt.imshow(((zb != wb).reshape((50, 100))))
print (zb != wb).sum(), 'different'
M = 1500
N = 5000
RHO = 1
LAMBDA = 20
w = np.zeros((N,))
for i in xrange(N):
if np.random.random() < 0.1:
w[i] = np.random.random() * 10
A = np.random.standard_normal((M, N))
b = A.dot(w)