ldp-interval
v1.0.2
Published
This library was developed within an Undergraduate Research project to explore Local Differential Privacy (LDP) for protecting sensitive data on the user side. The research and initial development were funded by the Federal University of Goiás (UFG)
Downloads
288
Maintainers
Keywords
Readme
LDP Interval
LDP Interval is a JS library for protect individual data focusing on AI usage.
The uses local differential privacy pattern for add a noise to the data resultin in a extra layer of protection to the data that are sent to proprietary models of artificila inteligence.
How it Works?
The library applies a Local Differential Privacy (LDP) inspired mechanism to protect sensitive numeric values before they are shared.
Instead of shending the original value, the algorithm:
- Determines the possible range of the data;
- Uses a privay paramter epsilon to calibrate the amount of noise;
- Generates random noise using a Laplace distribution;
- Adds the noise to the original value;
- Returns an interval derived from the noisy value.
Only the interval is shared with external systems, wich makes it difficult o infer the real value.
Installation
Install using npm:
npm i ldp-intervalor using yarn:
yarn add ldp-intervalBasic Usage
import {generatePrivateInterval} from 'ldp-interval';
const result = generatePrivateInterval(value, epsilon, minValue, maxValue)
// epsilon is related with the level of privacy you want, lowers epsilons corresponds to highers levels of privacy, higher epsilons corrensponds to lowers levels of privacy. Think carefully what`s your ideal epsilon.
// minValue corresponds to the minimum value of the data category, take that from your database.
// maxValue corresponds to the maximum value of the data category, also take that from your database.output:
{
interval: [lower, upper]
}The interval will change every single execution because the noise is randomly generated.
Using Options Parameter
import {generatePrivateInterval} from 'ldp-interval';
const result = generatePrivateInterval(value, epsilon, minValue, maxValue, options = {k = 1})
// the k value is the interval width multiplier, it say how many times the noise wil be multiplied, rainsing au or down the interval width. The default value is 1.Epsilon Parameter
The privacy parameter controls the privacy vs accuracy trade-off.
| Epsilon value | Effect | |------|------| | small epsilon | stronger privacy | | medium epsilon | balanced privacy | | large epsilon | more accuracy |
Use cases
LDP Interval can be usefull for:
- protecting user attributes before sending data to AI models;
- anonymizing telemetry data
- privacy-preserving analytics
- knowledge graph anonymization
- secure data sharing
Limitations
- This library operates at the individual data level.
- It does not provide dataset-level Differential Privacy guarantees and should be used as a local perturbation mechanism before data sharing.
- Interval overlap
- If the same data is provided a lot of times with different intervals, the real data could be estimated due to overleaps, so use wisely and try to record the same interval to a couple uses
License
MIT
Acknowledge
This library is part of a university research funded by the Federal University of Goiás (UFG) specifically the Vice-Rectorate for Research and Innovation (PRPI)
