def _transform(self, data, X): logger.info("Transforming data") loadings = self.model.loadings.T L = DenseMatrix(numRows=loadings.shape[0], numCols=loadings.shape[1], values=loadings.flatten(), isTransposed=True) data = join(data, X.multiply(L), self.spark) return data
def _transform(self, data, X): logger.info("Transforming data") loadings = self.model.loadings[:self.n_components] loadings = DenseMatrix(X.numCols(), self.n_components, loadings.flatten()) X = X.multiply(loadings) data = join(data, X, self.spark) del X return data
def _transform(self, data): logger.info("Transforming data") W = self.model.loadings[:, :self.n_components] W = DenseMatrix(numRows=W.shape[0], numCols=W.shape[1], isTransposed=True, values=W.flatten()) X = self._row_matrix(data).multiply(W) data = join(data, X, self.spark) del X return data
def _transform(self, data, X): logger.info("Transforming data") W = self.model.loadings psi = self.model.error_vcov Ih = numpy.eye(len(W)) Wpsi = W / psi cov_z = numpy.linalg.inv(Ih + numpy.dot(Wpsi, W.T)) tmp = numpy.dot(Wpsi.T, cov_z) tmp_dense = DenseMatrix(numRows=tmp.shape[0], numCols=tmp.shape[1], values=tmp.flatten(), isTransposed=True) X = X.multiply(tmp_dense) data = join(data, X, self.spark) del X return data