Optimization Algorithms

Algorithms for non-differentiable losses

class spqr.algorithms.SubgradientMethod(oracle, params)[source]

Class aimed at running subgradient method.

Parameters
  • oracle – An oracle object among OracleSubgradient, OracleSmoothGradient, IntergratedOracleSubgradient, IntegratedOracleSmoothGradient.

  • params – A dictionnary containing the parameters of the algorithm

run(x, y, verbose_mode=False)[source]

Runs the subgradient method

Parameters
  • x (numpy.ndarray) – matrix whose lines are realizations of random variable X

  • y (numpy.array) – vector whose coefficients are realizations of random variable y

  • verbose_mode (bool) – If True, saves function values during iterations of selected algorithm as well as time since start.

class spqr.algorithms.DualAveraging(oracle, params)[source]
run(x, y, verbose_mode=False)[source]

Runs a bacic version of Dual Averaging Algorithm

Parameters
  • x (numpy.ndarray) – matrix whose lines are realizations of random variable X

  • y (numpy.array) – vector whose coefficients are realizations of random variable y

  • verbose_mode (bool) – If True, saves function values during iterations of selected algorithm as well as time since start.

Algorithms for differentiable losses

class spqr.algorithms.GradientMethod(oracle, params)[source]
run(x, y, verbose_mode=False)[source]

Runs Gradient Method

Parameters
  • x (numpy.ndarray) – matrix whose lines are realizations of random variable X

  • y (numpy.array) – vector whose coefficients are realizations of random variable y

  • verbose_mode (bool) – If True, saves function values during iterations of selected algorithm as well as time since start.

class spqr.algorithms.NesterovMethod(oracle, params)[source]

Class aimed at running Accelerated Gradient Method.

Parameters
  • oracle – An oracle object among OracleSubgradient, OracleSmoothGradient, IntergratedOracleSubgradient, IntegratedOracleSmoothGradient.

  • params – A dictionnary containing the parameters of the algorithm

run(x, y, verbose_mode=False)[source]

Runs Nesterov Algorithm

Parameters
  • x (numpy.ndarray) – matrix whose lines are realizations of random variable X

  • y (numpy.array) – vector whose coefficients are realizations of random variable y

  • verbose_mode (bool) – If True, saves function values during iterations of selected algorithm as well as time since start.

class spqr.algorithms.LBFGS(oracle, params)[source]

Class aimed at running Low memory bfgs method.

Parameters
  • oracle – An oracle object among OracleSubgradient, OracleSmoothGradient, IntergratedOracleSubgradient, IntegratedOracleSmoothGradient.

  • params – A dictionnary containing the parameters of the algorithm

run(X, y, verbose_mode=False)[source]

Runs low-memory LBFGS algorithm

Parameters
  • x (numpy.ndarray) – matrix whose lines are realizations of random variable X

  • y (numpy.array) – vector whose coefficients are realizations of random variable y

  • verbose_mode (bool) – If True, saves function values during iterations of selected algorithm as well as time since start.