Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SpeechCodebookAnalysis
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
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
SPEECH
SpeechCodebookAnalysis
Commits
24a0c493
Commit
24a0c493
authored
1 year ago
by
Julian Linke
Browse files
Options
Downloads
Patches
Plain Diff
no .eps and argument ERROR
parent
3ae7fe6b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
local/plot_pca_similarities.py
+6
-12
6 additions, 12 deletions
local/plot_pca_similarities.py
run.sh
+3
-3
3 additions, 3 deletions
run.sh
with
9 additions
and
15 deletions
local/plot_pca_similarities.py
+
6
−
12
View file @
24a0c493
...
...
@@ -35,7 +35,7 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
A
=
np
.
load
(
pcaA_path
)
b
=
np
.
load
(
pcab_path
)
print
(
'
\n
spkIDs:
\n
{}
'
.
format
(
spks
))
print
(
'
\n
input matrix:
\n
{}
'
.
format
(
X
))
print
(
'
\n
input matrix
X
:
\n
{}
'
.
format
(
X
))
labels
=
list
(
spks
)
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
15
,
15
))
...
...
@@ -45,7 +45,7 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
plt
.
yticks
(
range
(
len
(
labels
)),
labels
);
fig
.
colorbar
(
cax
,
ticks
=
[
0.1
,
0.2
,
0.3
,
0.4
,
0.5
,
0.6
,
0.7
,
.
8
,
.
9
,
1
])
fig_path
=
os
.
path
.
join
(
out_path
,
'
{}.png
'
.
format
(
X_path
.
split
(
'
/
'
)[
-
1
].
replace
(
'
.npy
'
,
''
)))
print
(
'
\n
save
fig
{}
'
.
format
(
fig_path
))
print
(
'
\n
save
similarity matrix to
{}
'
.
format
(
fig_path
))
plt
.
savefig
(
fig_path
)
colordict
=
{}
...
...
@@ -56,7 +56,6 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
spks_tmp
=
corpora
[
corpus
]
for
spk
in
spks_tmp
:
colordict
[
corpus
].
append
(
colors
[
idx
])
print
(
colordict
)
col
=
sum
([
lst
for
lst
in
colordict
.
values
()],
[])
print
(
"
\n
Project with PCA (3 dimensions) ...
"
)
...
...
@@ -82,14 +81,12 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
ax
.
legend
(
loc
=
'
center left
'
,
bbox_to_anchor
=
(
1.175
,
.
5
))
# Save the plot
fig_path
=
os
.
path
.
join
(
out_path
,
'
scatter3D_{}.png
'
.
format
(
X_path
.
split
(
'
/
'
)[
-
1
].
replace
(
'
.npy
'
,
''
)))
print
(
'
\n
save
fig
{}
'
.
format
(
fig_path
))
print
(
'
\n
save
3D scatter plot
{}
'
.
format
(
fig_path
))
plt
.
savefig
(
fig_path
)
fig_path
=
os
.
path
.
join
(
out_path
,
'
scatter3D_{}.eps
'
.
format
(
X_path
.
split
(
'
/
'
)[
-
1
].
replace
(
'
.npy
'
,
''
)))
print
(
'
save fig {}
'
.
format
(
fig_path
))
plt
.
savefig
(
fig_path
,
format
=
'
eps
'
)
plt
.
rcParams
.
update
({
'
font.size
'
:
50
})
for
proj
in
[(
0
,
1
),
(
0
,
2
),
(
1
,
2
)]:
print
(
f
"
\n
Project on dimensions
{
proj
}
"
)
x
,
y
=
X_proj
[:,
proj
[
0
]],
X_proj
[:,
proj
[
1
]]
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
18
,
16
))
...
...
@@ -109,11 +106,8 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
plt
.
grid
()
plt
.
tight_layout
()
fig_path
=
os
.
path
.
join
(
out_path
,
'
scatter_proj{}_{}.png
'
.
format
(
''
.
join
([
str
(
proj
[
0
]),
str
(
proj
[
1
])]),
X_path
.
split
(
'
/
'
)[
-
1
].
replace
(
'
.npy
'
,
''
)))
print
(
'
\n
save
fig
{}
'
.
format
(
fig_path
))
print
(
'
save
2D scatter plot
{}
'
.
format
(
fig_path
))
plt
.
savefig
(
fig_path
)
fig_path
=
os
.
path
.
join
(
out_path
,
'
scatter_proj{}_{}.eps
'
.
format
(
''
.
join
([
str
(
proj
[
0
]),
str
(
proj
[
1
])]),
X_path
.
split
(
'
/
'
)[
-
1
].
replace
(
'
.npy
'
,
''
)))
print
(
'
save fig {}
'
.
format
(
fig_path
))
plt
.
savefig
(
fig_path
,
format
=
'
eps
'
)
if
__name__
==
"
__main__
"
:
############################# FEATURES PATH ###########################
...
...
This diff is collapsed.
Click to expand it.
run.sh
+
3
−
3
View file @
24a0c493
...
...
@@ -8,8 +8,8 @@ set -e -o pipefail
.
path.sh
.
conda.sh
if
[[
$#
-eq
0
]]
;
then
echo
'ERROR: this run-script requires
an
argument
:
stage=?'
if
[[
$#
-eq
1
]]
;
then
echo
'ERROR: this run-script requires
two
argument
s: DATA=?
stage=?'
exit
1
fi
...
...
@@ -82,7 +82,7 @@ if [ $stage == 4 ] || [ $stage == 0 ]; then
$exp_dir
/numpy/similarity_matrix.npy
\
--output
$exp_dir
/numpy/pca
\
--dim
3
printf
"
\n
... PLOT ...
\n
"
printf
"
\n
... PLOT
similarity in PCA space (Analysis)
...
\n
"
python3
local
/plot_pca_similarities.py
\
$exp_dir
/numpy/similarity_matrix.npy
\
$exp_dir
/numpy/splits_labels.npy
\
...
...
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