eode_simuAnnealing {ecode}R Documentation

Simulated Annealing For Optimal Parameters

Description

Find optimal parameters in the ODE system using simulated annealing.

Usage

eode_simuAnnealing(
  x,
  pdat,
  paras = "ALL",
  max_disturb = 0.2,
  AnnN = 100,
  step = 0.01,
  prop.train = 1
)

Arguments

x

the ODE system under consideration. An object of "eode" class.

pdat

observed population dynamics. An object of "pdata" class.

paras

parameters to be optimised. A character vector. If multiple parameters are specified, the simulation annealing process will proceed by altering multiple parameters at the same time, and accept an alteration if it achieves a lower value of the loss function. Default is "ALL", which means to choose all the parameters.

max_disturb

maximum disturbance in proportion. The biggest disturbance acts on parameters at the beginning of the simulated annealing process.

AnnN

steps of simulated annealing.

step

interval of time for running simulations. Parameter of the function "eode_proj()".

prop.train

proportion of training data set. In each step of annealing, a proportion of dataset will be randomly decided for model training, and the rest for model validation.

Value

a data frame showing attempted parameters along with the corresponding values of loss function.

Examples


dX_Cdt <- function(X_C, Y_C, X_A, Y_A, nu = 0.15, beta = 0.1, mu = 0.15, g = 0.04) {
  nu * (X_A + Y_A) - beta * X_C * (Y_C + Y_A) - (mu + g) * X_C
}

dY_Cdt <- function(X_C, Y_C, Y_A, beta = 0.1, mu = 0.15, g = 0.04, rho = 0.2) {
  beta * X_C * (Y_C + Y_A) - (mu + g + rho) * Y_C
}

dX_Adt <- function(X_C, Y_C, X_A, Y_A, beta = 0.1, g = 0.04) {
  g * X_C - beta * X_A * (Y_C + Y_A)
}

dY_Adt <- function(X_A, Y_C, Y_A, beta = 0.1, g = 0.04, rho = 0.2) {
  beta * X_A * (Y_C + Y_A) + g * Y_C - rho * Y_A
}

x <- eode(
  dX_Cdt = dX_Cdt, dY_Cdt = dY_Cdt, dX_Adt = dX_Adt, dY_Adt = dY_Adt,
  constraint = c("X_C>=0", "Y_C>=0", "X_A>=0", "Y_A>=0")
)
training_data <- pdata(x,
  init = data.frame(
    X_A = c(9, 19, 29, 39),
    Y_A = c(1, 1, 1, 1),
    X_C = c(5, 5, 5, 5),
    Y_C = c(0, 0, 0, 0)
  ),
  t = c(3, 3, 3, 3),
  lambda = data.frame(incidence = c(0.4, 0.8, 0.9, 0.95)),
  formula = "incidence = (Y_A + Y_C)/(X_A + X_C + Y_A + Y_C)"
)
res <- eode_simuAnnealing(x, pdat = training_data, paras = "beta", max_disturb = 0.05, AnnN = 20)
res


[Package ecode version 0.1.0 Index]