Code Monkey home page Code Monkey logo

magenta's People

Contributors

bobverity avatar ojwatson avatar richfitz avatar

Watchers

 avatar  avatar  avatar

Forkers

lucyokell mfdiop

magenta's Issues

Profiling against malariasimulation

Just generating a simple reprex for profiling magenta against malariasimulation

library(malariasimulation)
library(magenta)
library(tictoc)

EIR <- 50 
ft <- 0.5 
N <- 500000
timesteps = 30

# malariasimulation should have individual mosquiotes on for fair comparison
params <- malariasimulation::get_parameters(overrides = list("human_population" = N, "individual_mosquitoes" = TRUE)) |> 
  malariasimulation::set_equilibrium(init_EIR = EIR)

# set the mosquito limit the same so not populating unnecessary of mosquitoes
params$mosquito_limit <- params$total_M

#Update parameter set with chosen drug-specific parameters (AL)
drug_params <- malariasimulation::set_drugs(params, list(AL_params))

# Set treatment program for AL (drug index = 1)
treatment_params <- malariasimulation::set_clinical_treatment(
  parameters = drug_params,
  drug = 1,
  timesteps =  c(0), # Treatment coverage at day 0 = ft
  coverages =  c(ft))

# Use set_equilibrium to update the parameter set for a given initial EIR
treatment_params <- malariasimulation::set_equilibrium(treatment_params, EIR)

tictoc::tic()
test_sim_eq <- malariasimulation::run_simulation(timesteps = timesteps, parameters = treatment_params)
tictoc::toc()
#> 80.06 sec elapsed

# here we compare against magenta, with update_save on (rendering) and update_length set to 1 (to render every day)
tictoc::tic()
test_simmag <- magenta::pipeline(EIR = EIR, ft = ft, N = N, update_save = TRUE, update_length = 1, years = timesteps/365)
#> Seed set to 222651067
#> magenta v1.3.5
#> Starting Stochastic Simulation for 0.0821917808219178 years
tictoc::toc()
#> 45.777 sec elapsed

Created on 2024-07-10 with reprex v2.0.2

mpl params into c++ side

At the moment only a few model parameters are passed to c++.

Everything in model_param_list_create should be able to be passed in and checked for existence. Make this into a new C++ file to no clutter simulation_init.

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.