PPML (Privacy-Preserving Machine Learning) using the Paillier Cryptosystem is a project aimed at developing a secure and privacy-preserving machine learning system using the Paillier encryption scheme. This project focuses on implementing machine learning algorithms while ensuring that sensitive data remains encrypted during processing, thus preserving the privacy of individual data points.
Linear regression is employed as the modeling technique to establish the relationship between the laptop features and their corresponding prices. By identifying the optimal coefficients that minimize the residuals, the model can accurately predict the prices of laptops based on their features. The use of linear regression in conjunction with the Paillier cryptosystem allows for both accuracy and privacy in the prediction process.
- Implements machine learning algorithms using the Paillier encryption scheme to perform computations on encrypted data.
- Ensures data privacy by encrypting data before processing.
- Encrypts and decrypts data using a public-private key pair.
- Performs linear regression to predict laptop prices while maintaining data privacy.
-
Key Generation and Storage:
- Generate a Paillier public-private key pair.
- Store the keys securely in a JSON file.
-
Data Preprocessing:
- Convert raw data into a suitable format for machine learning.
- Serialize and encrypt the preprocessed data using the public key.
-
Model Computation:
- Perform computations on the encrypted data using linear regression coefficients.
- Encrypt the model's intercept using the public key.
-
Prediction:
- Compute predictions on encrypted data.
- Return predictions in encrypted form.
-
Decryption:
- Decrypt the predictions using the private key.
- Obtain the final prediction result.
PPML-using-Paillier-Cryptosystem/
├── Data/
├── Encrypted_Data/
├── Encrypted_ModelParameters/
├── Encrypted_Predicted_value/
├── PaillierKeys/
├── Tests/
│ ├── test_CustomerDecrypts.py
│ ├── test_CustomerEncrypts.py
│ ├── test_ServerModelRun.py
├── col_tnf.pkl
├── CustomerDecrypts.py
├── CustomerEncrypts.py
├── LICENSE
├── PreProcessingDataAndModelTraining.py
├── readme.md
└── ServerModelRun.py
- Clone the repository:
git clone https://github.com/yourusername/PPML-using-Paillier-Cryptosystem.git cd PPML-using-Paillier-Cryptosystem
- Generate Keys:
python CustomerEncrypts.py
- Encrypt Data:
- Ensure your data is in the appropriate format.
- Run the script to preprocess and encrypt data.
python CustomerEncrypts.py
- Compute Encrypted Predictions:
python ServerModelRun.py
- Decrypt Predictions:
python CustomerDecrypts.py
Contributions to PPML using Paillier Cryptosystem are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.