Skip to content

jamiehadd/covid-ssnmf

Repository files navigation

Interpretable COVID prediction with Semi-Supervised NMF

About this repository

This repository contains scripts used to learn interpretable features from X-Ray imaging data originating from various sources related to the COVID-19 pandemic.


Files Contained

  • Extract_COVIDnet_Features.py - Utilizes the pretrained COVID-Net models and extracts the learned representations of the data at the final 3 layers of COVID-Net. The header of this script contains information on how to run it. Found in the "covidnet_representations" directory.
  • kmeans_DenseNet_Representations.m - Performs k-means clustering on the learned representation of the data for DenseNet [Add Reference], and computes the average purity of clusters over each different initialization of k-means. Found in the "covidnet_representations" directory.
  • kmeans_COVIDnet_Representations.m - Performs k-means clustering on the learned representations of the data for COVID-Net and computes the average purity of clusters over each different initialization of k-means. Found in the "covidnet_representations" directory.
  • evaluateRepresentation.m - Applies spectral and k-means clustering to the learned representations of DenseNet and COVID-Net. Found in "representation_evaluations" directory.
  • mapCompClus2Class.m - Computes an optimal permutation of the computed clusters when the ground truth labels are known. Found in "representation_evaluations" directory.
  • ssnmf_variants.ipynb - Several different algorithms for performing SSNMF. Found in the "ssnmf_variants" directory.


Usage

To perform clustering on the learned representations of COVID-Net:

  1. Clone the repository at https://github.com/lindawangg/COVID-Net and follow their instructions on how to generate the relevant data set
  2. Run the Extract_COVIDnet_Features.py script by providing as arguments the path to the pretrained model/data
  3. Run the script make_COVIDx_labels.py to generate .mat files containing the numerical labels for each data point. This is needed when computing the average purity for k-means clustering.
  4. Run the Octave (MATLAB) script kmeans_COVIDnet_Representations.m after adjusting the load paths and variables as appropriate to the .mat files generated in step 2 and 3. Warning: The 4/15/2020 update of COVID-Net changed the number and type of classes being used in the classification task.

To perform clustering on the learned representations... *To be updated
To perform SSNMF on... *To be updated