Skip to content

Instantly share code, notes, and snippets.

@peci1
Last active November 15, 2024 18:13
Show Gist options
  • Save peci1/720e7df143dd20cd25296127c89868cf to your computer and use it in GitHub Desktop.
Save peci1/720e7df143dd20cd25296127c89868cf to your computer and use it in GitHub Desktop.
PINN example: Ballistic curve
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
\documentclass{beamer}
\usepackage{listings}
\lstset{language={[LaTeX]TeX}, basicstyle=\small}
\usepackage{multimedia}
\definecolor{links}{HTML}{302080}
\hypersetup{colorlinks,linkcolor=links,urlcolor=links}
\usepackage[utf8]{inputenc}
\usepackage{xspace}
\usetheme{Madrid}
\usepackage[overridenote]{pdfpc}
\mode<presentation>
\title[Physical Intuition in DNNs]{Physical Intuition in Deep Neural Networks}
\author[Martin Pecka]{Martin Pecka}
\institute[CTU FEE]{Czech Technical University in Prague, Faculty of Electrical Engineering}
\begin{document}
\begin{frame}{PINN: Example: Ballistic Curve}
\begin{center}
The curve is defined by a differential equation and initial conditions:
$$\vec{a} = -\mu \|\vec{v}\| \vec{v} - \vec{g}$$
$$\mu = 0.03; \vec{s_0} = (0, 0); \vec{v_0} = (200, 200) $$
\includegraphics[width=\linewidth]{gt.png}
\end{center}
\end{frame}
\begin{frame}{PINN: Example: Ballistic Curve}
\begin{center}
There is no closed-form solution for $\vec{s_t}$, numerical integration is needed.\\
\includegraphics[width=\linewidth]{gt.png}
\end{center}
\end{frame}
\begin{frame}{PINN: Example: Ballistic Curve: Black-box NN}
\begin{center}
$$ \texttt{loss} = \|\hat{\vec{s}} - \vec{s_{train}} \|^2 $$
\href{run:train-dumb.mp4?autostart&loop}
{\includegraphics[width=\linewidth]{train-dumb.png}}
\end{center}
\end{frame}
\begin{frame}{PINN: Example: Ballistic Curve: Black-box NN with L2 Regularizer}
\begin{center}
$$ \texttt{loss} = \|\hat{\vec{s}} - \vec{s_{train}} \|^2 + \sum \| \vec{w} \|^2 $$
\href{run:train-l2.mp4?autostart&loop}
{\includegraphics[width=\linewidth]{train-l2.png}}
\end{center}
\end{frame}
\begin{frame}{PINN: Example: Ballistic Curve: Gray-box NN}
\begin{center}
Add the error in the differential equation to the loss. $\vec{v}$ an $\vec{a}$ are actually already computed by the net - they are the gradients (and 2nd order gradients).
$$ \texttt{loss} = \|\hat{\vec{s}} - \vec{s_{train}} \|^2 + \sum \| \vec{a} - (-\mu \|\vec{v}\| \vec{v} - \vec{g}) \|^2 $$
\href{run:train-pinn.mp4?autostart&loop}
{\includegraphics[width=\linewidth]{train-pinn.png}}
\end{center}
\end{frame}
\end{document}
% This file is part of pdfpc.
% Copyright (C) 2023 Evgeny Stambulchik
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
% -------------------------------------------------------------------------------------------
%
% Allow for defining some meta data and simple textual notes for use
% with the pdfpc presentation application <https://pdfpc.github.io>.
%
% -------------------------------------------------------------------------------------------
%
% Inspired by Carsten Brandt's <https://github.com/cebe/pdfpc-latex-notes>.
%
% -------------------------------------------------------------------------------------------
%
% Please report bugs and other problems as well as suggestions for improvements
% to the issue tracker at github <https://github.com/pdfpc/pdfpc/>
%
% -------------------------------------------------------------------------------------------
%
\ProvidesPackage{pdfpc}[2023/10/21 v0.7.1 PDFPC]
\NeedsTeXFormat{LaTeX2e}
%
% Require additional packages needed by \sty{pdfpc}:
\RequirePackage{kvoptions}
\RequirePackage{xstring}
\RequirePackage{iftex}
\RequirePackage{hyperxmp}
\ifLuaTeX
\RequirePackage{stringenc}
\RequirePackage{pdftexcmds}
\fi
%
\SetupKeyvalOptions{
family=PDFPC,
prefix=PDFPC@
}
%
\DeclareStringOption{duration}
\DeclareStringOption{starttime}
\DeclareStringOption{endtime}
\DeclareStringOption{enduserslide}
\DeclareStringOption{lastminutes}
\DeclareBoolOption{hidenotes}
\DeclareBoolOption{overridenote}
\DeclareStringOption{notesposition}
\DeclareBoolOption[false]{disablemarkdown}
\DeclareStringOption{defaulttransition}
\DeclareDefaultOption{\@unknownoptionerror}
%
\ProcessKeyvalOptions*
%
\ifx\PDFPC@duration\@empty
\else
\IfInteger{\PDFPC@duration}{}
{\PackageWarningNoLine{pdfpc}{`duration' should be an integer}}%
\fi
%
\ifx\PDFPC@enduserslide\@empty
\else
\IfInteger{\PDFPC@enduserslide}{}
{\PackageWarningNoLine{pdfpc}{`enduserslide' should be an integer}}%
\fi
%
\ifx\PDFPC@lastminutes\@empty
\else
\IfInteger{\PDFPC@lastminutes}{}
{\PackageWarningNoLine{pdfpc}{`lastminutes' should be an integer}}%
\fi
%
\ifPDFPC@overridenote
\renewcommand<>{\note}[2][]{%
\IfStrEq{#1}{item}%
% Imitate a bullet
{\pdfpcnote#3{* #2}}%
{\pdfpcnote#3{#2}}%
}%
\fi
%
\def\pdfpc@notespositionauto{auto}%
\ifx\PDFPC@notesposition\@empty%
\def\PDFPC@notesposition{auto}%
\fi%
%
\def\pdfpcsetup{\kvsetkeys{PDFPC}}%
% Guesswork for beamer/pgfpages notes
\ifx\PDFPC@notesposition\pdfpc@notespositionauto%
\def\PDFPC@notesposition{none}%
\def\pdfpc@onepaperheight{\paperheight}%
\def\pdfpc@twopaperheight{2\paperheight}%
\def\pdfpc@onepaperwidth{\paperwidth}%
\def\pdfpc@twopaperwidth{2\paperwidth}%
\def\pdfpc@pagecenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}%
\ifx\pgfpageoptiontwoheight\pdfpc@onepaperheight%
\ifx\pgfpageoptiontwowidth\pdfpc@twopaperwidth%
\ifx\pgfpageoptionfirstcenter\pdfpc@pagecenter%
\def\PDFPC@notesposition{right}%
\else%
\def\PDFPC@notesposition{left}%
\fi%
\fi%
\fi%
\ifx\pgfpageoptiontwoheight\pdfpc@twopaperheight%
\ifx\pgfpageoptiontwowidth\pdfpc@onepaperwidth%
\ifx\pgfpageoptionfirstcenter\pdfpc@pagecenter%
\def\PDFPC@notesposition{top}%
\else%
\def\PDFPC@notesposition{bottom}%
\fi%
\fi%
\fi%
\fi%
%
% Our schema
\newcommand*{\pdfpc@schema}{%
\hyxmp@add@to@xml{%
______<rdf:Description xmlns:pdfpc="https://github.com/pdfpc/pdfpc">^^J%
}%
\hyxmp@add@simple{pdfpc:Duration}{\PDFPC@duration}%
\hyxmp@add@simple{pdfpc:StartTime}{\PDFPC@starttime}%
\hyxmp@add@simple{pdfpc:EndTime}{\PDFPC@endtime}%
\hyxmp@add@simple{pdfpc:EndUserSlide}{\PDFPC@enduserslide}%
\hyxmp@add@simple{pdfpc:LastMinutes}{\PDFPC@lastminutes}%
\hyxmp@add@simple{pdfpc:NotesPosition}{\PDFPC@notesposition}%
\ifPDFPC@disablemarkdown%
\hyxmp@add@simple{pdfpc:DisableMarkdown}{true}%
\else%
\hyxmp@add@simple{pdfpc:DisableMarkdown}{false}%
\fi
\hyxmp@add@simple{pdfpc:DefaultTransition}{\PDFPC@defaulttransition}%
\hyxmp@add@to@xml{%
______</rdf:Description>^^J%
}%
}
%
% Piggybacking on the hyperxmp schema...
\let\oldhyxmp@pdf@schema\hyxmp@pdf@schema
\renewcommand{\hyxmp@pdf@schema}{{\oldhyxmp@pdf@schema}{\pdfpc@schema}}
%
% Note command
\ifPDFPC@hidenotes%
\newcommand<>{\pdfpcnote}[1]{}%
\else%
\ifXeTeX%
\newcommand<>{\pdfpcnote}[1]{%
\only#2{%
\edef\\{\string\n}%
\special{pdf: ann width 0pt height 0pt depth 0pt%
<<%
/Subtype /Text%
/Contents (#1)%
/F 6%
>>%
}%
}%
\relax%
}%
\else%
\ifLuaTeX%
\protected\def\pdfannot {\pdfextension annot }%
\newcommand<>{\pdfpcnote}[1]{%
\only#2{%
\edef\tmp@a{\pdf@escapehexnative{#1}}
\expandafter\SE@ConvertFrom\expandafter\tmp@a\expandafter{\tmp@a}{utf8}
{%
\edef\\{\string\n}%
\pdfannot width 0pt height 0pt depth 0pt {%
/Subtype /Text%
/Contents <FEFF\tmp@a>%
/F 6%
}%
}%
}%
\relax%
}%
\else%
\newcommand<>{\pdfpcnote}[1]{%
\only#2{%
\edef\\{\string\n}%
\pdfannot width 0pt height 0pt depth 0pt {%
/Subtype /Text%
/Contents (#1)%
/F 6%
}%
}%
\relax%
}%
\fi%
\fi%
\fi%
%
\endinput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment