Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61656856
main.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, May 8, 03:29
Size
772 B
Mime Type
text/x-python
Expires
Fri, May 10, 03:29 (2 d)
Engine
blob
Format
Raw Data
Handle
17529990
Attached To
R10607 weightmatrices
main.py
View Options
import
torch
import
numpy
as
np
import
random
import
matplotlib
matplotlib
.
use
(
'TkAgg'
)
import
matplotlib.pyplot
as
plt
# own package
from
weightmatrices.utils
import
utils
from
weightmatrices.algos
import
pca
n_h
=
100
# replace by list of n_hs
################################################################################
data_loader
=
utils
.
load_data
()
W
=
pca
.
get_weightmatrices_pca
(
data_loader
,
n_h
)
plt
.
imshow
(
W
[
random
.
sample
(
range
(
0
,
n_h
),
1
)[
0
],
:]
.
reshape
(
28
,
28
),
cmap
=
'gray'
)
plt
.
show
()
################################################################################
import
os
if
not
os
.
path
.
exists
(
'./results'
):
os
.
mkdir
(
'./results'
)
np
.
save
(
'./results/pca_test.npy'
,
W
)
# jump to interactive mode
import
code
code
.
interact
(
local
=
locals
())
Event Timeline
Log In to Comment