Unfit  3.1.1
Data fitting and optimization software
Public Member Functions | Private Attributes | List of all members
Unfit::Examples::GeneticSwitch Class Reference

Fit the parameters in a model of a genetic switch. More...

#include <GeneticSwitch.hpp>

Inheritance diagram for Unfit::Examples::GeneticSwitch:
Unfit::GenericCostFunction

Public Member Functions

 GeneticSwitch (const std::vector< double > &z_a, double dt)
 
std::vector< double > operator() (const std::vector< double > &param)
 
- Public Member Functions inherited from Unfit::GenericCostFunction
virtual ~GenericCostFunction ()
 

Private Attributes

const std::vector< double > z_a_data_
 
const double dt_
 

Detailed Description

Fit the parameters in a model of a genetic switch.

An example two ordinary differential equations (ODE) data fitting problem. The equations describe genetic switch between two genes, z_a and z_b, for protein regulation. They depend on four constants, u, n, v1 and v2. Here the goal is to fit these constants given experimental data for z_a. The two ODEs are:

dz_a/dt = u/(1 + z_b^n) - z_a - v1 dz_b/dt = u/(1 + z_b^n) - z_b - v2

The initial conditions are z_a(0) = 10, and z_b(0) = 10, and the goal is to find the values of u, n, v1 & v2 that best fit the data. In terms of the model, u = param[0], n = param[1], v1 = param[2] and v2 = param[3].

Constructor & Destructor Documentation

◆ GeneticSwitch()

Unfit::Examples::GeneticSwitch::GeneticSwitch ( const std::vector< double > &  z_a,
double  dt 
)
inline

Create the cost function. Here the experimental data must be passed in, and cannot be changed (if you want to, just create another cost function object). Here the experimental data is a vector containing the value of z_a, and the time step used in the data collection.

Intended use : GeneticSwitch cost_func(z_a, t);

Parameters
z_aA vector of experimental z_a values
dtThe experimental time step

Member Function Documentation

◆ operator()()

std::vector<double> Unfit::Examples::GeneticSwitch::operator() ( const std::vector< double > &  param)
inlinevirtual

Calculate the linear distance (residuals) between our model and the data. This method encapsulates the model, and expects the current estimates of the unknown parameters as an input. See the class documentation for details about the model.

Intended use : residuals = cost_func(param)

Parameters
paramA vector containing the current estimates of the parameters we are trying to fit
Returns
A vector containing the residuals

Implements Unfit::GenericCostFunction.

Member Data Documentation

◆ dt_

const double Unfit::Examples::GeneticSwitch::dt_
private

A vector to store the time step, dt

◆ z_a_data_

const std::vector<double> Unfit::Examples::GeneticSwitch::z_a_data_
private

A vector to store the experimental data, Z_A


The documentation for this class was generated from the following file: