本文整理汇总了Python中sklearn.decomposition.FastICA.n_neighbors方法的典型用法代码示例。如果您正苦于以下问题:Python FastICA.n_neighbors方法的具体用法?Python FastICA.n_neighbors怎么用?Python FastICA.n_neighbors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.decomposition.FastICA
的用法示例。
在下文中一共展示了FastICA.n_neighbors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_model
# 需要导入模块: from sklearn.decomposition import FastICA [as 别名]
# 或者: from sklearn.decomposition.FastICA import n_neighbors [as 别名]
def get_model(method, n=None, n_neighbors=None, max_iter=None, random_state=None, n_jobs=None, method_args=None):
model = None
kwargs = {}
if method_args is not None:
for arg_pair in method_args:
arg_par = arg_pair.split('=')
kwargs[arg_pair[0].trim()] = arg_pair[1].trim()
if method == 'ICA':
model = FastICA(whiten=True, **kwargs)
elif method == 'ICAexp':
model = FastICA(whiten=True, fun='exp', **kwargs)
elif method == 'ICAcube':
model = FastICA(whiten=True, fun='cube', **kwargs)
elif method == 'PCA':
model = PCA()
elif method == 'SPCA':
model = SparsePCA()
if n_jobs is not None:
model.n_jobs = n_jobs
elif method == 'NMF':
model = NMF(solver='cd')
elif method == 'ISO':
model = Isomap()
elif method == 'KPCA':
model = KernelPCA(kernel='rbf', fit_inverse_transform=False, gamma=1, alpha=0.0001)
elif method == 'FA':
#model = FactorAnalysis(svd_method='lapack') #(tol=0.0001, iterated_power=4)
model = FactorAnalysis(tol=0.0001, iterated_power=4)
elif method == 'DL':
model = DictionaryLearning(split_sign=True, fit_algorithm='cd', alpha=1)
if n_jobs is not None:
model.n_jobs = n_jobs
if n is not None:
model.n_components = n
if max_iter is not None:
model.max_iter = max_iter
if random_state is not None:
model.random_state = random_state
if n_neighbors is not None:
model.n_neighbors = n_neighbors
return model