Esempio n. 1
0
 def test_bad_sem_type(self):
     """Test that invalid sem-type other than "linear-gauss", "linear-exp", "linear-gumbel" is not accepted"""
     graph_type, degree, d_nodes = "erdos-renyi", 4, 10
     sm = generate_structure_dynamic(d_nodes, 2, degree, degree, graph_type)
     with pytest.raises(
             ValueError,
             match="unknown sem type invalid. Available types are:"
             r" \('linear-gauss', 'linear-exp', 'linear-gumbel'\)",
     ):
         generate_dataframe_dynamic(sm, sem_type="invalid", n_samples=10)
Esempio n. 2
0
 def test_labels_correct(self, p):
     graph_type, degree, d_nodes = "erdos-renyi", 4, 10
     sm = generate_structure_dynamic(d_nodes, p, degree, degree, graph_type)
     data = generate_dataframe_dynamic(sm,
                                       sem_type="linear-gauss",
                                       n_samples=10)
     intra_nodes = sorted([el for el in sm.nodes if "_lag0" in el])
     inter_nodes = sorted([el for el in sm.nodes if "_lag0" not in el])
     assert sorted(
         data.columns) == sorted(list(inter_nodes) + list(intra_nodes))
Esempio n. 3
0
 def test_returns_dateframe(self, sem_type):
     """Return value is an ndarray - test over all sem_types"""
     graph_type, degree, d_nodes = "erdos-renyi", 4, 10
     sm = generate_structure_dynamic(d_nodes, 2, degree, degree, graph_type)
     data = generate_dataframe_dynamic(sm, sem_type=sem_type, n_samples=10)
     assert isinstance(data, pd.DataFrame)