# Privacy-Preserving Data Analytics in Internet of Medical Things
## 4 Differential Privacy
### Selection of Privacy Parameter \(\epsilon\)  
Setting the value for epsilon is a challenging task in effectively implementing differential privacy in any application [44]. The desirable balance between privacy and utility can be controlled by adjusting the value of epsilon (\(\epsilon\)). Typical values ranging from 0.01 to 1 are used for strong privacy, but higher values might be used depending on the application or context.  
Loss Function (\(L\)):  
Consider a loss function (\(L(\phi,D)\)) for a model with parameters \(\phi\) on dataset \(O\). For example, the mean square error (MSE) is commonly used as the loss function in linear regression:  
\[L(\phi,O)=\frac{1}{n}\sum_{i=1}^{n}(z_{i}-\hat{z}_{i})^{2} \tag{11}\]  
where \(z_{i}\) represents the actual values and \(\hat{z}_{i}\) represents the predicted values.  
Privacy Loss (PL):  
The privacy loss PL(\(\epsilon\)) quantifies the risk of information leakage as \(\epsilon\) changes. Generally, a lower \(\epsilon\) value implies higher privacy.  
\[\text{PL}(\epsilon)=\frac{K}{\epsilon} \tag{12}\]  
where \(K\) is a constant representing the baseline privacy risk when \(\epsilon=1\).  
Utility Measure (\(U\)):  
The utility measure (\(U(\varphi,O)\)) evaluates the model's performance or effectiveness on dataset \(O\), typically measured by metrics such as accuracy or predictive performance.  
\[U(\varphi,O)=\frac{1}{L(\varphi,O)} \tag{13}\]  
To achieve an optimal balance, we need to minimize the combined cost function (\(F(\epsilon)\)), which considers both the privacy loss and the loss function (inversely related to utility).  
\[F(\epsilon)=\alpha\cdot\mathrm{PL}(\epsilon)+\beta\cdot L(\varphi,O) \tag{14}\]  
where \(\alpha\) and \(\beta\) are weighting factors that balance the importance of privacy and utility, respectively.  
Combined Cost Function:  
Substituting \(\mathrm{PL}(\epsilon)\) and \(L(\varphi_{\epsilon},O)\) into the cost function yields  
\[F(\epsilon)=\alpha\cdot\frac{K}{\epsilon}+\beta\cdot L(\varphi_{\epsilon},O) \tag{15}\]  
Selecting Optimal \(\epsilon\):  
To find the optimal \(\epsilon\), we calculate the derivative of \(F(\epsilon)\):  
\[\frac{dF(\epsilon)}{d\epsilon}=-\alpha\cdot\frac{K}{\epsilon^{2}}+\beta\cdot \frac{\partial L(\varphi_{\epsilon},O)}{\partial\epsilon}=0\]  
Solving for \(\epsilon\) yields:  
\[-\alpha\cdot\frac{K}{\epsilon^{2}}+\beta\cdot\frac{\partial L(\varphi_{ \epsilon},O)}{\partial\epsilon}=0\]  
\[\alpha\cdot\frac{K}{\epsilon^{2}}=\beta\cdot\frac{\partial L(\varphi_{ \epsilon},O)}{\partial\epsilon}\]  
\[\epsilon^{2}=\frac{\alpha\cdot K}{\beta\cdot\frac{\partial L(\varphi_{ \epsilon},O)}{\partial\epsilon}}\]  
\[\epsilon=\sqrt{\frac{\alpha\cdot K}{\beta\cdot\frac{\partial L(\varphi_{ \epsilon},O)}{\partial\epsilon}}} \tag{16}\]  
This provides a formula for selecting \(\epsilon\) depending on constant \(K\), weighting factors \(\alpha\) and \(\beta\), and the sensitivity of the loss function to \(\epsilon\).  
By using this formula, one can select \(\epsilon\) in such a way that balances both privacy (represented by \(\alpha\) and \(K\)) and accuracy (represented by \(\beta\) and the sensitivity of the loss function). A lower value of \(\epsilon\) provides stronger privacy guarantees. Selecting a lower value of \(\epsilon\) requires increasing the value of \(\alpha\), which increases the emphasis on minimizing privacy loss, and decreasing the value of \(\beta\), which reduces the emphasis on preserving utility or accuracy. By appropriately choosing \(\alpha\) and \(\beta\), one can control the emphasis on privacy versus utility, ensuring an optimal balance tailored to specific application requirements.