本文整理汇总了Python中mne.preprocessing.ICA._fit方法的典型用法代码示例。如果您正苦于以下问题:Python ICA._fit方法的具体用法?Python ICA._fit怎么用?Python ICA._fit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.preprocessing.ICA
的用法示例。
在下文中一共展示了ICA._fit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ica_simple
# 需要导入模块: from mne.preprocessing import ICA [as 别名]
# 或者: from mne.preprocessing.ICA import _fit [as 别名]
def test_ica_simple(method):
"""Test that ICA recovers the unmixing matrix in a simple case."""
_skip_check_picard(method)
n_components = 3
n_samples = 1000
rng = np.random.RandomState(0)
S = rng.laplace(size=(n_components, n_samples))
A = rng.randn(n_components, n_components)
data = np.dot(A, S)
ica = ICA(n_components=n_components, method=method, random_state=0)
ica._fit(data, n_components, 0)
transform = np.dot(np.dot(ica.unmixing_matrix_, ica.pca_components_), A)
amari_distance = np.mean(np.sum(np.abs(transform), axis=1) /
np.max(np.abs(transform), axis=1) - 1.)
assert amari_distance < 0.1
示例2: test_ica_simple
# 需要导入模块: from mne.preprocessing import ICA [as 别名]
# 或者: from mne.preprocessing.ICA import _fit [as 别名]
def test_ica_simple(method):
"""Test that ICA recovers the unmixing matrix in a simple case."""
if method == "fastica":
try:
import sklearn # noqa: F401
except ImportError:
raise SkipTest("scikit-learn not installed")
_skip_check_picard(method)
n_components = 3
n_samples = 1000
rng = np.random.RandomState(0)
S = rng.laplace(size=(n_components, n_samples))
A = rng.randn(n_components, n_components)
data = np.dot(A, S)
ica = ICA(n_components=n_components, method=method, random_state=0)
ica._fit(data, n_components, 0)
transform = np.dot(np.dot(ica.unmixing_matrix_, ica.pca_components_), A)
amari_distance = np.mean(np.sum(np.abs(transform), axis=1) /
np.max(np.abs(transform), axis=1) - 1.)
assert amari_distance < 0.1