8. Distributed Model Fitting¶
It to find a model best fit the measurements. It normally has a observation error term (‘l’ for loss), and a regularization term (r). l and r are chosen to be convex. As the following shows a problem to fit a linear model:
Assume l is additive:
\(l_{i}\) is the loss of ith training example. \(a_{i}\) is the feature vector of example i (the ith system input), and \(b_{i}\) is the ouput(response) of the example i (the ith observation).
- r choose l2 : \(r(x) = \lambda\|x\|_{2}^{2}\), is the tikhonov regularization or a ridge penalty.
- r choose l1 : \(r(x) = \lambda\|x\|_{1}\) is a lasso penalty.
- In some case, part of the parameters should not be regularized (e.g. offset parameters).
- Split across training examples.
- Split across features.
8.1 Examples¶
- Regression
- Classification
- Image segmentation, denoise, decomposition.
8.2 Splitting across examples¶
Large amount of relatively low-dimensional data. Goal: solve in a distributed way. Partition A and b (example inputs and measurements):
The problem will be :
Reform the problem into consensus form to enable distributed calculation (turn into a standard ADMM type of problem):
Using the scaled form of ADMM updates (see 7.3 sharing problems for more details):
- Lasso
- Sparse Logistic Regression
- Support Vector Machine
8.2.1 Group Lasso¶
For Lasso have the function f being squared l2 norm, and r being the l1 norm. Then the ADMM udpates are:
See here for some details about the update of x. The difference from the serial version is that :
- The update of different group of variables \(x_{i}\) could be carry out in parallel.
- The collection and averaging steps.
8.2.2 Distributed l_1-regularized logistic regression¶
Could be compared with the serial version. Could be seen function and Script using L-BFGS for distributed calculations.
8.2.3 Support Vector Machine¶
Here we model a linear support vector machine problem, which is a linear model fitting problem. Which is to find a best linear model applied to feature variables x (\(w^{T}x_{j} + b\)) to best fit the observation y (\(y_{j}\)), where y is a binary variable.
Which is to say, if the observation \(y_{j}\) is 1, we want \(w^{T}x_{j} + b \to 1\) and if the observation \(y_{j}\) is -1, we want \(w^{T}x_{j} + b \to -1\). Which is a optimization problem :
In partice, we can truncate the results of the model to 1 or -1, so the problem will be better if we optimize this:
Where we have M obervations in total. The problem is equivalent to :
By forming :
We have the reformed problem:
Adding the regularization term of the linear model weights w:
If we apply the distributed model where i indicates a sub-set of samples, we have :
Applying the consensus variable z :
We further simplify the problem with a small adjustment in the regularization term : instead of regularize w we will regularize z directly. Then we will have the problem:
The corresponding ADMM updates are :
The update of x will be solved by another optimization problem:
cvx_begin
variable x_var(n)
minimize ( sum(pos(A{i}*x_var + 1)) + rho/2*sum_square(x_var - z(:,i) + u(:,i)) )
cvx_end
The update of z is simple, using the first order optimal condition we have :
Then, we get the final updates of ADMM of linear SVM :
Code and Script could be found in ADMM Stanford page (A distributed version but solved in serial).
8.3 Splitting across Features¶
Model fitting problems with a modest number of examples and a large number of features.
- NLP(natural language processing) : pairs of adjucent words (bigrams), etc.
- Bioinformatics: DNA mutation, etc.
Partition of the parameter vector x as \(x = (x_{1}, ..., x_{N})\), and A as \(A = [A_{1},...,A_{N}]\), the problem will be:
Reform into consensus problem:
The corresponding scaled form of ADMM is :