Git Product home page Git Product logo

abc-miniproject's Introduction

pagetitle
ABC

Implementing an ABC rejection algorithm

Some background information will go here.

Write a function to simulate from a logistic model

The logistic model looks like:

$C(t) = \frac{k}{1 + (\frac{k}{C_0}-1)e^{-rt}} + \epsilon$

where C(t) is the population of cells at time $t$, C_0 is the population at time $t=0$, $k$ is the population carrying capacity, $r$ is the population growth rate, and $\epsilon$ is random noise drawn from $N(0,s)$.

  1. Create a python file abc_rejction.py.

  2. Write a function with the following signature that will simulate a time-course from the logistic model above:

    def logistic(t, r, k, s):
    

    Where $t$ is expected to be a numpy array of time points (for instance, from np.linspace(0, 10, 100)), $r$ is expected to be a positive real number representing the population growth rate, $k$ is a positive real number representing the carrying capacity, and $s$ is a small positive real number representing the scale of the normal noise term.

    This function should return a numpy array, the same length as $t$, where the logistic function above has been evaluated at teach of the time points.

  3. Using matplotlib, plot a simulated time course from your logistic model:

    import matplotlib.pyplot as plt
    import numpy as np
    
    t = np.linspace(0, 10, 100)
    c = logistic(t, 1.23, 24.5, 0.345)
    
    plt.plot(t, c)
    plt.show()
    
  4. Create a python file test_abc.py.

  5. Write a function with the following signature that will test your logistic function:

    def test_logistic():
    
  6. Check that, with $t=0$ and no noise, your logistic model returns $C_0$:

    t = np.array(0.0)
    assert logistic(t, 1.23, 2.34, 0.0) == C0
    
  7. Add as many more checks as you can think of, to assure yourself that your logistic function is implemented correctly.

abc-miniproject's People

Contributors

fcooper8472 avatar

Watchers

 avatar  avatar

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.