QuadraticMinimizer

class QuadraticMinimizer(nGram: Int, proximal: Proximal, Aeq: DenseMatrix[Double], beq: DenseVector[Double], maxIters: Int, abstol: Double, reltol: Double, alpha: Double) extends SerializableLogging

Proximal operators and ADMM based Primal-Dual QP Solver

Reference: http://www.stanford.edu/~boyd/papers/admm/quadprog/quadprog.html

It solves problem that has the following structure

1/2 x'Hx + f'x + g(x) s.t Aeqx = b

g(x) represents the following constraints which covers ALS based matrix factorization use-cases

  1. x >= 0
  2. lb <= x <= ub
  3. L1(x)
  4. L2(x)
  5. Generic regularization on x
Value Params
Aeq

rhs matrix for equality constraints

abstol

ADMM absolute tolerance

alpha

over-relaxation parameter default 1.0 1.5 - 1.8 can improve convergence

beq

lhs constants for equality constraints

nGram

rank of dense gram matrix

proximal

proximal operator to be used

reltol

ADMM relative tolerance

Companion
object
trait Serializable
class Object
trait Matchable
class Any

Type members

Classlikes

case class State

Types

type BDM = DenseMatrix[Double]
type BDV = DenseVector[Double]

Value members

Concrete methods

Public API to get an initialState for solver hot start such that subsequent calls can reuse state memmory

Public API to get an initialState for solver hot start such that subsequent calls can reuse state memmory

Returns

the state for the optimizer

def minimize(q: DenseVector[Double], initialState: State): DenseVector[Double]

minimize API for cases where gram matrix is updated through updateGram API. If a initialState is not provided by default it constructs it through initialize

minimize API for cases where gram matrix is updated through updateGram API. If a initialState is not provided by default it constructs it through initialize

Value Params
initialState

provide an optional initialState for memory optimization

q

linear term for quadratic optimization

Returns

converged solution

def minimize(H: DenseMatrix[Double], q: DenseVector[Double], initialState: State): DenseVector[Double]

minimize API for cases where gram matrix is provided by the user. If a initialState is not provided by default it constructs it through initialize

minimize API for cases where gram matrix is provided by the user. If a initialState is not provided by default it constructs it through initialize

Value Params
H

symmetric gram matrix of size rank x rank

initialState

provide an optional initialState for memory optimization

q

linear term for quadratic optimization

Returns

converged solution

def minimize(upper: Array[Double], q: DenseVector[Double], initialState: State): DenseVector[Double]

minimize API for cases where upper triangular gram matrix is provided by user as primitive array. If a initialState is not provided by default it constructs it through initialize

minimize API for cases where upper triangular gram matrix is provided by user as primitive array. If a initialState is not provided by default it constructs it through initialize

Value Params
initialState

provide an optional initialState for memory optimization

q

linear term for quadratic optimization

upper

upper triangular gram matrix of size rank x (rank + 1)/2

Returns

converged solution

def minimize(H: DenseMatrix[Double], q: DenseVector[Double]): DenseVector[Double]
def minimize(q: DenseVector[Double]): DenseVector[Double]
def minimizeAndReturnState(q: DenseVector[Double], rho: Double, initialState: State, resetState: Boolean): State

minimizeAndReturnState API gives an advanced control for users who would like to use QuadraticMinimizer in 2 steps, update the gram matrix first using updateGram API and followed by doing the solve by providing a user defined initialState. It also exposes rho control to users who would like to experiment with rho parameters of the admm algorithm. Use user-defined rho only if you understand the proximal algorithm well

minimizeAndReturnState API gives an advanced control for users who would like to use QuadraticMinimizer in 2 steps, update the gram matrix first using updateGram API and followed by doing the solve by providing a user defined initialState. It also exposes rho control to users who would like to experiment with rho parameters of the admm algorithm. Use user-defined rho only if you understand the proximal algorithm well

Value Params
initialState

provide a initialState using initialState API

q

linear term for the quadratic optimization

resetState

use true if you want to hot start based on the provided state

rho

rho parameter for ADMM algorithm

Returns

converged state from ADMM algorithm

def minimizeAndReturnState(q: DenseVector[Double], initialState: State): State

minimizeAndReturnState API gives an advanced control for users who would like to use QuadraticMinimizer in 2 steps, update the gram matrix first using updateGram API and followed by doing the solve by providing a user defined initialState. rho is automatically calculated by QuadraticMinimizer from problem structure

minimizeAndReturnState API gives an advanced control for users who would like to use QuadraticMinimizer in 2 steps, update the gram matrix first using updateGram API and followed by doing the solve by providing a user defined initialState. rho is automatically calculated by QuadraticMinimizer from problem structure

Value Params
initialState

provide a initialState using initialState API

q

linear term for the quadratic optimization

Returns

converged state from QuadraticMinimizer

def minimizeAndReturnState(H: DenseMatrix[Double], q: DenseVector[Double], initialState: State): State

minimizeAndReturnState API that takes a symmetric full gram matrix and the linear term for quadratic minimization

minimizeAndReturnState API that takes a symmetric full gram matrix and the linear term for quadratic minimization

Value Params
H

gram matrix, symmetric of size rank x rank

initialState

provide a initialState using initialState API for memory optimization

q

linear term

Returns

converged state from QuadraticMinimizer

def minimizeAndReturnState(upper: Array[Double], q: DenseVector[Double], initialState: State): State

minimizeAndReturnState API that takes upper triangular entries of the gram matrix specified through primitive array for performance reason and the linear term for quadratic minimization

minimizeAndReturnState API that takes upper triangular entries of the gram matrix specified through primitive array for performance reason and the linear term for quadratic minimization

Value Params
initialState

provide a initialState using initialState API for memory optimization

q

linear term

upper

upper triangular gram matrix specified as primitive array

Returns

converged state from QuadraticMinimizer

def minimizeAndReturnState(H: DenseMatrix[Double], q: DenseVector[Double]): State
def updateGram(H: DenseMatrix[Double]): Unit

updateGram allows the user to seed QuadraticMinimizer with symmetric gram matrix most useful for cases where the gram matrix does not change but the linear term changes for multiple solves. It should be called iteratively from Normal Equations constructed by the user

updateGram allows the user to seed QuadraticMinimizer with symmetric gram matrix most useful for cases where the gram matrix does not change but the linear term changes for multiple solves. It should be called iteratively from Normal Equations constructed by the user

Value Params
H

rank * rank size full gram matrix

def updateGram(upper: Array[Double]): Unit

updateGram API allows user to seed QuadraticMinimizer with upper triangular gram matrix (memory optimization by 50%) specified through primitive arrays. It is exposed for advanced users like Spark ALS where ALS constructs normal equations as primitive arrays

updateGram API allows user to seed QuadraticMinimizer with upper triangular gram matrix (memory optimization by 50%) specified through primitive arrays. It is exposed for advanced users like Spark ALS where ALS constructs normal equations as primitive arrays

Value Params
upper

upper triangular gram matrix specified in primitive array

Inherited methods

protected def logger: LazyLogger
Inherited from
SerializableLogging

Concrete fields

val admmIters: Int
val full: Int
val linearEquality: Int
val n: Int
val transAeq: DenseMatrix[Double]
val upperSize: Int