Ejemplo n.º 1
0
 def test_wta(self):
     with pytest.warns(
             UserWarning,
             match="Could not simulate data, returning constant dataframe"):
         gen_stationary_dyn_net_and_df(w_min_inter=1,
                                       w_max_inter=2,
                                       max_data_gen_trials=2)
Ejemplo n.º 2
0
 def test_error_if_wmin_less_wmax(self):
     with pytest.raises(
             ValueError,
             match=
             "Absolute minimum weight must be less than or equal to maximum weight: 2 > 1",
     ):
         gen_stationary_dyn_net_and_df(w_min_inter=2,
                                       w_max_inter=1,
                                       max_data_gen_trials=2)
Ejemplo n.º 3
0
 def test_fail_to_find_stationary_network(self):
     """if fails to find suitable network, returns dataset of ones"""
     np.random.seed(5)
     _, df, _, _ = gen_stationary_dyn_net_and_df(
         n_samples=1000,
         p=1,
         w_min_inter=0.6,
         w_max_inter=0.6,
         max_data_gen_trials=20,
         degree_intra=4,
         degree_inter=7,
     )
     assert np.any(np.ones(df.shape) == df)
Ejemplo n.º 4
0
    def test_dense_networks(self):
        """dense network are more likely to be non stationary. we check that the simulator is still able to provide a
        stationary time-deries in that case.

        If df contain only ones it means that the generator failed to obtain a stationary structure"""
        np.random.seed(4)
        _, df, _, _ = gen_stationary_dyn_net_and_df(
            n_samples=1000,
            p=1,
            w_min_inter=0.2,
            w_max_inter=0.5,
            max_data_gen_trials=10,
            degree_intra=4,
            degree_inter=7,
        )
        assert np.any(np.ones(df.shape) != df)
Ejemplo n.º 5
0
 def test_seems_stationary(self, seed):
     np.random.seed(seed)
     _, df, _, _ = gen_stationary_dyn_net_and_df(w_min_inter=0.1,
                                                 w_max_inter=0.2,
                                                 max_data_gen_trials=2)
     assert np.all(df.max() - df.min() < 10)