All Projects → ChezJrk → Teg

ChezJrk / Teg

Licence: other
A differentiable programming language with an integration primitive that soundly handles interactions among the derivative, integral, and discontinuities.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Teg

snl-quest
An open source, Python-based software application suite for energy storage simulation and analysis developed by Sandia National Laboratories.
Stars: ✭ 82 (+228%)
Mutual labels:  optimization
autodiff
A .NET library that provides fast, accurate and automatic differentiation (computes derivative / gradient) of mathematical functions.
Stars: ✭ 69 (+176%)
Mutual labels:  optimization
REopt Lite API
The model for the REopt API, which is used as the back-end for the REopt Webtool (reopt.nrel.gov/tool), and can be accessed directly via the NREL Developer Network (https://developer.nrel.gov/docs/energy-optimization/reopt/v1)
Stars: ✭ 53 (+112%)
Mutual labels:  optimization
zoofs
zoofs is a python library for performing feature selection using a variety of nature-inspired wrapper algorithms. The algorithms range from swarm-intelligence to physics-based to Evolutionary. It's easy to use , flexible and powerful tool to reduce your feature size.
Stars: ✭ 142 (+468%)
Mutual labels:  optimization
optimizer-api
Unified API for multiple optimizer engines
Stars: ✭ 26 (+4%)
Mutual labels:  optimization
yask
YASK--Yet Another Stencil Kit: a domain-specific language and framework to create high-performance stencil code for implementing finite-difference methods and similar applications.
Stars: ✭ 81 (+224%)
Mutual labels:  optimization
ultraopt
Distributed Asynchronous Hyperparameter Optimization better than HyperOpt. 比HyperOpt更强的分布式异步超参优化库。
Stars: ✭ 93 (+272%)
Mutual labels:  optimization
falcon
A WordPress cleanup and performance optimization plugin.
Stars: ✭ 17 (-32%)
Mutual labels:  optimization
Windows11-Optimization
Community repository, to improve security and performance of Windows 10 and windows 11 with tweaks, commands, scripts, registry keys, configuration, tutorials and more
Stars: ✭ 17 (-32%)
Mutual labels:  optimization
web-performance-optimization
Web 性能优化
Stars: ✭ 23 (-8%)
Mutual labels:  optimization
profiling
Non-discriminatory profiling of Ruby code leveraging the ruby-prof gem
Stars: ✭ 12 (-52%)
Mutual labels:  optimization
modest-py
FMI-compliant Model Estimation in Python
Stars: ✭ 40 (+60%)
Mutual labels:  optimization
pareto
Spatial Containers, Pareto Fronts, and Pareto Archives
Stars: ✭ 69 (+176%)
Mutual labels:  optimization
dopt
A numerical optimisation and deep learning framework for D.
Stars: ✭ 28 (+12%)
Mutual labels:  optimization
tensorflow-riemopt
A library for optimization on Riemannian manifolds
Stars: ✭ 72 (+188%)
Mutual labels:  optimization
cplex-example
Solving a TSP with the CPLEX C++ API.
Stars: ✭ 40 (+60%)
Mutual labels:  optimization
good lp
Linear Programming for Rust, with an user-friendly API. This crate allows modeling LP problems, and let's you solve them with various solvers.
Stars: ✭ 77 (+208%)
Mutual labels:  optimization
PyOptSamples
Optimization sample codes on Python
Stars: ✭ 20 (-20%)
Mutual labels:  optimization
Fake-Interior-Shader-for-GodotEngine
Interior Mapping shader for the Godot Game Engine 3.x that works with both GLES3 and GLES2.
Stars: ✭ 40 (+60%)
Mutual labels:  optimization
NumDiff
Modern Fortran Numerical Differentiation Library
Stars: ✭ 48 (+92%)
Mutual labels:  optimization

Teg

Teg is a differentiable programming language that includes an integral primitive, which allows for soundly optimizing integrals with discontinuous integrands. This is a research artifact for the paper: Systematically Optimizing Parametric Discontinuities. This repository contains the core library implementation, while the applications can be found at https://github.com/ChezJrk/teg_applications. The applications include image stylization, fitting shader parameters, trajectory optimization, and optimizing physical designs.

Installation Instructions

Teg requires Python 3.6+. To install Teg run:

git clone https://github.com/ChezJrk/Teg.git
cd Teg
pip install -e .

Illustrative Example

A minimal illustrative example is:

\frac{d}{dt} \int_{x = 0}^1 [x < t]

This is the integral of a step discontinuity that jumps from 1 to 0 at . If we set , then the result is 1, but discretizing before computing the derivative as is standard in differentiable programming languages (e.g., PyTorch and TensorFlow) results in a derivative of 0. Our language correctly models the interaction between the integral and the parametric discontinuity. In our language the implementation for this simple function is:

from teg import TegVar, Var, Teg, IfElse
from teg.derivs import FwdDeriv
from teg.eval.numpy_eval import evaluate

x, t = TegVar('x'), Var('t', 0.5)
expr = Teg(0, 1, IfElse(x < t, 1, 0), x)
deriv_expr = FwdDeriv(expr, [(t, 1)])
print(evaluate(deriv_expr))  # prints 1

Code Structure

Our implementation is in the teg folder:

  • derivs has the implementation of the source-to-source derivative including code for computing the forward and reverse derivatives in fwd_deriv.py and reverse_deriv.py respectively. Supported discontinuous functions are in the edge folder.
  • eval and include have all of the code for evaluating expressions either by interpreting locally in Python or compiling to C.
  • ir includes an intermediate representation useful in compiling code down to C.
  • lang includes the main language primitives with the base language in base.py and teg.py and the extended language (that has the Dirac delta function) is in extended.py.
  • maps and math specifies basic math libraries.
  • passes includes source-to-source compilation passes. Notably, reduce.py has the lowering code from the external language to the internal language.

We have a test folder with all of the systems tests.

Compiling to C

It is possible to compile Teg programs to C using python3 -m teg --compile --target C [[FILE NAME]].py. See teg/__main__.py for more options. To specify C compilation flags, use python3 -m teg --include-options.

Citation

@article{BangaruMichel2021DiscontinuousAutodiff,
  title = {Systematically Differentiating Parametric Discontinuities},
  author = {Bangaru, Sai and Michel, Jesse and Mu, Kevin and Bernstein, Gilbert and Li, Tzu-Mao and Ragan-Kelley, Jonathan},
  journal = {ACM Trans. Graph.},
  volume = {40},
  number = {107}, 
  pages = {107:1-107:17},
  year = {2021},
  publisher = {ACM},
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].