Git Product home page Git Product logo

mkin's People

Contributors

jranke avatar wibeasley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mkin's Issues

DLLs for compiled models cannot be loaded from a cached knitr code chunk in case they were cleaned up

Background: mkinmod uses cfunction from the inline package to build a dynamically loadable shared object (called DLL in R) in order to speed up the solution of degradation models (that do not have an analytical solution implemented) with the ode function of the deSolve package. When such an object is created and loaded by cfunction, the corresponding R function has a finalizer attached to its environment which unloads the DLL and removes the corresponding file upon garbage collection, but at the latest when the R session is terminated.

If the knitr package is used for the preparation of reproducible reports there is a caching feature that stores the results of certain code chunks. These are saved to files that can efficiently be read when necessary in the next rendering of the report by knitr. However, the DLLs pepared by cfunction are unavailable if the DLLs were cleaned up in between.

Symptom: When rendering a knitr object that restored an mkinmod object and this object is needed to do further simulations, the DLL can not be loaded, currently resulting in termination of the report generation with an error message:

Quitting from lines x-y (report.rmd)
Error in dyn.load(get("libLFile", env)) :
  unable to load shared object '/tmp/Rtmp....../file...........so':
  /tmp/Rtmp....../file.............so: cannot open shared object file: No such file or directory

Possible solutions:
a) trigger a recompile of the DLL whenever such a situation is encountered by a function that is trying to use the expired mkinmod object (such as mkinfit or plotting functions)
b) trigger a recompile of the DLL whenever an mkinmod object is restored from the knitr cache and the DLL is unavailable
c) add the possibility in mkinmod to store the DLL in a user defined location.

Option a) could be done within the mkinfit package. However, as it would be triggered by functions working on the restored mkinmod object, these would either only recompile their local copy or they would need modify an object from outside their usual scope.
Option b) would require understanding more about knitr and and it is not clear to me if it can be done without modifying knitr
Therefore, option c) appears to to be the preferable solution.

One way to achieve this is to fix the functions for saving and restoring DLLs that are present in the inline package (eddelbuettel/inline#13) and to used the saving function in mkinmod and the reading function if necessary in the functions working with mkinmod objects.

GUI using experience

unbenannt

I cannot reproduce this but this panel of tabs got lost at some point and I have to restart gmkin to get it back.

unbenannt

I feel these tabs are most important and should be on top instead of in the bottom, just personal preference.

Fit list is not always updated with Firefox 28 on Windows

When loading the FOCUS_2006_Z_gmkin dataset distributed with the package, the fit list is not updated when using Firefox 28 on Windows 7. This works OK with Firefox 29 on Linux and Windows, as well as using Chrome on Windows 7.

Release mkin 1.0.0

  • Reconsider transformations for formation fractions as well as for parameters that can take values from 0 to 1 like the g parameter in the DFOP model
  • Improve infrastructure and documentation for using more than one core on Windows
  • Bring up test coverage to >= 90%

Release mkin 1.1.0

  • Finish interfaces to nlme and saemix for fitting mixed-effects models of degradation datasets
  • Write a publication on the use of mixed-effects models for kinetic degradation data

mkinmod: error messages should be more helpful

For example, when one state variable has a target that is not a state variable, as for example in

my_model <- mkinmod(parent = mkinsub("SFO", c("m1", "m2")),
                    m1 = mkinsub("SFO"))

where m2 is a target of parent but not a state variable, the error message is:

Error in switch(spec[[target]]$type, SFO = target, IORE = target, SFORB = paste(target,  : 
  EXPR must be a length 1 vector

which is not very helpful for finding the problem.

Fitting the two-component error model with the current method appears to underestimate the two components

When generating datasets with sigma_low = 0.5 and rsd_high = 0.07 (as e.g. was done for the synthetic_data_for_UBA_2014) and using many replicates and no censoring (LOD = -Inf), the fitted components of the error model are still systematically lower than the input parameters of the error model used for generating the data. With 100 or 1000 replicates I get 0.33 instead of 0.5 for sigma_low and 0.056 instead of 0.07 for rsd_high.

The parameter estimates of the degradation model, however, are clearly closer to the input parameters when the two-component error model reweighting is applied, just the parameters of the error model cannot be reproduced in the fit at the moment.

Therefore, I am looking for a better way to fit the error model to the residuals.

water-sediment system model without sediment->sink does not work

The parameter optimisation with a water-sediment system model without sediment->sink path does not work.

 water_sed_no_sed_sink <- mkinmod(
  use_of_ff = "min",
  water = mkinsub("SFO", "sediment"),
  sediment = mkinsub("SFO", "water", sink = FALSE))

mkinfit(water_sed_no_sed_sink, inputdata, quiet = TRUE)

gives an error:

Error in eval(substitute(expr), data, enclos = parent.frame()) :
object 'k_sediment_sink' not found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.