PatientLevelPrediction
PatientLevelPrediction copied to clipboard
No hyperparameters shown in shiny app for GBM models
when using viewPlp
on a model trained with runPlp the hyperparameters searched over are not shown in the app. I tested this with a GBM model but could also be the case with other models.
I wasn't sure what was causing this so did a little digging. I found two causes.
Our hyperParamSearch
object which has this info is stored in trainDetails
as a matrix with named vectors. When that is stored as json all the column names are not preserved. @jreps is there a reason this info is stored as a matrix instead of something like a data frame?
The second cause is in OhdsiShinyModules
. When displaying the table in question it's trying to select and display a column Fold AUROC
which doesn't exist at least for GBM and most other models except maybe Cyclops models?
No reason for it to be a matrix - happy to edit all the models to make this a list instead as that is converted more reliably. I think making all the hyperParamSearch consistently be a list will help as I suspect the inconsistency was the reason why the OhdsiShinyModules fails.
I actually need to improve the settings part of the prediction shiny display - so I'll address the OhdsiShinyModule part when I make those edits. I'll just convert the list into a data.frame for display then it will show any metric in the hyperParamSearch list and won't just be searching for Fold AUROC.
What about having it as a dataframe? Seems more appropriate for this kind of 2d data. That's what I did to test, stored it as dataframe before it was written to json, and it seemed to be written and read correctly.
I actually also was wondering if this belongs in the settings part of the prediction shiny, since it does include the results of the hyperparameter search, while settings to me implies this is something you decide beforehand, like the hyperparameter space you explore for example.
ok - data.frame it is :)
Would you prefer hyperparameter space details to be in the model tab?
Atrrition is also in the settings but not a setting (I was just unsure of where to put it) - shall we move that somewhere else?
what do you think about this https://github.com/OHDSI/PatientLevelPrediction/tree/issue_362 ? I modified the data.frame to include the columns: metric, fold, value and then the hyper-parameter values. I used fold 0 to have the overall CV performance.