privkit.ppms package#
- class privkit.ppms.AdaptiveGeoInd(epsilon: float, ws: int, delta1: float | None = None, delta2: float | None = None, alpha: float = 0.1, beta: float = 5)#
Bases:
PPM
Adaptive Geo-indistinguishability class to apply the mechanism
References
Al-Dhubhani, R., & Cazalas, J. M. (2018). An adaptive geo-indistinguishability mechanism for continuous LBS queries. Wireless Networks, 24(8), 3221-3239.
- DATA_TYPE_ID = ['location_data']#
- METRIC_ID = ['quality_loss']#
- PPM_ID = 'adaptive_geo_ind'#
- PPM_INFO = 'The adaptive geo-indistinguishability uses the Planar Laplace mechanism as baseline, but dynamically adapts the privacy parameter epsilon according to the correlation between the current and the past locations. This correlation is measured by using a simple linear regression. The parameters of this mechanism are the privacy parameter epsilon, two estimation error thresholds Δ1 and Δ2, and two privacy parameter multiplication factors α and β. The thresholds define if the mechanism increases either privacy or utility by adjusting the privacy parameter with the multiplication factors. This mechanism is suitable for continuous scenarios.'#
- PPM_NAME = 'Adaptive Geo-indistinguishability'#
- PPM_REF = 'Al-Dhubhani, R., & Cazalas, J. M. (2018). An adaptive geo-indistinguishability mechanism for continuous LBS queries. Wireless Networks, 24(8), 3221-3239. '#
- estimation_error(prev_dates: List, prev_latitudes: List, prev_longitudes: List, curr_date: numpy.datetime64, curr_latitude: float, curr_longitude: float)#
Computes the estimation error between the current point and the previous location points
- Parameters:
prev_dates (List) – previous dates
prev_latitudes (List) – previous latitudes
prev_longitudes (List) – previous longitudes
curr_date (np.datetime64) – current date
curr_latitude (float) – current latitude
curr_longitude (float) – current longitude
- Returns:
estimation error
- execute(location_data: LocationData)#
Executes the Adaptive Geo-Ind mechanism to the data given as parameter
- Parameters:
location_data (privkit.LocationData) – location data where the planar laplace should be executed
- Returns:
location data with obfuscated latitude and longitude and the quality loss metric
- get_obfuscated_point(i: int, trajectory: pandas.DataFrame) [<class 'float'>, <class 'float'>] #
Returns a geo-indistinguishable single point
- Parameters:
i (int) – timestamp
trajectory (pd.DataFrame) – trajectory to be obfuscated
- Returns:
obfuscated latitude, longitude, and quality loss
- linear_regression(x_train: List, y_train: List, x_test: numpy.datetime64 | None = None)#
Computes the linear regression
- Parameters:
x_train (List) – data to train
y_train (List) – data to train
x_test (np.datetime64) – data to test
- Returns:
model prediction value
- static transpose(to_transpose)#
- class privkit.ppms.CentroidVoxel(voxel_size: float)#
Bases:
PPM
CentroidVoxel class to apply the mechanism
References
Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master’s Thesis. Universidade do Porto.
- DATA_TYPE_ID = ['facial_data']#
- PPM_ID = 'centroid_voxel'#
- PPM_INFO = 'The CentroidVoxel operation voxelizes facial points into regularly spaced cubic elements, known as voxels. Each voxel is represented by a single point with centroid coordinates, and its color is determined by averaging the colors of all-encompassed points. The voxel size governs information compression on each voxel point, influencing data loss.'#
- PPM_NAME = 'CentroidVoxel'#
- PPM_REF = "Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master's Thesis. Universidade do Porto."#
- execute(facial_data: FacialData)#
Executes the CentroidVoxel mechanism to the data given as a parameter
- Parameters:
facial_data (privkit.FacialData) – facial data where the CentroidVoxel should be executed
- Returns:
obfuscated facial data
- class privkit.ppms.ClusteringGeoInd(r: float, epsilon: float)#
Bases:
PPM
Clustering Geo-indistinguishability class to apply the mechanism
References
Cunha, M., Mendes, R., & Vilela, J. P. (2019, October). Clustering Geo-Indistinguishability for Privacy of Continuous Location Traces. In 2019 4th International Conference on Computing, Communications and Security (ICCCS) (pp. 1-8). IEEE.
- DATA_TYPE_ID = ['location_data']#
- METRIC_ID = ['quality_loss']#
- PPM_ID = 'clustering_geo_ind'#
- PPM_INFO = 'Clustering geo-indistinguishability consists of creating obfuscation clusters to aggregate nearby locations into a single obfuscated location. This obfuscated location is produced by Planar Laplace. The parameters of this mechanism are the privacy parameter epsilon defined as ε=l/r and the obfuscation radius r used to define epsilon. This mechanism is suitable for sporadic and continuous scenarios.'#
- PPM_NAME = 'Clustering Geo-indistinguishability'#
- PPM_REF = 'Cunha, M., Mendes, R., & Vilela, J. P. (2019, October). Clustering Geo-Indistinguishability for Privacy of Continuous Location Traces. In 2019 4th International Conference on Computing, Communications and Security (ICCCS) (pp. 1-8). IEEE. '#
- execute(location_data: LocationData)#
Executes the Clustering Geo-Ind mechanism to the data given as parameter
- Parameters:
location_data (privkit.LocationData) – location data where the planar laplace should be executed
- Returns:
location data with obfuscated latitude and longitude and the quality loss metric
- get_obfuscated_point(latitude: float, longitude: float, i: int = 0) [<class 'float'>, <class 'float'>] #
Returns a geo-indistinguishable single point
- Parameters:
latitude (float) – original latitude
longitude (float) – original longitude
i (int) – timestamp
- Returns:
obfuscated point (latitude, longitude) and distance between original and obfuscation point
- class privkit.ppms.Merge2Faces(pcd_new: open3d.cpu.pybind.geometry.PointCloud | str | numpy.ndarray, weight: float, voxel_size: float)#
Bases:
PPM
Merge2Faces class to apply the mechanism
References
Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master’s Thesis. Universidade do Porto.
- DATA_TYPE_ID = ['facial_data']#
- PPM_ID = 'merge_two_faces'#
- PPM_INFO = "The Merge2Faces method combines attributes from two facial point clouds through a two-stage process. Initially, the original and new faces undergo registration, starting with a global registration using the Random Sample Consensus (RANSAC) algorithm, followed by refinement using a local registration method called Point-to-Plane ICP. The second stage involves weighted averaging of coordinates and colors for each point on the original face with their corresponding closest point on the new face. Dissimilarity to the original point cloud is regulated by both the new face and the assigned weight. The registration process code is based on the open3d's documentation for global_registration [https://www.open3d.org/docs/release/tutorial/pipelines/global_registration.html]."#
- PPM_NAME = 'Merge2Faces'#
- PPM_REF = "Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master's Thesis. Universidade do Porto."#
- execute(facial_data: FacialData)#
Executes the Merge2Faces mechanism to the data given as a parameter
- Parameters:
facial_data (privkit.FacialData) – facial data where the Merge2Faces should be executed
- Returns:
obfuscated facial data
- static execute_global_registration(source_down: open3d.cpu.pybind.geometry.PointCloud, target_down: open3d.cpu.pybind.geometry.PointCloud, source_fpfh: open3d.cpu.pybind.pipelines.registration.Feature, target_fpfh: open3d.cpu.pybind.pipelines.registration.Feature, voxel_size: float)#
Return the global registration result using RANSANC
- Parameters:
source_down (PointCloud) – downsampled source point cloud
target_down (PointCloud) – downsampled target point cloud
source_fpfh (open3d.cpu.pybind.pipelines.registration.Feature) – FPFH feature of downsampled source point cloud
target_fpfh (open3d.cpu.pybind.pipelines.registration.Feature) – FPFH feature of downsampled target point cloud
voxel_size (float) – voxel size
- Returns:
RANSANC global registration result
- prepare_dataset(source: open3d.cpu.pybind.geometry.PointCloud, target: open3d.cpu.pybind.geometry.PointCloud, voxel_size: float)#
Return the voxel downsapled point cloud and its FPFH feature of the point clouds source and target
- Parameters:
source (PointCloud) – a point cloud
target (PointCloud) – a point cloud
voxel_size (float) – voxel size
- Returns:
point cloud, voxel downsampled point cloud, FPFH feature of the two point clouds
- static preprocess_point_cloud(pcd: open3d.cpu.pybind.geometry.PointCloud, voxel_size: float)#
Returns a voxel-downsampled point cloud and the FPFH feature for each point.
- Parameters:
pcd (PointCloud) – point cloud to be downsampled
voxel_size (float) – size of each downsampling voxel
- Returns:
point cloud with voxel downsampling and the FPFH feature for each point.
- static refine_registration(source: open3d.cpu.pybind.geometry.PointCloud, target: open3d.cpu.pybind.geometry.PointCloud, voxel_size: float, result_ransac: open3d.cpu.pybind.pipelines.registration.RegistrationResult)#
Return the local registration result using Point-to-Plane ICP
- Parameters:
source (PointCloud) – a point cloud
target (PointCloud) – a point cloud
voxel_size (float) – voxel size
result_ransac (open3d.cpu.pybind.pipelines.registration.RegistrationResult) – global registration result
- Returns:
Point-to-Plane ICP local registration result
- class privkit.ppms.PPM#
Bases:
ABC
PPM is an abstract class for a generic Privacy-Preserving Mechanism (PPM). Defines a series of methods common to all PPMs. Provides a general method to execute the PPM. Requires the definition of a PPM_ID, PPM_NAME, PPM_INFO, PPM_REF, DATA_TYPE_ID (of the data types this mechanism can be applied to), and METRIC_ID (of the metric that can be used to assess this PPM).
- property DATA_TYPE_ID: List[str]#
Identifiers of the data types that the PPM is applied to
- property METRIC_ID: List[str]#
Identifiers of the metrics that can be used to assess the PPM
- property PPM_ID: str#
Identifier of the PPM
- property PPM_INFO: str#
Information about the PPM and how it works
- property PPM_NAME: str#
Name of the PPM
- property PPM_REF: str#
Reference to the work that proposes this PPM
- abstract execute(*args)#
Executes the privacy-preserving mechanism. This is specific to the mechanism
- class privkit.ppms.PlanarLaplace(epsilon: float)#
Bases:
PPM
Planar Laplace class to apply the mechanism
References
Andrés, M. E., Bordenabe, N. E., Chatzikokolakis, K., & Palamidessi, C. (2013, November). Geo-indistinguishability: Differential privacy for location-based systems. In Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security (pp. 901-914).
- DATA_TYPE_ID = ['location_data']#
- METRIC_ID = ['quality_loss']#
- PPM_ID = 'planar_laplace'#
- PPM_INFO = 'The geo-indistinguishable Planar Laplace (PL) consists of adding 2-dimensional Laplacian noise centred at the exact user location. The Laplacian distribution depends on a privacy parameter epsilon defined as ε=l/r, which means that a privacy level l is guaranteed within a radius r. This mechanism is suitable for sporadic scenarios (i.e. single queries).'#
- PPM_NAME = 'Planar Laplace'#
- PPM_REF = 'Andrés, M. E., Bordenabe, N. E., Chatzikokolakis, K., & Palamidessi, C. (2013, November). Geo-indistinguishability: Differential privacy for location-based systems. In Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security (pp. 901-914).'#
- execute(location_data: LocationData)#
Executes the Planar Laplace mechanism to the data given as parameter
- Parameters:
location_data (privkit.LocationData) – location data where the planar laplace should be executed
- Returns:
location data with obfuscated latitude and longitude and the quality loss metric
- expected_error() float #
Computes the expected error calculated by 2/epsilon
- Returns:
expected error
- get_obfuscated_point(latitude: float, longitude: float, grid: GridMap | None = None) [<class 'float'>, <class 'float'>] #
Returns a geo-indistinguishable single point
- Parameters:
latitude (float) – original latitude
longitude (float) – original longitude
grid (GridMap) – grid discretization, so it repeats this step if the obfuscated points falls outside the grid
- Returns:
obfuscated point (latitude, longitude) and distance between original and obfuscation point
- inverse_cumulative_gamma(p: float) float #
Computes the inverse cumulative gamma of Laplacian Distribution function.
- Parameters:
p (float) – random variable in [0,1)
- Returns:
inverse cumulative gamma
- laplace_distribution(point1: [<class 'float'>, <class 'float'>], point2: [<class 'float'>, <class 'float'>]) float #
Computes the laplacian distribution value
- Parameters:
point1 ([float, float]) – cartesian coordinates x and y
point2 ([float, float]) – cartesian coordinates x and y
- Returns:
laplacian distribution value
- class privkit.ppms.PointMeshPoint(alpha: float, n: float)#
Bases:
PPM
Point-mesh-point class to apply the mechanism
References
Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master’s Thesis. Universidade do Porto.
- DATA_TYPE_ID = ['facial_data']#
- PPM_ID = 'point_mesh_point'#
- PPM_INFO = 'The Point-Mesh-Point algorithm involves two main steps: it first transforms the point cloud into an alpha-shape mesh, and subsequently, it reverts this alpha-shape mesh back into a point cloud. The alpha value serves as a parameter controlling the level of detail in facial features, and this is further influenced by the number of points defined in the final cloud.'#
- PPM_NAME = 'Point-Mesh-Point'#
- PPM_REF = "Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master's Thesis. Universidade do Porto."#
- execute(facial_data: FacialData)#
Executes the Point-mesh-point mechanism to the data given as a parameter
- Parameters:
facial_data (privkit.FacialData) – facial data where the Point-mesh-point should be executed
- Returns:
obfuscated facial data
- class privkit.ppms.PrivacyAwareRemapping(epsilon: float, r: float | None = None, p: float = 0.95, search_space: str = 'circle')#
Bases:
PPM
Privacy-Aware Remapping class to apply the mechanism
References
Guilherme Duarte, Mariana Cunha, and João P. Vilela. 2024. A Privacy-Aware Remapping Mechanism for Location Data. In The 39th ACM/SIGAPP Symposium on Applied Computing (Avila, Spain) (SAC ’24). Association for Computing Machinery, New York, NY, USA, 8 pages.
- DATA_TYPE_ID = ['location_data']#
- METRIC_ID = ['quality_loss']#
- PPM_ID = 'privacy_aware_remapping'#
- PPM_INFO = "The Privacy-Aware Remapping Mechanism takes in location data which had the Planar Laplace mechanism applied a priori. For each cell on the grid discretization of the data, it finds the cell which minimizes the weighted quality loss of the distance between the ground-truth locations and the obfuscated report. The cell must be at a distance bounded by a function between the privacy parameter of PL mechanism and the cell's spacing, in order to take into account the noise added by Planar Laplace. The new obfuscated locations are then given by the center of the cell which the original cell got remapped into."#
- PPM_NAME = 'Privacy-Aware Remapping'#
- PPM_REF = 'Guilherme Duarte, Mariana Cunha, and João P. Vilela. 2024. A Privacy-Aware Remapping Mechanism for Location Data. In The 39th ACM/SIGAPP Symposium on Applied Computing (Avila, Spain) (SAC ’24). Association for Computing Machinery, New York, NY, USA, 8 pages.'#
- static apply_remapping_function_to_point(obf_latitude: float, obf_longitude: float, R: dict, grid: ~privkit.utils.discrete_utils.GridMap, grid_size: [<class 'int'>, <class 'int'>])#
Applies the R remapping function to the cell where the given point is contained. :param obf_latitude: obfuscated latitude :param obf_longitude: obfuscated longitude :param R: Remapping function :param grid: grid discretization :param grid_size: size of the grid :returns: updated obfuscated location
- execute(location_data: LocationData, apply_pl: bool = True)#
Applies the Remapping Mechanism to the obfuscated data given as parameter
- Parameters:
location_data (privkit.LocationData) – location data where the Privacy-Aware Remap should be applied
apply_pl (bool) – boolean to specify if Planar Laplace should be applied or if it is applied a priori. By default, it is True.
- Returns:
location data with remapped latitude and longitude through the Remapping function which minimizes the weighted quality loss
- static generate_cells_weights(location_data, grid_size: [<class 'int'>, <class 'int'>])#
Creates a map which associates a cell ID from a grid map to the number of reports which lay on the cell
- Parameters:
location_data (privkit.LocationData) – location data where cells reports will get counted
grid_size – number of rows and columns on the grid
- Returns:
Dictionary which maps cell’s ID into their weights
- get_cell_remap(c: int, w: dict, grid: ~privkit.utils.discrete_utils.GridMap, grid_size: [<class 'int'>, <class 'int'>], r_offsets: [<class 'int'>])#
Calculates the remapped cell which minimizes the weighted quality loss of a given cell
- Parameters:
c (int) – current cell
w (dict) – Map between cell ID’s and respective weights
grid (GridMap) – map discretization
grid_size – grid dimensions
r_offsets – search space centered at the cell c
- get_remapping_function(location_data: LocationData)#
Computes the Remapping function to the data given as parameter
- Parameters:
location_data (privkit.LocationData) – location data where the Privacy-Aware Remapping should be executed
- Returns:
Remapping function R which maps individual cells within a grid to themselves
- class privkit.ppms.SmoothKNN(k: int)#
Bases:
PPM
Smooth k-nearest neighbors class to apply the mechanism
References
Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master’s Thesis. Universidade do Porto.
- DATA_TYPE_ID = ['facial_data']#
- PPM_ID = 'smooth_knn'#
- PPM_INFO = 'The SmoothKNN operation involves replacing each point in the facial point cloud with the mean coordinates and color attributes of its k-nearest neighbors. The degree of smoothing is controlled by the number of neighboring points considered.'#
- PPM_NAME = 'SmoothKNN'#
- PPM_REF = "Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master's Thesis. Universidade do Porto."#
- execute(facial_data: FacialData)#
Executes the SmoothKNN mechanism to the data given as a parameter
- Parameters:
facial_data (privkit.FacialData) – facial data where the SmoothKNN should be executed
- Returns:
obfuscated facial data
- class privkit.ppms.Tapering(k_min: float, k_max: float, f_tapering: Callable[[float], float] | None = None)#
Bases:
PPM
Tapering class to apply the mechanism
References
Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master’s Thesis. Universidade do Porto.
- DATA_TYPE_ID = ['facial_data']#
- PPM_ID = 'tapering'#
- PPM_INFO = 'Tapering applies a non-linear tapering deformation to facial points using a transformation matrix guided by a tapering function. The shape and intensity of the deformation are regulated by both the tapering function and its restricted domain. The outcome is linked to the coordinate values of the points designated for anonymization.'#
- PPM_NAME = 'Tapering'#
- PPM_REF = "Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master's Thesis. Universidade do Porto."#
- execute(facial_data: FacialData)#
Executes the Tapering mechanism to the data given as a parameter
- Parameters:
facial_data (privkit.FacialData) – facial data where the Tapering should be executed
- Returns:
obfuscated facial data
- static tapering_function(x)#
- class privkit.ppms.UniformNoise(a_x: float, b_x: float, a_y: float, b_y: float, a_z: float, b_z: float)#
Bases:
PPM
UniformNoise class to apply the mechanism
References
Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master’s Thesis. Universidade do Porto.
- DATA_TYPE_ID = ['facial_data']#
- PPM_ID = 'uniform_noise'#
- PPM_INFO = "UniformNoise applies random values from a uniform distribution to the 3D coordinates (x, y, z) of facial points. Each dimension of a point is independently altered by sampling noise from three uniform distributions. To realign the face with its original position, the coordinates of each point are adjusted by subtracting the mean of the corresponding uniform distribution. The intensity of the noise is regulated by the parameters 'a' and 'b', representing the lower and upper bounds of the uniform distribution for each dimension of a point."#
- PPM_NAME = 'UniformNoise'#
- PPM_REF = "Ricardo Andrade. 2023 Privacy-Preserving Face Detection: A Comprehensive Analysis of Face Anonymization Techniques. Master's Thesis. Universidade do Porto."#
- execute(facial_data: FacialData)#
Executes the UniformNoise mechanism to the data given as a parameter
- Parameters:
facial_data (privkit.FacialData) – facial data where the UniformNoise should be executed
- Returns:
obfuscated facial data
- class privkit.ppms.UniformRemapping(grid: GridMap | None = None)#
Bases:
PPM
UniformRemapping class to perform remapping as a privacy-preserving mechanism based on reference [1].
References
[1] Andrés, M. E., Bordenabe, N. E., Chatzikokolakis, K., & Palamidessi, C. (2013, November). Geo-indistinguishability: Differential privacy for location-based systems. In Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security (pp. 901-914).
- DATA_TYPE_ID = ['location_data']#
- METRIC_ID = ['quality_loss', 'adv_error']#
- PPM_ID = 'uniform_remapping'#
- PPM_INFO = 'Uniform remapping consists of discretizing location data by remapping each location to the closest point in the discrete domain. This mechanism can be applied independently or combined with other privacy-preserving mechanism.'#
- PPM_NAME = 'Uniform Remapping'#
- PPM_REF = 'Andrés, M. E., Bordenabe, N. E., Chatzikokolakis, K., & Palamidessi, C. (2013, November). Geo-indistinguishability: Differential privacy for location-based systems. In Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security (pp. 901-914).'#
- execute(location_data: LocationData, data_processing: bool = False, combined_ppm: bool = False)#
Executes the Uniform Remapping mechanism to the data given as parameter
- Parameters:
location_data (privkit.LocationData) – location data where the uniform remapping will be executed
data_processing (bool) – boolean to specify if it should be applied as a data processing mechanism. By default, it is False
combined_ppm (bool) – boolean to specify if uniform rempaping is applied as a combined PPM. By default, it is False
- Returns:
location data with obfuscated latitude and longitude
- class privkit.ppms.VAGI(epsilon: float, m: float)#
Bases:
PPM
VA-GI class to apply the mechanism
References
Mendes, R., Cunha, M., & Vilela, J. P. (2023, April). Velocity-Aware Geo-Indistinguishability. In Proceedings of the Thirteenth ACM Conference on Data and Application Security and Privacy (pp. 141-152).
- DATA_TYPE_ID = ['location_data']#
- METRIC_ID = ['quality_loss']#
- PPM_ID = 'va_gi'#
- PPM_INFO = 'The velocity-aware geo-indistinguishability uses the Planar Laplace mechanism as baseline, but dynamically adapts the privacy parameter epsilon according to the user velocities as well as the reporting speed, obtained by performing the Kernel Density Function on the user and report velocities. '#
- PPM_NAME = 'VA-GI'#
- PPM_REF = 'Mendes, R., Cunha, M., & Vilela, J. P. (2023, April). Velocity-Aware Geo-Indistinguishability. In Proceedings of the Thirteenth ACM Conference on Data and Application Security and Privacy (pp. 141-152). '#
- static cdf(kde: scipy.stats.gaussian_kde, velocity: float)#
Given a distribution and a value, computes the Cumulative Distribution Function (cdf) of that value in the distribution.
- Parameters:
kde (st.gaussian_kde) – user or report velocity pd
velocity (float) – user or report velocity
- Returns:
cdf evaluated at the value of the velocity at the distribution kde
- execute(location_data: LocationData, train_data: pandas.DataFrame | None = None)#
Executes the VA-GI mechanism to the data given as parameter.
- Parameters:
location_data (privkit.LocationData) – location data where the planar laplace should be executed
train_data (DataFrame) – data which will be used to compute the velocities’ distribution - if not provided VA-GI performs data division
- Returns:
location data with obfuscated latitude and longitude and the quality loss metric and epsilon array
- fr(vr: float, report_vel_pd: scipy.stats.gaussian_kde)#
Computes the inverse of the Cumulative Distribution Function of the report velocity distribution evaluated with the value of the report velocity.
- Parameters:
vr (float) – report velocity
report_vel_pd (st.gaussian_kde) – report velocity pd
- Returns:
- fu(vu: float, user_vel_pd: scipy.stats.gaussian_kde)#
Computes Cumulative Distribution Function of the user velocity distribution evaluated with the value of the user velocity.
- Parameters:
vu (float) – user velocity
user_vel_pd (st.gaussian_kde) – user velocity pd
- Returns:
- get_epsilon(x_i: [<class 'float'>, <class 'float'>, <class 'int'>], prev_x_i: [<class 'float'>, <class 'float'>, <class 'int'>], train_user_vel_pd: scipy.stats.gaussian_kde, train_report_vel_pd: scipy.stats.gaussian_kde)#
Computes the new epsilon at a certain timestamp.
- Parameters:
x_i ([float, float, int]) – current location
prev_x_i ([float, float, int]) – previous location
train_user_vel_pd (spicy.stats.gaussian_kde) – user velocity pd
train_report_vel_pd (spicy.stats.gaussian_kde) – report velocity pd