Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120923797
ica.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
Mon, Jul 7, 21:00
Size
691 B
Mime Type
text/x-python
Expires
Wed, Jul 9, 21:00 (2 d)
Engine
blob
Format
Raw Data
Handle
27268656
Attached To
R10607 weightmatrices
ica.py
View Options
# Independent Component Analysis
from
sklearn.decomposition
import
FastICA
from
weightmatrices.utils
import
utils
def
get_ica_trafo_matrix
(
data_matrix
,
n_h
):
transformer
=
FastICA
(
n_components
=
n_h
,
tol
=
0.001
)
data_transformed
=
transformer
.
fit_transform
(
data_matrix
)
return
transformer
.
components_
def
get_weightmatrices_ica
(
data_matrix
,
n_h
):
print
(
"creating weigth matrix for ICA for "
+
str
(
n_h
)
+
" hidden neurons..."
)
n_in_features
=
data_matrix
.
shape
[
1
]
assert
n_h
<=
n_in_features
,
"Number of requested independent components higher than input dimensionality!"
W
=
get_ica_trafo_matrix
(
data_matrix
,
n_h
)
W
=
utils
.
normalise_weightmatrix
(
W
)
return
W
Event Timeline
Log In to Comment