Giter VIP home page Giter VIP logo

pinn_base's Introduction

PINN_Base

A framework for building custom Physics Informed Neural Networks PINNs.

This was built in the course of my own research on PINNs as an alternative to copying and pasting code for each new idea I had. As a result, the base template is built for extending PINNs rather than as a interface for solving particular differential equations.

Currently, it supports Tensorflow 1.15. It was my original intention to have maintain feature parity for a Tensorflow 2.0 version as well however it is very far behind the 1.0 version and may be discontinued in the future.

Installation

To install as a python module, from the git root-directory call

pip install .

Requirements include Tensorflow 1.15, as well as the usual suspects from the scipy stack.

Why TF 1.15?

PINNs remain difficult to train with standard first-order methods. The best option remains L-BFGS. The world has moved on to TF 2.0. In that transition, they unfortunately left some things behind, most notably the ScipyOptimizerInterface which was the only native support for L-BFGS that tensorflow had. There are ways to use L-BFGS in TF 2.0 (as well as pytorch), however, none of them are particularly elegant making migration a less than compelling prospect.

Extension Philosophy

As it exists, PINN_Base implements a Multi-Layer Perceptron for regression problems. In order to do anything interesting, like solve a differential equation, you will have to extend it by inheriting from PINN_Base. The conventional wisdom when writing a library is to "prefer composition over inheritance". So this design could be criticized on those grounds. The rational for favoring inheritance over composition was to avoid locking myself down to a single interface for each of the components.

For instance, Keras implements a composable library with separate components for the forward-pass, the loss function, and the optimizer. As a result the loss function has a very specific interface which takes only Y and Y_hat. This makes it cumbersome (though not impossible) to implement a PINN using Keras since one also needs the input, X, in order to compute grad(Y,X). Inheritance, makes it easier to override portions of the interface as needed while still reusing code. This is especially important in a research context where it is intentionally left unknown what the typical use case will end up being.

Usage

See examples. TODO: Add Examples

pinn_base's People

Contributors

roman-amici avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.