Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SparseTensorMoments.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lambert Theisen
SparseTensorMoments.jl
Commits
cf6ab3c9
Unverified
Commit
cf6ab3c9
authored
7 months ago
by
Lambert Theisen
Browse files
Options
Downloads
Patches
Plain Diff
fix projected GD
parent
517f99bb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#494642
passed
7 months ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/reconstruct/test-projected-gd.jl
+0
-37
0 additions, 37 deletions
examples/reconstruct/test-projected-gd.jl
with
0 additions
and
37 deletions
examples/reconstruct/test-projected-gd.jl
+
0
−
37
View file @
cf6ab3c9
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment