A computer implemented method for preserving privacy of a linear regression model used in distributed learning by a set of agents sharing covariate data and/or target data for said model, comprising obtaining an invertible random perturbation matrix, as an algebraic encryption key given by multiplication of a plurality of invertible randomly generated perturbation sub-matrixes, there being a perturbation sub-matrix for each respective agent,
- wherein the invertible random perturbation matrix is to be used as an algebraic encryption key by left-multiplication of the data to be encrypted,
- wherein an invertible perturbation sub-matrix is privately and randomly generated by each individual agent,
- comprising the steps of:
- for each individual agent, the individual agent privately generating a first random invertible matrix and a second random invertible matrix, multiplying a horizontally concatenated matrix of the data to be encrypted by said individual agent and said first matrix, with the second matrix, and sharing the resulting multiplication with a receiving agent selected from one of the remaining agents;
- the receiving agent multiplying the perturbation sub-matrix of the receiving agent by the received multiplication, and sharing the resulting multiplication with another receiving agent selected from one of the remaining agents, repeating until a last remaining agent receives the multiplication, and then the last remaining agent multiplying the perturbation sub-matrix of the last remaining agent by the received multiplication, and sharing the resulting multiplication with the individual agent;
- and
- for each individual agent, the individual agent recovering the encrypted data of said individual agent by computing the multiplication the shared resulting multiplication with the individual agent with the inverse of the second matrix, horizontally decatenating from the computed multiplication a left-side matrix and a right-side matrix, wherein the right-side matrix is the encrypted data of said individual agent as encrypted by the perturbation matrix;
- for each individual agent, the individual agent sharing the encrypted data of said individual agent with all other agents.