semvec/pypi-packages huggingface dataset:
GeoPrivacy 0.0.4
A python package for implementing geo-indistinguishability privacy mechanisms
License: MIT

# GeoPrivacy

This is a python package for implementing geo-indistinguishability privacy mechanism. The methods can be applied to various location privacy tasks. So far, we implemented two privacy mechanisms for the sporadic case as described in the paper **[Geo-indistinguishability: A Principled Approach to Location Privacy](https://hal.inria.fr/hal-01114241/document)**.
In the exemple notebook, we demonstrated the mechanisms using NYC taxi trip data for sporadic case.

## Installation
Please run the following command in terminal to install the package and other dependencies.
```
$ pip install GeoPrivacy==0.0.4
```

pip install GeoPrivacy==0.0.4

## Example Usage
To generate a random laplace noise and add it to a location:
```python
from GeoPrivacy.mechanism import random_laplace_noise
eps = 0.1
location = (3, 5)
noise = random_laplace_noise(eps)
new_location = location + noise
```
Given a list of representative locations and their corresponding weights, you can use the geo-indistinguishable mechanism of optimal utility as following:
```python
from GeoPrivacy import mechanism, metrics
x_list = [(1, 2), (3, 2), (4, 1)]
pi_list = [3, 2, 5]
dQ = metrics.euclidean
epsilon = 0.5

p_matrix, pre_prob, post_prob = optql(x_list, pi_list, dQ, epsilon=0.5)
```
For more examples, please see **[example.ipynb](https://github.com/quao627/GeoPrivacy/blob/main/example.ipynb)**. Other information can be found in the docstring.

## Theory
The planar laplace mechanism can be used to add laplace noise to any given 2d-coordinates. It's worth noting that polar coordinates are used to generate random laplace noise. In order to randomly draw r, we use the inverse CDF of r which is 
<img src="https://render.githubusercontent.com/render/math?math=C_{\epsilon}(r) = \int_{0}^{r} D_{\epsilon, R} (\rho) d\rho = 1 - (1 + \epsilon r)e^{-\epsilon r}">
as calculated in https://hal.inria.fr/hal-01114241/file/paper.pdf.

The optimal utility mechanism divides the region of interest into subregions and builds a linear program using representative points chosen from each subregion. Then, by solving the linear program, a stochastic transition matrix is obtained which can be used to transform any other data from the same region. The linear program takes the following form:
![img](./Data/opt.png)
plsexplain 0.2.0
Create an explainable AI dashboard for your machine learning model.
License: MIT
Requires Python: >=3.8,<4.0

![plsexplain logo](assets/logo_transparent_background.png)

---

Create an explainable AI dashboard for your machine learning model. plsexplain,
or please, explain is a question that you may want to ask your computer after
you've trained a machine learning model.

---

[![package](https://badge.fury.io/py/plsexplain.svg)](https://pypi.org/project/plsexplain/)
[![downloads](https://img.shields.io/pypi/dm/plsexplain.svg)](https://pypi.org/project/plsexplain/)
[![continuous-integration](https://github.com/wmeints/plsexplain/actions/workflows/ci.yml/badge.svg)](https://github.com/wmeints/plsexplain/actions/workflows/ci.yml)

## Getting started

You can install this tool as a python package on your machine by using the
following command in your favorite shell:

```shell
pip install plsexplain
```

After you've installed the package, use the following command to get an
explainable AI dashboard for your trained model:

```shell
plsexplain <path-to-model> <path-to-sample-set>
```

Currently, we support models trained with scikit-learn, but we're planning on
supporting tensorflow and pytorch as well.

The sample set, is a small dataset containing samples you want to use in the
dashboard for explanations based on sample data. We only support using
CSV files at the moment.

## Documentation

Please refer to the documentation for more information on how to use the tool
for various types of models and sample datasets.

[📖 Read the documentation][DOCUMENTATION]

## Contributing

We welcome contributions to this project. Please refer to the
developer guide for more information on how to submit
issues and pull requests for this project.

[🛠 Read the developer guide][CONTRIBUTOR_GUIDE]

## Code of conduct

Please make sure to follow our [code of conduct][CODE_OF_CONDUCT] when
interacting with other contributors on this project.

[CODE_OF_CONDUCT]: CODE_OF_CONDUCT.md
[CONTRIBUTOR_GUIDE]: https://wmeints.github.io/plsexplain/contributing/index.html
[DOCUMENTATION]: https://wmeints.github.io/plsexplain