コード例 #1
0
def test_em_with_without_rowvar():
    """Tests the EM method, with and without rowvar, works correctly."""
    np.random.seed(1)
    data = np.random.normal(size=(20, 50))
    pc1 = PrincipalComponents(data)
    pc2 = PrincipalComponents(data.T, rowvar=True)
    pc1._expectation_maximization(10)
    pc2._expectation_maximization(10)
    check_cols_match_except_sign(pc1._eigvec, pc2._eigvec)
コード例 #2
0
ファイル: test_pca.py プロジェクト: bthirion/yeast-cycle
def test_em_with_without_rowvar():
    """Tests the EM method, with and without rowvar, works correctly."""
    np.random.seed(1)
    data = np.random.normal(size=(20, 50))
    pc1 = PrincipalComponents(data)
    pc2 = PrincipalComponents(data.T, rowvar=True)
    pc1._expectation_maximization(10)
    pc2._expectation_maximization(10)
    check_cols_match_except_sign(pc1._eigvec, pc2._eigvec)
コード例 #3
0
def test_em_vs_snapshot_pc_rowvar_false():
    """Tests that EM and snapshot agree."""
    np.random.seed(1)
    data = np.random.normal(size=(10, 50))
    pc1 = PrincipalComponents(data)
    pc2 = PrincipalComponents(data)
    pc1._snapshot()
    pc2._expectation_maximization(5)
    check_cols_match_except_sign(pc1._eigvec[:, :5], pc2._eigvec)
コード例 #4
0
ファイル: test_pca.py プロジェクト: bthirion/yeast-cycle
def test_em_vs_snapshot_pc_rowvar_false():
    """Tests that EM and snapshot agree."""
    np.random.seed(1)
    data = np.random.normal(size=(10, 50))
    pc1 = PrincipalComponents(data)
    pc2 = PrincipalComponents(data)
    pc1._snapshot()
    pc2._expectation_maximization(5)
    check_cols_match_except_sign(pc1._eigvec[:, :5], pc2._eigvec)