Example #1
0
    def test_intercept(self, distribution, n_categories):
        graph = StructureModel()
        graph.add_node("A")

        data_noint = generate_categorical_dataframe(
            graph,
            100000,
            distribution,
            noise_scale=0.1,
            n_categories=n_categories,
            seed=10,
            intercept=False,
        )
        data_intercept = generate_categorical_dataframe(
            graph,
            100000,
            distribution,
            noise_scale=0.1,
            n_categories=n_categories,
            seed=10,
            intercept=True,
        )

        assert np.all(~np.isclose(data_intercept.mean(axis=0),
                                  data_noint.mean(axis=0),
                                  atol=0.05,
                                  rtol=0))
Example #2
0
    def test_intercept(self, distribution):
        graph = StructureModel()
        graph.add_node("123")

        data_noint = generate_binary_data(graph,
                                          100000,
                                          distribution,
                                          noise_scale=0,
                                          seed=10,
                                          intercept=False)
        data_intercept = generate_binary_data(graph,
                                              100000,
                                              distribution,
                                              noise_scale=0,
                                              seed=10,
                                              intercept=True)
        assert not np.isclose(data_noint[:, 0].mean(),
                              data_intercept[:, 0].mean())
Example #3
0
    def test_intercept(self, distribution):
        graph = StructureModel()
        graph.add_node("123")

        data_noint = generate_continuous_data(
            graph,
            n_samples=100000,
            distribution=distribution,
            noise_scale=0,
            seed=10,
            intercept=False,
        )
        data_intercept = generate_continuous_data(
            graph,
            n_samples=100000,
            distribution=distribution,
            noise_scale=0,
            seed=10,
            intercept=True,
        )
        assert not np.isclose(data_noint[:, 0].mean(),
                              data_intercept[:, 0].mean())
        assert np.isclose(data_noint[:, 0].std(), data_intercept[:, 0].std())