Hi,
I'm developing a module with some ML models which are computationally expensive. Is there a way to save the model so that it doesn't have to be retrained everytime I select a new plot/results option? I have tried the self$results$.setModel with a "property" type on the results file but everytime a new plotting option is selected, it turns to NULL. I have also played with the clearWith options but it doesn't prevent retraining either. Thank you in advanced.
Cheers,
Javier
Saving model persistently
Re: Saving model persistently
I assume this may help:
just after computationally expensive calculation add checkpoint
# Push results and check for user changes:
private$.checkpoint()
# If you only want to poll for changes without re-pushing identical results:
private$.checkpoint(flush = FALSE)
just after computationally expensive calculation add checkpoint
# Push results and check for user changes:
private$.checkpoint()
# If you only want to poll for changes without re-pushing identical results:
private$.checkpoint(flush = FALSE)
Re: Saving model persistently
Hey @JavierMG,
you can check it out here:
https://github.com/jamovi/jmv/blob/mast ... a.b.R#L525
where we use it as @sbalci suggests.
I've also put it here:
https://github.com/jamovi/jmv/blob/mast ... np.b.R#L52
So you can take a look at the code of the jmv analysis module elements.
Cheers,
Maurizio
https://www.jamovi.org/about.html
you can check it out here:
https://github.com/jamovi/jmv/blob/mast ... a.b.R#L525
where we use it as @sbalci suggests.
I've also put it here:
https://github.com/jamovi/jmv/blob/mast ... np.b.R#L52
So you can take a look at the code of the jmv analysis module elements.
Cheers,
Maurizio
https://www.jamovi.org/about.html
Re: Saving model persistently
if you want to persist values between runs, you need to store that value in state.
analyses are completely destroyed between runs, and often don't run in the same process twice, so the only way to store and restore is to use the state system.
https://dev.jamovi.org/tuts0203-state.html#setstate()
self$results$aResultsElementWithAppropriateClearWiths$setState(state)
state <- self$results$aResultsElementWithAppropriateClearWiths$state
but you need to be mindful of how large the objects are that are going into state (see the note on the state page).
jonathon
analyses are completely destroyed between runs, and often don't run in the same process twice, so the only way to store and restore is to use the state system.
https://dev.jamovi.org/tuts0203-state.html#setstate()
self$results$aResultsElementWithAppropriateClearWiths$setState(state)
state <- self$results$aResultsElementWithAppropriateClearWiths$state
but you need to be mindful of how large the objects are that are going into state (see the note on the state page).
jonathon