예제 #1
0
 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
예제 #2
0
 def _precision(data):
     logger.info("Computing precision")
     X = as_rdd_of_array(data.select("features"))
     X = RowMatrix(center(X))
     pres = precision(X)
     return pres
예제 #3
0
 def transform(self, data):
     X = self._feature_matrix(data)
     X = RowMatrix(center(X, self.__means))
     return FactorAnalysisTransform(self._transform(data, X), self.model)
예제 #4
0
 def _preprocess_data(self, data):
     X = self._feature_matrix(data)
     self.__means = column_means(X)
     return RowMatrix(center(X, means=self.__means))