ParametricInversion.jl

Parametric Inversion is a library for inverting Julia programs.

Quick Start

using ParametricInversion
f(x, y, z) = x + y * z
x_, y_, z_ = rand(3)
output = f(x_, y_, z_)
params = rand(2)
(x__, y__, z__) = invertinvoke(f, Tuple{Float64, Float64, Float64}, output, params)
f(x__, y__, z__)

Index

ParametricInversion.chooseFunction

choose(ctx, loc, f, types, target, known. θ)

Parametrically choose a value for variables in relation defined by method f(::types..), given information about other values in relation.

Arguments

  • f(::types...) - method to choose from
  • loc - Location
  • target - which axis we wish to choose onto
  • given - what is given/known about values of the relation (e.g. value of input)
  • θ - Parameter values which determine which element to choose
source
ParametricInversion.inverseparametersFunction

Parameters that can be used to invert to x from y parameters(f, types, args...)

Produces parameters θ such that:

inverseparameters(f, types, f(args...), θ) == args

These parameters can be used for learning.

source
ParametricInversion.invertinvokeMethod

invertinvoke(f, t::Type{<:Tuple}, z, θ)

Parametric inverse application of method f(::t...) to args with parameters θ

Inputs:

f - function to invert t - Tuple of types which determines method of f to invert z - Input to inverse method θ - Parameter values

Returns

(a, b, c, ...) - tuple of values

f(x, y, z) = x * y + z
x, y, z = invertinvoke(f, Tuple{Float64, Float64, Float64}, 2.3, rand(3))
@assert f(x, y, z) == 2.3
source
ParametricInversion.passvars!Method

passvars!(ir)

Removes implicit use of variable. Updates ir such that if a block uses some variable v then v is an input to that block.

source