Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests #11

Open
AniekMarkus opened this issue Jul 12, 2023 · 3 comments
Open

Unit tests #11

AniekMarkus opened this issue Jul 12, 2023 · 3 comments

Comments

@AniekMarkus
Copy link
Contributor

AniekMarkus commented Jul 12, 2023

Checks to add:

  • Different input styles for trainExplore (these tests were originally there, but after updates no longer correctly testing this behavior)
    • Option 1: fully pre-specified settings file works
      • Input: settings_path (to use input settings file)
      • Optional: train_data (test with and without)
         
    • Option 2: pre-specified settings file with input data works
      • Input: settings_path + other parameter (to change input settings file)
      • Optional: train_data (test with and without)
         
    • Option 3: only input parameters (no settings file) works
      • Input: train_data (mandatory) + output_path (mandatory) + other parameter (to change package settings file)
         
  • Model -> trainExplore
    • Function should return a String
    • Number of features in model should be correct with input (min StartRulelength / max EndRulelength)
    • Model (performance) should be the same for Parallel (and BranchBound) TRUE / FALSE
    • Final model performance should satisfy contraints (as set by Accuracy, BalancedAccuracy, Specificity etc.)
      • Unless best performing models is worse than constraint -> Model is NULL
    • Given dataset -> Model is not NA / NULL etc. + Model remains unchanged for same settings etc.
       
  • Class always 0 (or 1) -> Model always predict 0 (or 1)
  • One variable perfectly predicting outcome -> Should be selected in the model
     
    -> Run these tests with various settings
    e.g. all possibilities for MAXIMIZE parameter
     
  • Prediction -> predictExplore
    Check output dimensions
    Expected output -> either 0 or 1
    Repeated -> should give same result
     
  • Curve -> modelsCurveExplore + rocCurveExpore
    ModelsCurve returns vector of strings (where each element is a model)
    ROC should be between 0 and 1
     
  • Use adapted version expect_correct_fitPlp / expect_correct_prediction from PLP?
    https://github.com/OHDSI/PatientLevelPrediction/blob/main/tests/testthat/helper-expectations.R
     
  • Check other tests Cyclops e.g. around Rcpp (?) -> https://github.com/OHDSI/Cyclops/tree/main/tests/testthat
@AniekMarkus AniekMarkus changed the title Add unit tests Cesar/Aniek: Add unit tests Jul 14, 2023
@AniekMarkus AniekMarkus changed the title Cesar/Aniek: Add unit tests Unit tests Jul 2, 2024
@AniekMarkus
Copy link
Contributor Author

  • Number of rules generated
    Run trainExplore for dataset binary_10.arff, check in binary_10.results file if "Total Count Cutoff Sets" is identical to # expected.

image

@AniekMarkus
Copy link
Contributor Author

AniekMarkus commented Jul 23, 2024

Idem for dataset mix_4.arff:

image

@AniekMarkus
Copy link
Contributor Author

AniekMarkus commented Jul 25, 2024

- Verifying if the generated rules are correct / the same as before

from mix_4.results ->

2 = AND 3 = OR 4 =
Candidate model: '198124209' = "FALSE" AND '316139209' = "FALSE" OR '316139210' = "FALSE"
Candidate model: '198124209' = "FALSE" AND '316139209' = "FALSE" OR '316139210' = "TRUE"
Candidate model: '198124209' = "FALSE" AND '316139209' = "TRUE" OR '316139210' = "FALSE"
Candidate model: '198124209' = "FALSE" AND '316139209' = "TRUE" OR '316139210' = "TRUE"
Candidate model: '198124209' = "TRUE" AND '316139209' = "FALSE" OR '316139210' = "FALSE"
Candidate model: '198124209' = "TRUE" AND '316139209' = "FALSE" OR '316139210' = "TRUE"
Candidate model: '198124209' = "TRUE" AND '316139209' = "TRUE" OR '316139210' = "FALSE"
Candidate model: '198124209' = "TRUE" AND '316139209' = "TRUE" OR '316139210' = "TRUE"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant