Skip to content

gallupBenRyan/SemanticModels.jl

 
 

Repository files navigation

SemanticModels.jl

A julia package for representing and manipulating model semantics

Getting Started

Install this package with

Pkg.develop("git@github.com:jpfairbanks/SemanticModels.jl.git")
Pkg.develop("Cassette")
Pkg.test("SemanticModels")

Note that loading this package for the first time can take a while because DifferentialEquations is a large library that requires a long precompilation step. Various functions in the SemanticModels.Dubstep module can also have long precompile times, due to heavy use of generated functions.

Then you can load it at the julia REPL with using SemanticModels

There are scripts in the folder SemanticModels/bin which provide command line access to some functionality of the package. For example julia --project bin/extract.jl examples/epicookbook/notebooks/SimpleDeterministicModels/SEIRmodel.jl will extract code based knowledge elements from the julia source code file examples/epicookbook/notebooks/SimpleDeterministicModels/SEIRmodel.jl.

See the tests and documentation for example usage.

Documentation

There is a docs folder which contains the documentation, including reports sent to our sponsor, DARPA.

Documentation is currently published at jpfairbanks.com/doc/aske and jpfairbanks.com/doc/aske/slides.pdf

Many of our documentation and examples are built with Jupyter notebooks. We use jupytext to support diff friendly outputs in the repo. Please follow the jupytext readme to install this jupyter plugin.

Examples

In addition to the examples in the documentation, there are fully worked out examples in the folder https://github.com/jpfairbanks/SemanticModels.jl/tree/master/examples/. Each subdirectory represents one self contained example, starting with epicookbook.

Concepts

This package enables representation of complex and diverse model structure in the type system of julia. This will allow generic programing and API development for these complex models.

ModelStructures

The following concepts are defined in SemanticModels.jl

  • Model
  • EpiModel <: Model
  • NumberClass
  • Amount <: NumberClass
  • Rate <: NumberClass
  • BirthRate <: Rate
  • DeathRate <: Rate
  • TransitionRate <: Rate
  • Equation
  • Expression
  • Variable

A number class is like a Unit in that it can be used to check compatibility of numeric values for various operations.

Knowledge Graph

We will use MetaGraphs.jl to model the relationships between models and concepts in a knowledge graph

Knowledge Graph Extraction

You can use the Extractor type to pull knowledge elements from an artifact. The following are subtypes of Artifact

  • Docs
  • Code
  • Model
  • Paper

Overdubbing

You can modify a program's execution using Cassette.overdub and replace function calls with your own functions. For an example, see test/transform/ode.jl. Or you can use a new compiler pass if you need more control over the values that you want to manipulate.

Acknowledgements

This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Agreement No. HR00111990008.

About

A julia package for representing and manipulating model semantics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Julia 75.9%
  • Jupyter Notebook 21.4%
  • Python 2.7%