codelab

package
v3.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: Apache-2.0, BSD-3-Clause Imports: 11 Imported by: 0

README

Codelab

Please check out Privacy on Beam codelab for instructions.

See main/main.go for instructions on how to run the codelab binary in Windows or in Linux with Bazel or with the "go" command.

Documentation

Overview

Package codelab contains example pipelines for computing various aggregations using Privacy on Beam.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeCountMeanSum

func ComputeCountMeanSum(s beam.Scope, col beam.PCollection) (visitsPerHour, meanTimeSpent, revenues beam.PCollection)

ComputeCountMeanSum computes the three aggregations (count, mean and sum) we compute separately in the other files in a differentially private way. This pipeline uses a single PrivacySpec for all the aggregations, meaning that they share the same privacy budget.

func CountVisitsPerHour

func CountVisitsPerHour(s beam.Scope, col beam.PCollection) beam.PCollection

CountVisitsPerHour counts and returns the number of visits to a restaurant for each hour. This produces a non-anonymized, non-private count. Use PrivateCountVisitsPerHour for computing this in an anonymized way.

func CreateVisitsFn

func CreateVisitsFn(line string, emit func(Visit)) error

CreateVisitsFn creates and emits a Visit struct from a line that holds visit information.

func MeanTimeSpent

func MeanTimeSpent(s beam.Scope, col beam.PCollection) beam.PCollection

MeanTimeSpent calculates and returns the average time spent by visitors who entered the restaurant for each hour. This produces a non-anonymized, non-private count. Use PrivateMeanTimeSpent for computing this in an anonymized way.

func PrivateCountVisitsPerHour

func PrivateCountVisitsPerHour(s beam.Scope, col beam.PCollection) beam.PCollection

PrivateCountVisitsPerHour counts and returns the number of visits to a restaurant for each hour in a differentially private way.

func PrivateCountVisitsPerHourWithPublicPartitions

func PrivateCountVisitsPerHourWithPublicPartitions(s beam.Scope, col beam.PCollection) beam.PCollection

PrivateCountVisitsPerHourWithPublicPartitions counts and returns the number of visits to a restaurant for each hour in a differentially private way. It uses the "public partitions" feature to disable partition selection/thresholding.

func PrivateMeanTimeSpent

func PrivateMeanTimeSpent(s beam.Scope, col beam.PCollection) beam.PCollection

PrivateMeanTimeSpent calculates and returns the average time spent by visitors who entered the restaurant for each hour in a differentially private way.

func PrivateRevenuePerHour

func PrivateRevenuePerHour(s beam.Scope, col beam.PCollection) beam.PCollection

PrivateRevenuePerHour calculates and returns the total money spent by visitors who entered the restaurant for each hour in a differentially private way.

func RevenuePerHour

func RevenuePerHour(s beam.Scope, col beam.PCollection) beam.PCollection

RevenuePerHour calculates and returns the total money spent by visitors who entered the restaurant for each hour. This DOES NOT produce an anonymized output. Use PrivateRevenuePerHour for computing this in an anonymized way.

Types

type Visit

type Visit struct {
	VisitorID    string
	TimeEntered  time.Time
	MinutesSpent int
	MoneySpent   int
}

Visit represents a visit from a user to the restaurant.

Directories

Path Synopsis
package main runs the Privacy on Beam codelab.
package main runs the Privacy on Beam codelab.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL