def test_PCA(self): """ Regression test. """ trajectory_handler = TrajectoryHandlerStub(testPCAMetric.not_iterposed_coordsets,66) clustering = Clustering([Cluster(None,range(6)),Cluster(None,range(6,12))], "a clustering") pcaMetric = PCAMetric(trajectory_handler) self.assertAlmostEquals(pcaMetric.evaluate(clustering), 1.427748687873, 12)
def test_eigenvalues(self): # do it with PCA metric my_cov_matrix = PCAMetric.create_covariance_matrix(testPCAMetric.coordsets) biggest_eigenvalue = PCAMetric.calculate_biggest_eigenvalue(my_cov_matrix) # Do it with prody pca = prody.PCA('pcametric_pca') pca.buildCovariance(testPCAMetric.ensemble) pca.calcModes(n_modes=1) self.assertAlmostEqual(pca.getEigvals()[0], biggest_eigenvalue,10)
def test_PCA(self): """ Regression test. """ trajectory_handler = TrajectoryHandlerStub( testPCAMetric.not_iterposed_coordsets, 66) clustering = Clustering( [Cluster(None, range(6)), Cluster(None, range(6, 12))], "a clustering") pcaMetric = PCAMetric(trajectory_handler) self.assertAlmostEquals(pcaMetric.evaluate(clustering), 1.427748687873, 12)
def test_eigenvalues(self): # do it with PCA metric my_cov_matrix = PCAMetric.create_covariance_matrix( testPCAMetric.coordsets) biggest_eigenvalue = PCAMetric.calculate_biggest_eigenvalue( my_cov_matrix) # Do it with prody pca = prody.PCA('pcametric_pca') pca.buildCovariance(testPCAMetric.ensemble) pca.calcModes(n_modes=1) self.assertAlmostEqual(pca.getEigvals()[0], biggest_eigenvalue, 10)
def test_covariance_matrix_vs_prody(self): # do it with PCA metric my_cov_matrix = PCAMetric.create_covariance_matrix(testPCAMetric.coordsets) # Do it with prody pca = prody.PCA('pcametric_pca') pca.buildCovariance(testPCAMetric.ensemble) prody_cov_matrix = pca._cov # Compare numpy.testing.assert_almost_equal(my_cov_matrix, prody_cov_matrix,10)
def test_covariance_matrix_vs_prody(self): # do it with PCA metric my_cov_matrix = PCAMetric.create_covariance_matrix( testPCAMetric.coordsets) # Do it with prody pca = prody.PCA('pcametric_pca') pca.buildCovariance(testPCAMetric.ensemble) prody_cov_matrix = pca._cov # Compare numpy.testing.assert_almost_equal(my_cov_matrix, prody_cov_matrix, 10)
def analysis_function_pca(self, clustering, trajectory_handler): calculator = PCAMetric(trajectory_handler) return calculator.evaluate(clustering)
def analysis_function_pca(self, clustering, data_handler): """ """ calculator = PCAMetric(data_handler) return calculator.evaluate(clustering)
def analysis_function_pca(self,clustering, data_handler): """ """ calculator = PCAMetric(data_handler) return calculator.evaluate(clustering)