Now that you have all the preprocessed data (DataFrame matrix and network patients_traumas), you can transform it into four weighted networks.
Each column in the matrix is a 618-dimensional vector of binary properties of the future trauma node: the property of being diagnosed in patient 0; the property of being diagnosed in patient 1; and so on. Surely, two trauma types are similar if the vectors are similar in some sense. Once the similarities of each pair of vectors are known, the process of network construction is straightforward and can be implemented as a set of functions—at least for the cosine and Pearson distances.
|||def similarity_mtx(biadj_mtx, similarity_f):|
||| Convert a bi-adjacency ...|