Skip to main content

Refactoring

Starting a new algorithm or Refactoring an exisiting algorithm

  1. Make sure you are using the processing.dataset_for_surv_analysis() as your input
  2. The train_test_split being used in the algorithms currently does a random split of the dataset
    1. The problem with that is that, our data is temporal in nature
    2. The main problem with that is that, you can't use future data points to predict the past.
    3. Hence the whole logic of train test split needs to be re-written
  3. The approach is to first sort the dataset on the basis of install_date.
  4. Once the dataset is sorted, take the first 80% or 70% or your desired percentage of the samples for training and the rest for testing.
  5. After splitting the dataset into training and testing, check the distributions of breaks and no breaks.
  6. Make sure that your testing period has certain breaks happening in it.
  7. If you see that the distribution between breaks and no breaks is significantly large, you need to use a synthetic oversampling or undersampling method.
  8. Deven proposed using SMOTE for this.
    1. Other approaches also exist like AdaSyn, Border SMOTE, they can be explored and their results can be compared.
    2. Reference link: Handling imbalanced dataset in supervised learning using family of SMOTE algorithm
  9. To make runs reproducible, set seeds wherever possible.

Needs to be done

  • Plotting routine in the file

Other refactoring and the overall design

  1. Settings for various parameters in the app
    1. Study period : study start and study end
    2. Functionality to study individual materials
    3. Functionality for debug (verbose) on the fly
    4. Creating/writing csv files
  2. Better plotting routine and exporting well labelled graphs
  3. Unit testing

Todos

  • Log runs in the database
  • Better document on when to and when not to do train_test_split
  • Unit tests for each module
  • Avoiding the use of SMOTE and altering the weights in the loss function directly to handle the class imbalance
  • Setting the entire framework for reproducible ML runs