Exercise - Jensen's Inequality

Introduction

This notebooks provides a fairly simple proof of Jensen's inequality. This inequality can be used to show the relationship between taking the expectation value after acting with a concave or convex function on a data set and vice versa.

Requirements

Knowledge

To complete this exercise notebook you should possess knowledge about the following topics:

  • Expectation value$ \mathbb E $
  • concave and convex functions

Python Modules

import numpy as np
import scipy.stats
from matplotlib import pyplot as plt

%matplotlib inline

Jensen's inequality

states that:

if$ g $ is a convex function, then

$ \mathbb E g(X) \geq g( \mathbb E X) $

if$ g $ is a concave functionn, then

$ \mathbb E g(X) \leq g( \mathbb E X) $ .

Exercise

Try to find a simple proof for Jensen's inequality using a concave or convex function$ g(x) $ and a tangent$ L(x)=a+bx $ on$ g(x) $ at a certain point$ \mathbb E(x) $, which will be the expectation value.

Before starting the proof it might be usefull to visualize a concave and a convex function and there tangent lines. Use for example$ x^2 $ and$ \log(x) $.

Licenses

Notebook License (CC-BY-SA 4.0)

The following license applies to the complete notebook, including code cells. It does however not apply to any referenced external media (e.g., images).

exercise-jensen-inequality
by Oliver Fischer
is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at https://gitlab.com/deep.TEACHING.

Code License (MIT)

The following license only applies to code cells of the notebook.

Copyright 2018 Oliver Fischer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.