Skip to content
Snippets Groups Projects
Unverified Commit cf6ab3c9 authored by Lambert Theisen's avatar Lambert Theisen :rocket:
Browse files

fix projected GD

parent 517f99bb
Branches
Tags
No related merge requests found
Pipeline #494642 passed
...@@ -10,28 +10,6 @@ X = h5read("X.h5", "X") ...@@ -10,28 +10,6 @@ X = h5read("X.h5", "X")
A = h5read("A.h5", "A") A = h5read("A.h5", "A")
Y = h5read("Y.h5", "Y") Y = h5read("Y.h5", "Y")
# A_array = [A[i,:] for i in 1:size(A,1)]
# n, x = recovery_theta1(size(X), A_array, Y);
# x = reshape(x, size(X))
# relative_error(X,x)
# hosvd_x = hosvd(x);
# core = hosvd_x["core"]
# multirank(core)
# core
# core[abs.(core).<1e-5] .= 0
# multirank(core)
# hosvd_x["core"] = core
# x_re = hosvd_reconstruct(hosvd_x)
# @assert relative_error(X,x_re) < 1E-2
function projection(X, rank) function projection(X, rank)
hosvd_x = hosvd(X); hosvd_x = hosvd(X);
core_tmp = hosvd_x["core"] core_tmp = hosvd_x["core"]
...@@ -64,18 +42,3 @@ rank = 2 ...@@ -64,18 +42,3 @@ rank = 2
res = optimal_gradient_descent(ones(size(X)), 1, 5000, rank); res = optimal_gradient_descent(ones(size(X)), 1, 5000, rank);
relative_error(X, res.x) relative_error(X, res.x)
plot(res.hist, yaxis=:log, labels="resnorm") plot(res.hist, yaxis=:log, labels="resnorm")
# size_tensor = (3,3,3) # size of the tensor
# r = 1 # rank of the tensor
# coefs = randn(r) # coefficients of rank-1 tensors
# x0 = create_tensor_CP(size_tensor, coefs, "normal"); # create a rank-1 tensor by gaussian distribution
# m = 3^6-1 # number of measurements
# A, b = create_measurements(x0, m); # create gaussian linear measurements
# # A should be a list of length m, each elements is a flattened tensor, i.e. a vector indeed of size 4*4*4=64.
# # b is also a list of length m, each element is the number b_i = <A_i, x0>.
# n, x = recovery_theta1(size_tensor, A, b); # using nuclear-2 theta-1 norm minimization for recovery
# # n is the theta-1 norm, x is the recovered tensor
# x = reshape(x, size(x0))# reshape the recovered tensor to its original shape
# relative_error(x0,x) # compare the difference
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment