29 #ifndef SECURE_SVM_HEADER_GUARD
30 #define SECURE_SVM_HEADER_GUARD
38 #include "libsvm/svm.h"
39 #include "boost/assign.hpp"
52 namespace SecureRecommendations {
68 enum KernelTypes {linear, homogeneousPolynomial, inhomogeneousPolynomial, inverseQuadraticRBF};
71 SecureSvm (
const std::string &directoryPath,
const std::string &modelFile,
const PaillierPublicKey &publicKey,
const std::weak_ptr<const Server> &server);
77 static KernelTypes GetKernel (
const std::string &input);
80 const std::string &GetUnsafeClasses ()
const;
170 void preprocessData ();
193 #endif//SECURE_SVM_HEADER_GUARD
PaillierCiphertext Ciphertext
Provide public access to the T_Ciphertext type.
std::vector< Paillier::Ciphertext > EncryptedVector
Define a vector template specialization for vectors of encrypted data.
Paillier cryptoProvider
The crypto provider.
unsigned short minimumAiDecimalDigits
The minimum number of relevant decimal digits that should preserve.
BigInteger inverseQuadraticRbfNumerator
Scaled 1 - the inverse quadratic RBF kernel numerator.
Paillier::Ciphertext encryptedZero
Contains [0], used for optimization purposes.
std::vector< ModelVector > sMatrix
Matrix which stores the scaled SVM model vectors.
BigInteger scaledGamma
Stores the scaled gamma SVM parameter (1/(number of attributes) by default)
static const std::map< std::string, KernelTypes > kernelTypesMap
Map kernel names to the kernelTypes enum.
std::vector< BigInteger > aVector
Vector which stores the scaled SVM parameters.
SecureSvm::KernelTypes kernel
The SVM kernel type.
Definition of class Config.
BigInteger gammaScaling
The scaling applied to the SVM gamma parameter.
std::string safetyModelFilePrefix
The prefix of the safety block model files.
Implementation of the public-key Paillier Cryptosystem.
KernelTypes
Types of implemented kernels.
Secure Support Vector Machine algorithm.
std::string modelFileName
The name of the model file.
std::vector< EncryptedVector > encryptedSSquaredMatrix
Matrix which stores the encrypted scaled SVM model vectors.
BigInteger featureScalingFactor
The scaling applied to the test and model vectors and .
unsigned short inverseQuadraticRbfKernelRelevantDigits
The number of digits preserved in the inverse quadratic RBF kernel value after performing the divisio...
Definition of class Paillier.
std::weak_ptr< const Server > server
A reference to the server - required for interactive protocol requests with the client (secure divisi...
std::vector< ModelVector > twoGammaSquaredSSMatrix
Matrix containing scaled vector product combinations, , stored as an unraveled upper triangular matri...
std::vector< ModelVector > minusTwoSMatrix
Matrix which stores the scaled vectors.
Paillier::Ciphertext encryptedScaledOne
[scaled 1], required when computing the inhomogeneous kernel. Precompute it for optimization purposes...
std::vector< ModelVector > twoGammaSMatrix
Matrix which stores the scaled vectors.
BigInteger blindingFactorScaling
The scaling that needs to be applied to the b parameter in order to compensate for the blinding facto...
std::string safetyModelUnsafeClasses
The unsafe classes of the safety block model.
bool reversedSign
During training, libsvm uses an internal flag to denote the sign of the first label it encounters...
BigInteger svWeightScaling
static const EncryptedVector nullVector
Use this to pass a NULL vector to the Predict method;.
Paillier::Ciphertext encryptedB
Stores the scaled and encrypted SVM parameter (-rho in libsvm)
std::vector< BigInteger > ModelVector
Define an std::vector template specialization for rows of model weights.
The public key container structure for the Paillier cryptosystem.