Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)

src/m/o/mozsci-HEAD/test/test_PCA.py   mozsci(Download)
        # make the PCA, do the training, then project on all three eigenvectors,
        # and reconstruct the original data
        p = pca.LinearPCA()
        p.train(data)
        data_proj = p.project(data, 3)
        # test json
        json_map = p.to_json()
        p_from_json = pca.LinearPCA(json_map=json_map)
        self.assertEqual(p.nvars, p_from_json.nvars)
        self.assertTrue((np.abs(p.mean - p_from_json.mean) < 1.0e-12).all())