GithubHelp home page GithubHelp logo

bregmanprojection's Introduction

BregmanProjection

This provides a simple python implementation of the Bregman Projection with omega potentials described in this paper, currently under review at the IEEE Conference on Decision and Control (CDC).

Two implementations are provided:

Approximate projections for omega potentials

Uses a bisection method to compute an approximate solution up to a precision epsilon. The complexity is O(d log 1/epsilon), where d is the size of x. Here is an example use (for the exponential projection)

import projections as p

def expPotential(u):
    return math.exp(u - 1) - epsilon

def expInversePotential(u):
    return 1 + math.log(u+epsilon)

expProjection = p.potentialProjection(expPotential, expInversePotential)

x = [1/2, 1/2]
g = [1.5, 1]
epsilon = 0.0001

x1 = expProjection(x, g, epsilon)

We first start by defining two functions: expPotential and expInversePotential, then we instantiate the potentialProjection with this potential. Then to project the current iterate x, with gradient g, up to a precision epsilon, we call expProjection(x, g, epsilon).

Exact projections for exponential potentials

In the case of exponential projections, the exact solution can be computed. We provide two methods:

Sort and project

This algorithm creates a vector of weights, sorts it, and finds a threshold to compute the projection. The complexity is O(d log d) where d is the size of x. Example code:

import projections as p

x = [1/2, 1/2]
g = [1.5, 1]
epsilon = 0.0001

x1 = expProjectionSort(x, g, epsilon)

Quick project

This algorithm uses a random pivot at each iteration, splits the list into two parts according to the pivot (the criterion is detailed in the paper), then inducts on one of the lists. The expected complexity is O(d), where d is the size of x. Example code

import projections as p

x = [1/2, 1/2]
g = [1.5, 1]
epsilon = 0.0001

x1 = expQuickProjection(x, g, epsilon)

Numerical test

This test compares the average time to project a vector of size d, using the SortProject and the QuickProject algorithms. The code is in test.py

Average run times Average run times

bregmanprojection's People

Contributors

walidk avatar

Watchers

 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.