def _preprocess_data(self, data): X = self._feature_matrix(data) n = X.count() self.__means, var = column_statistics(X) var = var * (n - 1) / n X = RowMatrix(center(X, means=self.__means)) return X, self.__means, var
def _precision(data): logger.info("Computing precision") X = as_rdd_of_array(data.select("features")) X = RowMatrix(center(X)) pres = precision(X) return pres
def transform(self, data): X = self._feature_matrix(data) X = RowMatrix(center(X, self.__means)) return FactorAnalysisTransform(self._transform(data, X), self.model)
def _preprocess_data(self, data): X = self._feature_matrix(data) self.__means = column_means(X) return RowMatrix(center(X, means=self.__means))