本文整理汇总了Python中sklearn.decomposition.FastICA.get_params方法的典型用法代码示例。如果您正苦于以下问题:Python FastICA.get_params方法的具体用法?Python FastICA.get_params怎么用?Python FastICA.get_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.decomposition.FastICA
的用法示例。
在下文中一共展示了FastICA.get_params方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ICA
# 需要导入模块: from sklearn.decomposition import FastICA [as 别名]
# 或者: from sklearn.decomposition.FastICA import get_params [as 别名]
class ICA(object):
"""
Wrapper for sklearn package. Performs fast ICA (Independent Component Analysis)
ICA has 4 methods:
- fit(waveforms)
update class instance with ICA fit
- fit_transform()
do what fit() does, but additionally return the projection onto ICA space
- inverse_transform(A)
inverses the decomposition, returns waveforms for an input A, using Z
- get_params()
returns metadata used for fits.
"""
def __init__(self, num_components=10,
catalog_name='unknown',
whiten=True,
fun = 'logcosh',
fun_args = None,
max_iter = 600,
tol = .00001,
w_init = None,
random_state = None,
algorithm = 'parallel'):
self._decomposition = 'Fast ICA'
self._num_components = num_components
self._catalog_name = catalog_name
self._whiten = whiten
self._fun = fun
self._fun_args = fun_args
self._max_iter = max_iter
self._tol = tol
self._w_init = w_init
self._random_state = random_state
self._algorithm = algorithm
self._ICA = FastICA(n_components=self._num_components,
whiten = self._whiten,
fun = self._fun,
fun_args = self._fun_args,
max_iter = self._max_iter,
tol = self._tol,
w_init = self._w_init,
random_state = self._random_state,
algorithm = self._algorithm)
def fit(self,waveforms):
# TODO make sure there are more columns than rows (transpose if not)
# normalize waveforms
self._waveforms = waveforms
self._ICA.fit(self._waveforms)
def fit_transform(self,waveforms):
# TODO make sure there are more columns than rows (transpose if not)
# normalize waveforms
self._waveforms = waveforms
self._A = self._ICA.fit_transform(self._waveforms)
return self._A
def inverse_transform(self,A):
# convert basis back to waveforms using fit
new_waveforms = self._ICA.inverse_transform(A)
return new_waveforms
def get_params(self):
# TODO know what catalog was used! (include waveform metadata)
params = self._ICA.get_params()
params['num_components'] = params.pop('n_components')
params['Decompositon'] = self._decomposition
return params
def get_basis(self):
""" Return the ICA basis vectors (Z^\dagger)"""
return self._ICA.get_mixing_matrix()