Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
faust group
faust
Commits
d55e0ba5
Commit
d55e0ba5
authored
6 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Plot RC/density instead of RCG.
parent
0b037e09
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
misc/test/src/Python/test_sparse_faust_size_vs_rc.py
+6
-6
6 additions, 6 deletions
misc/test/src/Python/test_sparse_faust_size_vs_rc.py
misc/test/src/Python/test_svd_rc_vs_err.py
+13
-12
13 additions, 12 deletions
misc/test/src/Python/test_svd_rc_vs_err.py
with
19 additions
and
18 deletions
misc/test/src/Python/test_sparse_faust_size_vs_rc
g
.py
→
misc/test/src/Python/test_sparse_faust_size_vs_rc.py
+
6
−
6
View file @
d55e0ba5
...
...
@@ -10,7 +10,7 @@ if __name__ == '__main__':
min_dim_sz
=
1000
max_dim_sz
=
1000
sizes
=
[]
rc
g
s
=
[]
rcs
=
[]
ntests
=
100
for
i
,
d
in
zip
(
list
(
range
(
0
,
ntests
)),
...
...
@@ -22,12 +22,12 @@ if __name__ == '__main__':
F
.
save
(
filepath
)
stat
=
os
.
stat
(
filepath
)
sizes
.
append
(
stat
.
st_size
)
rc
g
s
.
append
(
F
.
RCG
())
rcs
.
append
(
F
.
density
())
os
.
remove
(
filepath
)
plt
.
title
(
'
File Size vs RC
G
for Pure-Sparse Fausts
\n
(
'
+
str
(
nfactors
)
+
'
'
plt
.
title
(
'
File Size vs RC for Pure-Sparse Fausts
\n
(
'
+
str
(
nfactors
)
+
'
'
'
random factors
'
+
str
(
min_dim_sz
)
+
'
x
'
+
str
(
max_dim_sz
)
+
'
)
'
)
plt
.
xlabel
(
'
Relative Complexity
Gain (RCG)
'
)
plt
.
xlabel
(
'
Relative Complexity
/Density
'
)
plt
.
ylabel
(
'
File Size (bytes)
'
)
#plt.scatter(rc
g
s, sizes, s=1)
plt
.
plot
(
rc
g
s
,
sizes
)
#plt.scatter(rcs, sizes, s=1)
plt
.
plot
(
rcs
,
sizes
)
plt
.
show
()
This diff is collapsed.
Click to expand it.
misc/test/src/Python/test_svd_rc
g
_vs_err.py
→
misc/test/src/Python/test_svd_rc_vs_err.py
+
13
−
12
View file @
d55e0ba5
...
...
@@ -15,7 +15,7 @@ from scipy.linalg import svd
class
TruncSvd
(
Thread
):
def
__init__
(
self
,
offset
,
M
,
U
,
S
,
V
,
r
,
errs
,
rc
g
s
):
def
__init__
(
self
,
offset
,
M
,
U
,
S
,
V
,
r
,
errs
,
rcs
):
Thread
.
__init__
(
self
)
self
.
offset
=
offset
self
.
M
=
M
...
...
@@ -24,7 +24,7 @@ class TruncSvd(Thread):
self
.
S
=
S
self
.
r
=
r
self
.
errs
=
errs
self
.
rc
g
s
=
rc
g
s
self
.
rcs
=
rcs
def
run
(
s
):
S
=
np
.
zeros
([
s
.
U
.
shape
[
1
],
s
.
V
.
shape
[
0
]])
...
...
@@ -33,9 +33,10 @@ class TruncSvd(Thread):
# assert((abs(M - s.U.dot(S).dot(s.V))/abs(s.M) < .01).all())
while
(
s
.
r
<=
min
(
s
.
M
.
shape
[
0
],
s
.
M
.
shape
[
1
])):
s
.
Mr
=
(
s
.
U
[:,
0
:
s
.
r
].
dot
(
S
[
0
:
s
.
r
,
0
:
s
.
r
])).
dot
(
s
.
V
[
0
:
s
.
r
,
:])
#s.errs[0, s.r-1] = S[s.r-1,s.r-1] / S[0,0]
s
.
errs
[
0
,
s
.
r
-
1
]
=
norm
(
s
.
M
-
s
.
Mr
,
'
fro
'
)
/
norm
(
s
.
M
,
'
fro
'
)
s
.
rc
g
s
[
0
,
s
.
r
-
1
]
=
s
.
M
.
shape
[
0
]
*
s
.
M
.
shape
[
1
]
s
.
rc
g
s
[
0
,
s
.
r
-
1
]
/=
(
s
.
r
*
(
s
.
M
.
shape
[
0
]
+
s
.
M
.
shape
[
1
]
))
s
.
rcs
[
0
,
s
.
r
-
1
]
=
(
s
.
r
*
(
s
.
M
.
shape
[
0
]
+
s
.
M
.
shape
[
1
]
))
s
.
rcs
[
0
,
s
.
r
-
1
]
/=
s
.
M
.
shape
[
0
]
*
s
.
M
.
shape
[
1
]
s
.
r
+=
s
.
offset
...
...
@@ -47,26 +48,26 @@ if __name__ == '__main__':
n
=
int
(
argv
[
2
])
nthreads
=
8
errs
=
np
.
zeros
([
1
,
min
(
m
,
n
)])
rc
g
s
=
np
.
zeros
([
1
,
min
(
m
,
n
)])
rcs
=
np
.
zeros
([
1
,
min
(
m
,
n
)])
M
=
rand
(
m
,
n
)
U
,
S
,
V
=
svd
(
M
)
ths
=
list
()
for
i
in
range
(
1
,
nthreads
+
1
):
th
=
TruncSvd
(
nthreads
,
M
,
U
,
S
,
V
,
i
,
errs
,
rc
g
s
)
th
=
TruncSvd
(
nthreads
,
M
,
U
,
S
,
V
,
i
,
errs
,
rcs
)
ths
.
append
(
th
)
th
.
start
()
for
th
in
ths
:
th
.
join
()
plt
.
scatter
(
rc
g
s
[
0
,
:],
errs
[
0
,
:],
s
=
1
)
plt
.
scatter
(
rcs
[
0
,
:],
errs
[
0
,
:],
s
=
1
)
# plt.gca().set_xscale('log', basex=.5)
plt
.
gca
().
invert_xaxis
()
plt
.
xlabel
(
'
Relative Complexity
Gain (RCG)
'
)
#
plt.gca().invert_xaxis()
plt
.
xlabel
(
'
Relative Complexity
/Density
'
)
plt
.
ylabel
(
'
Relative Error
'
)
plt
.
title
(
'
Relative Error over RC
G
of Truncated SVDs for a dense matrix M (
'
plt
.
title
(
'
Relative Error over RC of Truncated SVDs for a dense matrix M (
'
+
str
(
m
)
+
'
x
'
+
str
(
n
)
+
'
)
'
)
# f = open("svd_err_vs_rcg_output_"+str(nthreads), "w")
# for i in range(0,errs.shape[1]):
# f.write(str(errs[0,i])+" "+str(rc
g
s[0,i])+"\n")
# f.write(str(errs[0,i])+" "+str(rcs[0,i])+"\n")
# f.close()
#
plt.plot(rc
g
s, errs)
#plt.plot(rcs, errs)
plt
.
show
()
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