The invention discloses a linear regression algorithm based on secure two-party calculation. The method comprises the following steps: S1, adopting multiplication of a secret sharing value; S2, preprocessing the training data; S3, initializing parameters; S4, updating model parameters; S5, preprocessing the prediction data; S6, calculating a prediction sharing value; and S7, reconstructing a prediction result. According to the scheme, the privacy of data and model parameters is not leaked, and meanwhile, the required communication overhead is lower. According to the method, privatization is carried out on original training data and model parameters, and a linear regression algorithm for protecting data privacy is realized by virtue of convenience of cloud service under the condition that acloud server cannot obtain the original training data and intermediate parameters and cannot deduce the model parameters. On the basis, a regression prediction task can be safely executed, and when computing and storing resources of the cloud server are utilized, training and data prediction of a linear regression model can be efficiently and accurately carried out.