1430ab58648b4bd189f232ae2acc8b86ce2fd9aa,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"):

After Change


def reducePCA(x, ndim):
	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]

////MAIN FUNCTION////
def reduce(arr,ndims=3, method="PCA"):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


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: ANSSI-FR/SecuML
Commit Name: 39efccc696a1c20745a52cc50935cdc24f92230d
Time: 2019-05-09
Author: anael.beaugnon@ssi.gouv.fr
File Name: secuml/core/classif/classifiers/__init__.py
Class Name: Classifier
Method Name: _predict_streaming


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