ab4c3743ec1c77d67ddede9fb400b55b3778e39b,python/hypertools/reduce.py,,reducePCA,#Any#Any#,18

Before Change


	m=PCA(n_components=ndim, whiten=True)
	m.fit(np.vstack(x))

	r=[]
	for i in x:
		r.append(m.transform(i))
	return r

////MAIN FUNCTION////
def reduce(arr,ndims=3, method="PCA"):
    if method=="PCA":

After Change


	if np.isnan(np.vstack(x)).any():
		warnings.warn("Missing data: Inexact solution computed with PPCA (see https://github.com/allentran/pca-magic for details)")
		x_split= np.cumsum([i.shape[0] for i in x][:-1])
		m = PPCA(np.vstack(x))
		m.fit(d=ndim)
		x_pca = m.transform()
		return list(np.split(x_pca,x_split,axis=0))
	else:
		m=PCA(n_components=ndim, whiten=True)
		m.fit(np.vstack(x))
		return [m.transform(i) for i in x]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: ContextLab/hypertools
Commit Name: ab4c3743ec1c77d67ddede9fb400b55b3778e39b
Time: 2016-12-17
Author: andrew.heusser@gmail.com
File Name: python/hypertools/reduce.py
Class Name:
Method Name: reducePCA


Project Name: ContextLab/hypertools
Commit Name: 1430ab58648b4bd189f232ae2acc8b86ce2fd9aa
Time: 2016-12-17
Author: andrew.heusser@gmail.com
File Name: python/hypertools/reduce.py
Class Name:
Method Name: reducePCA


Project Name: explosion/thinc
Commit Name: afc71e321e8e849d27e9d3b2f053c9ead11fd171
Time: 2017-02-04
Author: honnibal@gmail.com
File Name: thinc/neural/vecs2vec.py
Class Name: MeanPooling
Method Name: predict