def test_evidenced_outside_on_path_graph(get_complex_graph_and_configurations): test_data = get_complex_graph_and_configurations hypothgraph = test_data['hypothgraph'] partial_within = test_data['partial_within'] source = partial_within.source target = partial_within.target before_confidence = compute_confidence.confidence(hypothgraph, partial_within) before_max_confidence = compute_confidence.max_confidence(hypothgraph, source, target) before_norm_confidence = compute_confidence.normalized_confidence(hypothgraph, partial_within) # Evidence nodes which will not contribute to the causation confidence on_boundary_nodes = boundary.on_boundary(hypothgraph, source, target) outside_evidence_nodes = partial_within.evidenced_nodes + list(on_boundary_nodes) # create new hypothesis configuration new_conf = Hypoth_Conf(source=source, target=target, evidenced_nodes=outside_evidence_nodes) after_confidence = compute_confidence.confidence(hypothgraph, new_conf) after_max_confidence = compute_confidence.max_confidence(hypothgraph, source, target) after_norm_confidence = compute_confidence.normalized_confidence(hypothgraph, new_conf) assert before_confidence == after_confidence assert before_max_confidence == after_max_confidence assert before_norm_confidence == after_norm_confidence
def test_nothing_evidenced_on_path_graph(get_complex_graph_and_configurations): test_data = get_complex_graph_and_configurations hypothgraph = test_data['hypothgraph'] nothing = test_data['nothing'] # confidence with nothing evidenced should be 0 confidence = compute_confidence.confidence(hypothgraph, nothing) assert confidence == 0 # max confidence for the same boundary should be bigger than confidence max_confidence = compute_confidence.max_confidence(hypothgraph, nothing.source, nothing.target) assert max_confidence > confidence # normalized confidence should also be zero since we have nothing evidenced normalized_confidence = compute_confidence.normalized_confidence(hypothgraph, nothing) assert normalized_confidence == 0
def test_partial_evidenced_within_on_path_graph(get_complex_graph_and_configurations): test_data = get_complex_graph_and_configurations hypothgraph = test_data['hypothgraph'] partial_within = test_data['partial_within'] # confidence with nothing evidenced should be 0 confidence = compute_confidence.confidence(hypothgraph, partial_within) assert confidence > 0 # max confidence for the same boundary should be bigger than confidence max_confidence = compute_confidence.max_confidence( hypothgraph, partial_within.source, partial_within.target) assert max_confidence > confidence # normalized confidence should be in (0..1) normalized_confidence = compute_confidence.normalized_confidence( hypothgraph, partial_within) assert normalized_confidence > 0 and normalized_confidence < 1
def test_full_evidenced_within_on_path_graph(get_complex_graph_and_configurations): test_data = get_complex_graph_and_configurations hypothgraph = test_data['hypothgraph'] full_within = test_data['full_within'] # confidence with nothing evidenced should be 0 confidence = compute_confidence.confidence(hypothgraph, full_within) assert confidence > 0 # max confidence for the same boundary should be equal to confidence max_confidence = compute_confidence.max_confidence( hypothgraph, full_within.source, full_within.target) assert max_confidence == confidence # normalized confidence should be 1 normalized_confidence = compute_confidence.normalized_confidence( hypothgraph, full_within) assert normalized_confidence == 1