A method for encrypting data, the method comprising: generating a target matrix comprising a first dimension based on a number of data samples and a second dimension of data features corresponding to the data samples, the data samples being associated with a user ; performing an encryption calculation on the target matrix based on a principal component analysis (PCA) algorithm to generate an encryption matrix comprising the first dimension and a third dimension that is smaller than the second dimension wherein performing the encryption calculation on the target matrix further comprises: separately performing zero averaging on values of vectors corresponding to the data features in the target matrix; calculating a covariance matrix that corresponds to the target matrix and that is obtained after the zero averaging; calculating eigenvalues of the covariance matrix and eigenvectors corresponding to the eigenvalues; sorting the eigenvectors based on the eigenvalues, and extracting the third dimension of eigenvectors with the largest eigenvalues to generate a projection matrix comprising the second dimension and the third dimension; multiplying the target matrix by the projection matrix to obtain the encryption matrix; and transmitting the encryption matrix to a modeling server executing a machine learning model, wherein the encryption matrix is used to train the machine learning model for assessing a transaction risk of the user . generating a target matrix comprising a first dimension based on a number of data samples and a second dimension of data features corresponding to the data samples, the data samples being associated with a user ; performing an encryption calculation on the target matrix based on a principal component analysis (PCA) algorithm to generate an encryption matrix comprising the first dimension and a third dimension that is smaller than the second dimension wherein performing the encryption calculation on the target matrix further comprises: separately performing zero averaging on values of vectors corresponding to the data features in the target matrix; calculating a covariance matrix that corresponds to the target matrix and that is obtained after the zero averaging; calculating eigenvalues of the covariance matrix and eigenvectors corresponding to the eigenvalues; sorting the eigenvectors based on the eigenvalues, and extracting the third dimension of eigenvectors with the largest eigenvalues to generate a projection matrix comprising the second dimension and the third dimension; multiplying the target matrix by the projection matrix to obtain the encryption matrix; and separately performing zero averaging on values of vectors corresponding to the data features in the target matrix; calculating a covariance matrix that corresponds to the target matrix and that is obtained after the zero averaging; calculating eigenvalues of the covariance matrix and eigenvectors corresponding to the eigenvalues; sorting the eigenvectors based on the eigenvalues, and extracting the third dimension of eigenvectors with the largest eigenvalues to generate a projection matrix comprising the second dimension and the third dimension; multiplying the target matrix by the projection matrix to obtain the encryption matrix; and transmitting the encryption matrix to a modeling server executing a machine learning model, wherein the encryption matrix is used to train the machine learning model for assessing a transaction risk of the user . <EOS>