Wednesday, April 13, 2011

Optimization and Global Sensitivity

TinkerCell now includes optimization functions for fitting time series data and maximizing or minimizing a given formula. The optimization routines are written in Python but use C++ simulators (copasi). The algorithm is Cross Entropy, which can be used to obtain an estimate of the distribution of parameters. PCA can be used to infer global sensitivities.


A user can write any Python function and optimize it using CrossEntropy. Here is template code:
#objective function for CrossEntropy
def MyObjective():
error = 0.0
#do something here, e.g. call tc_getSteadyState or tc_simulateDeterministic
return error

#optimization parameters
minimize = False
maxruns = 100
numPoints = 100
title = "My Optimization Function"

#optimize
result = CrossEntropy.OptimizeParameters(FitFormula_Objective, title, maxruns, numPoints, minimize)
mu = result[0]
sigma = result[1]
paramnames = result[2]
CrossEntropy.DoPCA(mu, sigma, paramnames)

#set the optimized parameters in the model if you want
n = len(mu)
params = tc_createMatrix(n, 1)
for i in range(0,n):
tc_setMatrixValue(params, i, 0, mu[i])
tc_setRowName(params, i, paramnames[i])
tc_setParameters(params,1)


CrossEntropy.DoPCA will generate a summary file such as the one below.


No comments: