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

Fit the time dependence of a three state hidden Markov model. More...

#include <ThreeNaMarkov.hpp>

Inheritance diagram for Unfit::Examples::ThreeNaMarkov:
Unfit::GenericCostFunction

Public Member Functions

 ThreeNaMarkov (const std::vector< double > &open_prob, 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 > open_prob_
 
const double dt_
 

Detailed Description

Fit the time dependence of a three state hidden Markov model.

This is an example of fitting a hidden Markov model as can be used to describe an ion channel. There are three states which leads to three ordinary differential equations (ODEs) and four rate constants to fit. The states are labelled C = closed, O = open, and I = inactive. The initial conditions for the states are C = 1.0, O & I = 0.0. The three ODEs are:

dO/dt = kco*C + kio*I - (koc+koi)*O dC/dt = koc*O - kco*C dI/dt = koi*O - kio*I

The goal is to find the values of the k's (rate constants) that best fit the data, which is in the form of O vs time. In terms of the model, kco = param[0], koc = param[1], koi = param[2], kio = param[3]. These ODEs are integrated with the forward Euler method.

Constructor & Destructor Documentation

◆ ThreeNaMarkov()

Unfit::Examples::ThreeNaMarkov::ThreeNaMarkov ( const std::vector< double > &  open_prob,
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 the open probabilities, and the time step used in the data collection.

Intended use : ThreeNaMarkov cost_func(open_prob, dt);

Parameters
open_probA vector of experimental open probabilities
dtThe experimental time step

Member Function Documentation

◆ operator()()

std::vector<double> Unfit::Examples::ThreeNaMarkov::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::ThreeNaMarkov::dt_
private

A vector to store the time step, dt

◆ open_prob_

const std::vector<double> Unfit::Examples::ThreeNaMarkov::open_prob_
private

A vector to store the experimental open probabilities


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