Beispiel #1
0
def basic_network(only_structure=False):
    """
    Returns a basic valid network to test the APIs
    """

    structure = {
        "node1": {
            "state1": 0.3,
            "state2": 0.7,
        },
        "node2": {
            "state1": 0.7,
            "state2": 0.3,
        },
    }

    if only_structure:
        return structure

    Net = BayesNet()

    # defining a valid network structure:

    Net.create_network(structure)
    return Net
def basic_network(only_structure=False):
    """
    create basic network to test the APIs
    """

    Net = BayesNet("continuous")
    network_struct = {
        "node1": {
            "states": ["dim1"],
        },
        "node2": {
            "states": ["dim1", "dim2"],
        },
        "node3": {
            "states": ["dim1", "dim2", "dim3"],
        },
        "node4": {
            "states": ["dim1", "dim2", "dim3"],
        },
        "node5": {
            "states": ["dim1"],
        },
    }

    Net.create_network(network_struct)
    return Net
 def setUp(self):
     self.Net = BayesNet("continuous")
     self.valid_structure = {
         "node1": {
             "states": ["dim1"],
         },
         "node2": {
             "states": ["dim1", "dim2"],
         },
         "node3": {
             "states": ["dim1", "dim2", "dim3"],
         },
         "node4": {
             "states": ["dim1", "dim2", "dim3"],
         },
     }
Beispiel #4
0
    def setUp(self):
        self.Net = BayesNet()
        network_structure = {
            "node1": {
                "state1": 0.3,
                "state2": 0.7,
            },
            "node2": {
                "state1": 0.7,
                "state2": 0.3,
            },
            "node3": {
                "state1": 0.5,
                "state2": 0.5
            },
        }

        self.Net.create_network(network_structure)
Beispiel #5
0
    def setUp(self):
        self.Net = BayesNet()

        # defining a valid network structure:
        self.valid_structure = {
            "node1": {
                "state1": 0.3,
                "state2": 0.7,
            },
            "node2": {
                "state1": 0.7,
                "state2": 0.3,
            },
        }
        self.invalid_structure = {
            "node1": {
                "state1": 0.3,
                "state2": "invalid probability",
            },
        }