Skip to main content

Using a bipartite graph of medical conditions and symptoms with relative weighted edges, gives the estimated probability of having each illness given a list of symptoms

Project description

Probabilistic Symptom Graph

pip install probabilistic-symptom-graph
from src.ProbabilisticSymptomGraph import ProbabilisticSymptomConditionGraph

import networkx as nx
import numpy as np

medical_condition_gexf = "./data/medical-condition-symptom-graph.gexf"
graph = nx.read_gexf(medical_condition_gexf)
sim_matrix = np.load('./data/md-symptom-sim-mat.npy')

symptom_names = []
for node_id, tpe in graph.nodes(data="type"):
    if tpe == "Symptom":
        symptom_names.append(node_id)
symptom_names = sorted(symptom_names)

condition_names = []
for node_id, tpe in graph.nodes(data="type"):
    if tpe == "MedicalCondition":
        condition_names.append(node_id)
condition_names = sorted(condition_names)

probabilistic_graph = ProbabilisticSymptomConditionGraph(condition_names, symptom_names, graph, sim_matrix)
print(" | ".join(probabilistic_graph.get_all_symptoms()[:10]))
probabilistic_graph.get_condition_probs(["acne"])[:5]

Graph Image

Red nodes represent medical conditions and green nodes represent symptoms. image This graph data was gathered by mining Wikipedia "Medical Condition (New)" infoboxes and extracting medical condition <=> Symptom pairs. Post processing was done using ChatGPT.

Data Mining

See ./data/WikipediaSymptomExtractor.ipynb

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

probabilistic-symptom-graph-1.0.3.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page