Playing with the PyUNLocBoX

https://github.com/epfl-lts2/pyunlocbox


In [ ]:
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt
from pyunlocbox import functions, solvers

plt.rcParams['figure.figsize'] = (17, 5)

1 Example

Following is a typical usage example who solves an optimization problem composed by the sum of two convex functions. The functions and solver objects are first instantiated with the desired parameters. The problem is then solved by a call to the solving function.


In [ ]:
f1 = functions.norm_l2(y=[4, 5, 6, 7])
f2 = functions.dummy()
solver = solvers.forward_backward()
ret = solvers.solve([f1, f2], [0., 0, 0, 0], solver, atol=1e-5)
ret['sol']

In [ ]:
plt.semilogy(np.array(ret['objective'])[:, 0], '.-');

2 Tutorials

Try to follow one of our tutorials.


In [ ]:
# Your code here.

3 Playground

Or try anything that goes through your mind! Look at the reference guide to know more about the API.


In [ ]:
# Your code here.

If you miss a package, you can install it with:


In [ ]:
! pip install pyunlocbox