Giter Site home page Giter Site logo

gridinterpolations.jl's Introduction

GridInterpolations

Build Status Coverage Status

This package performs multivariate interpolation on a rectilinear grid. At the moment, it provides implementations of multilinear and simplex interpolation. As of benchmarks in December 2016, multilinear interpolation performs fastest and with the most accuracy.

The following image visualizes grid-based interpolation in two dimensions, with shape of interpolater for (−0.3,0.8) inscribed. The small dots reflect the interpolation's estimate for sin(x)+2cos(y)+sin(5xy), which is the underlying reward function approximated by the large dot lattice.

Illustration of performance of multilinear and simplex interpolation methods

For a description of multilinear and simplex interpolation see: Scott Davies, Multidimensional Triangulation and Interpolation for Reinforcement Learning, Advances in Neural Information Processing Systems, Cambridge, MA: MIT Press, 1997. pdf

There are some related packages, such as Grid.jl and Interpolations.jl.

Installation

Start Julia and run the following command:

Pkg.add("GridInterpolations")

Usage

To use the GridInterpolations module, begin your code with

using GridInterpolations

Interpolation

Create two-dimensional interpolation grids, a data array, and a point of interest:

grid = RectangleGrid([0., 0.5, 1.],[0., 0.5, 1.])  	# rectangular grid
sGrid = SimplexGrid([0., 0.5, 1.],[0., 0.5, 1.])	# simplex grid
gridData = [8., 1., 6., 3., 5., 7., 4., 9., 2.]   	# vector of value data at each cut
x = [0.25, 0.75]  									# point at which to perform interpolation

Perform interpolation on the rectangular grid:

julia> interpolate(grid,gridData,x)
5.25

Or interpolate on the simplex grid:

julia> interpolate(sGrid,gridData,x)
6.0

Compute interpolants for the grids:

julia> sGrid = SimplexGrid([0., 0.5, 1.],[0., 0.5, 1.])
[[0.0,0.5,1.0],[0.0,0.5,1.0]]

julia> interpolants(sGrid, x)
([4,5,8],[0.5,0.0,0.5])

Convert an index to a Grid coordinate:

julia> ind2x(grid, 3)
2-element Array{Float64,1}:
 1.0
 0.0

Number of vertices in the grid:

julia> length(grid)
9

Number of dimensions:

julia> dimensions(grid)
2

Credits

Contributors to this package include Maxim Egorov, Eric Mueller, and Mykel Kochenderfer.

gridinterpolations.jl's People

Contributors

etotheipluspi avatar jw3126 avatar mykelk avatar tawheeler avatar zsunberg 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.