Learning Parametric Convex Functions

Maximilian Schaller, Alberto Bemporad, Stephen Boyd · 2025

Read Learning Parametric Convex Functions by Maximilian Schaller, Alberto Bemporad, Stephen Boyd (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2506-04183.txt.

Introduction

Maximilian Schaller, Alberto Bemporad, and Stephen Boyd tackle the fitting of parametrized convex functions to data, in a 2025 paper. Such a function stays bowl-shaped in its main variable for every allowed value of a side parameter. Families of this kind describe whole classes of optimization problems in the special languages used to state them. Fitting one directly to observed or simulated data had not been addressed.

Their method fits a function that a disciplined programming framework can accept, so the result drops straight into an optimization model. They release the code as open source. Examples run from simple teaching cases to practical ones, showing the fit working end to end. The authors frame the tool as a bridge between raw data and ready-to-solve convex models.

Catalog record

CREATORMaximilian Schaller, Alberto Bemporad, Stephen Boyd
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE33 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2506-04183

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Learning Parametric Convex Functions Maximilian Schaller, Alberto Bemporad, Stephen Boyd Abstract A parametrized convex function depends on a variable and a parameter, and is convex in the variable for any valid value of the parameter. Such functions can be used to specify parametrized convex optimization problems, i.e. , a convex optimization family, in domain specific languages for convex optimization. In this paper we address the problem of fitting a parametrized convex function that is compatible with disciplined programming, to some given data. This allows us to fit a function arising in a convex optimization formulation directly to observed or simulated data. We demonstrate our open-source implementation on several examples, ranging from illustrative to practical. 1 Introduction 1.1 Parametrized convex functions A parametrized convex function (PCF) f has the form f:{\mbox{\bf R}}^{n}\times\Theta\to{\mbox{\bf R}}^{d}, where \Theta\subseteq{\mbox{\bf R}}^{p} . To be a PCF, f must be continuous in \theta , and for each i=1,\ldots,d , f_{i}(x,\theta) is convex in x for any \theta\in\Theta . We refer to the first argument x of the PCF f as the variable , and the second argument \theta as the parameter . When d=1 , we refer to f as a scalar PCF. 1.2 Disciplined convex programming The terms variable and parameter in a PCF are taken from disciplined convex programming (DCP), a method for expressing a PCF as an expression in a domain specific language (DSL) constructed from variables, constants, parameters, and a small library of functions called atoms [ AVDB18 , DB16 ] . In DCP, the expression must be constructed in a specific way that corresponds to a composition rule that establishes convexity of the function with respect to the variable, for any valid parameter. Functions expressed in DCP form can be used to form a parametrized convex optimization problem or convex optimization family. When the parameters are given specific numerical values, we obtain a problem instance, which can be solved by automatically transforming the problem instance to a canonical form, solving the canonical form, and then retrieving the solution of the original problem instance from the solution of the canonicalized problem instance. Examples of DSLs that leverage DCP for modeling convex optimization problems (and support parameters) include CVXPY [ DB16 ] (in Python), CVXR [ FNB20 ] (in R), Convex.jl [ UMZ+14 ] and JuMP [ DHL17 ] (in Julia). Precursors that do not handle parameters include CVX [ GB14 ] and YALMIP [ L0̈4 ] (in Matlab). 1.3 Examples PCFs arise in many applications, including control, machine learning, resource allocation, and finance, to name just a few. We describe below a few typical ones, some specific and some more generic. In our examples we assume that f is a scalar PCF. Fuel use map. Here f(x,\theta) gives the instantaneous fuel use rate. The variable x might correspond to thrust or power output, variables that typically appear in an optimization problem; the parameter \theta contains additional parameters that affect the fuel use, such as temperature. When modeling the total fuel use of a set of actuators on a moving vehicle, x can represent the net force and torque on the vehicle, and \theta can contain the vehicle orientation, which would affect which actuators are used to obtain the required force and torque. Battery aging model. Here f(x,\theta) gives the rate of aging of a battery, i.e. , reduction of capacity due to use, relative to the initial battery capacity. The variable x corresponds to the battery charge/discharge rate, which might appear in an optimization problem. The parameter \theta contains other quantities that affect aging of the battery, such as its temperature. Convex optimization control policy (COCP). A control policy maps the context, i.e. , what is known at a given time, such as the state of a dynamic system and other measurable quantities, into an action denoted u\in\mathcal{U}\subseteq{\mbox{\bf R}}^{r} . In a convex optimization control policy (COCP) [ BAB20 ] the action u is found as the solution of a convex optimization problem that is parametrized by the context. As a concrete example, f(x,\theta) gives the cost of the action u , combined with the long term cost of the next state, which depends on the action. The parameter \theta contains the context observed when computing the control action [ RMD+17 , KC16 , GPM89 ] . Resource allocation. Here f(x,\theta) gives the cost (or negative utility) of providing resources specified by the vector x\in{\mbox{\bf R}}^{n} to n agents. The parameter \theta might contain information like time of the year, month, or day. Financial portfolio construction. The goal of financial portfolio construction is to find a portfolio of financial assets that maximizes the expected return of the portfolio while limiting the investment risk. The function f(x,\theta) might represent a combination of expected return and risk as a function of x , which describes the portfolio. The parameter \theta provides information about market conditions, or current forecasts. 1.4 Learning a parametrized convex function This paper concerns learning a PCF f from data, i.e. , fitting a PCF to data, (x^{k},\theta^{k})\in{\mbox{\bf R}}^{n}\times\Theta,\quad y^{k}\in{\mbox{\bf R}}^{d},\quad k=1,\ldots,N. (1) The PCF f is specified by its architecture and a choice of model weights , which we denote w\in{\mbox{\bf R}}^{q} . We require our approximation f to be DCP expressible, which implies that it can be used to construct parametrized convex problems. This fitting method allows us to learn a DCP expression directly from observed (or generated) data. Fitting method. We use a standard regularized loss method to choose a set of model weights. Let \ell:{\mbox{\bf R}}^{q}\times{\mbox{\bf R}}^{n}\times\Theta\times{\mbox{\bf R}}^{d}\to{\mbox{\bf R}} denote a loss function, and r:{\mbox{\bf R}}^{q}\to{\mbox{\bf R}} a regularizer function. The loss function is used to judge how well our approximation fits the data, and the regularization function is meant to penalize complexity. We choose w to (approximately) minimize the regularized average loss, \frac{1}{N}\sum_{k=1}^{N}\ell(w;x^{k},\theta^{k},y^{k})+\lambda r(w), (2) where \lambda\geq 0 is a hyper-parameter that scales the regularization. In this context we refer to the data as training data, since it is used to train or learn the PCF. As in all data fitting methods we judge a candidate PCF by its accuracy on unseen data. (The loss used to evaluate the model can differ from the loss \ell used to train the model.) To find a PCF that performs well on unseen data we use the standard technique of cross-validation. We partition the original data into K groups of approximately equal size, called folds, and for each fold we train the model weights on the data not including that fold, and evaluate the average loss on the data in that fold. We average the losses for the K folds to obtain an overall fitting metric. We choose the architecture and the regularization hyper-parameter \lambda so as to minimize the overall fitting metric. Once the architecture and hyper-parameter are chosen, we fit the PCF using all the data. Special cases. The PCF learning problem, i.e. , minimizing ( 1 ), reduces to well known problems in special cases. When n=0 , i.e. , there is no variable, it reduces to the very general problem of fitting a continuous function from \Theta into {\mbox{\bf R}}^{d} . When p=0 (or \Theta is a singleton), there is (effectively) no parameter, and the problem

Read the complete text