{'fraction_non_alphanumeric': 0.03886030558154038, 'fraction_numerical': 0.010173058933582788, 'mean_word_length': 4.127298161470823, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Differentially Private Release of Public Transport Data: The Opal Use Case

This document describes the application of a differentially private algorithm to release public transport usage data from Transport for New South Wales (TfNSW), Australia. The data consists of two separate weeks of"tap-on/tap-off"data of individuals who used any of the four different modes of public transport from TfNSW: buses, light rail, train and ferries. These taps are recorded through the smart ticketing system, known as Opal, available in the state of New South Wales, Australia.


Introduction
The Opal smart ticketing system 1 has been introduced by the (state) Government of New South Wales (NSW) in Australia as a means to use NSW's public transport services. The Opal card can be used on different transport modes managed by the Transport for New South Wales (TfNSW), including trains, buses, light rail and ferries. A tap on using one of the Opal card readers at a location (train stations, buses, ferry wharfs and light rail stops) marks the beginning of a trip and a subsequent tap-off records the end of the trip. The data collected from the Opal card contains a rich set of information that could be used to gain valuable insights about transport usage across NSW. The data if released could bring potential benefits to commuters, businesses and others. However, if released in its raw form the data can have many privacy violations such as the ability to track someone's trip or series of trips. For this reason, TfNSW and Data61/CSIRO engaged in a project to release a privacy-preserving version of a sample of the Opal data as open data downloadable by anyone. We refer to this sample as the Opal dataset in the rest of this document.
The Opal dataset consists of rows each of which indicates a trip from a single individual. A row, among other attributes, contains a unique identifier for the Opal card, the trip date, transport mode (bus, train, etc.), tap-on time, tap-off time, tap-on location and tap-off location. The tap-on and off times have the granularity of one minute. The tap-on and off locations are the precise locations of train stations, bus stops, ferry wharfs and light rail stops. The Opal dataset consists of trips from two separate one week periods; a total of 14 days of data. To release Opal data in a privacy-preserving manner, we used the notion of differential privacy [1]. Differential privacy gives a rigorous definition of privacy that is tied to the process purported to provide privacy. Informally, the definition states that a process (an algorithm) is differentially private if the output is indistinguishable if any single individual's data is removed from the dataset. The notion of indistinguishability is probabilistic in nature and is quantified with the help of a parameter denoted ǫ, often called the privacy budget. We prefer the use of differential privacy over ad hoc ways of de-identifying datasets, since the latter is a practice that can only check the (in)effectiveness of known attacks, and could be susceptible to new attacks or future sources of background knowledge available to the attacker 2 about individuals in the dataset. In contrast, differential privacy is immune to new attacks 3 or any future sources of knowledge. The released Opal dataset is available for download at [4].
In what follows we first give a brief background on differential privacy in Section 2, slightly tailored to the specific case of the Opal dataset. In Section 3, we describe the differentially private algorithm used to release the Opal dataset, its privacy and utility guarantees and why it was chosen as the algorithm suitable for the Opal dataset. In Section 4, we describe how the dataset was processed and released, the differentially private nature of the whole process, and the privacy parameters used to release the dataset. We conclude in Section 5.

Background
We assume a domain, i.e., data universe, X . An instance x ∈ X shall be called a point. A dataset D is an n-tuple, each row of which is a point x ∈ X . 4 We denote this as D ∈ X n . In this document, we assume each row of D to represent a trip from an individual. The attributes of the domain X include, among other attributes, tap-on times and locations, tap-off times and locations, date of the trip and transport mode. Notice that there is no distinction between sensitive or non-sensitive attributes. Thus, the domain may include potentially identifying attributes such as the unique ID of an individual making the trip. We denote a row of D by small case letters, e.g., x and y. For a row x the value of the ith attribute is denoted x i . We say two n-row datasets D and D ′ are neighbours, denoted D ∼ D ′ if they differ in only one row. That is, both datasets contain n rows, n − 1 of which are the same in the two datasets.
The parameter δ is required to be a negligible function of n [5, §2.3, p. 18], [6, §1.6, p. 9]. 5 The parameter ǫ on the other hand should be small but not arbitrarily small. We may think of ǫ ≤ 0.01, ǫ ≤ 0.1 or ǫ ≤ 1 [7, §1], [5, §3.5.2, p. 52]. When δ = 0, the resulting notion is sometimes referred to as pure differential privacy in contrast to a non-zero δ, which is called approximate differential privacy. In this document, we shall use differential privacy as an umbrella term for both pure and approximate differential privacy. Where a distinction is required, we shall specifically indicate as such.
Remark 1 (Trip privacy). Since each row of the dataset D represents a trip, our notion of privacy is related to trip privacy. That is, in the above definition of differential privacy two neighbouring datasets differ in one trip. An individual may have multiple trips in the dataset. Thus, in this sense we ensure that the addition or removal of a single trip of an individual does not change the output of the differentially private algorithm beyond what is allowed by the privacy parameter ǫ. This is akin to providing edge privacy as opposed to node privacy in the context of graph data [8, §1]; the latter being a stronger notion of privacy. Later on we discuss why we chose trip privacy as our preferred notion. In more detail, we in fact first partition the Opal dataset according to date and transport modes, so that for each transport mode and date pair, we obtain a separate partition (See Section 4). This then amounts to providing privacy of a trip of an individual on a particular date and transport mode.
Definition 2. Two random variables Y and Y ′ taking on values in R are called (ǫ, δ)-indistinguishable if for every S ⊆ R, the following holds With the above definition, we can interpret (ǫ, δ)-differential privacy as ǫ-differential privacy with probability at least 1 − δ in light of the following theorem [9], [6].
An important property of differential privacy is that it composes [5].
The above is sometimes referred to as (basic) sequential composition as opposed to parallel composition defined next.
Theorem 3 (Parallel composition [10]). Let M i each provide (ǫ, δ)-differential privacy. Let X i be arbitrary disjoint subsets of the domain X . The sequence of M i (D ∩ X i ) provides (ǫ, δ)-differential privacy, where D ∈ X n .
Note that partitioning the domain X into disjoint sets means partitioning a dataset D into disjoint sets of rows and not disjoint sets of columns. Indeed partitioning into disjoint sets of rows means that addition and removal of a row changes only one of the disjoint sets.
A query is defined as a function q : X n → R.

Definition 3 (Counting queries and point functions).
A counting query is specified by a predicate q : X → {0, 1} and extended to datasets D ∈ X n by summing up the predicate on all n rows of the dataset as A point function [6] is the sum of the predicate q y : X → {0, 1}, which evaluates to 1 if the row is equal to the point y ∈ X and 0 otherwise, over the dataset D. Note that computing all point functions, i.e., answering the query q y (D) for all y ∈ X , amounts to computing the histogram of the dataset D.
Definition 4 (Global sensitivity [5,6]). The global sensitivity of a counting query q : X n → N is where · 1 is the l 1 -norm. 6 It is easy to see that the global sensitivity of a counting query q : X n → N is 1.
Definition 5 (Local sensitivity [5,6]). The local sensitivity of a counting query q : The difference between local and global sensitivity is that whereas the latter is defined over all possible neighbouring datasets D, D ′ , the former is only evaluated at neighbours of a fixed dataset D, i.e., the input dataset. A key property of differential privacy is that it is immune to post-processing. That means that a released dataset from a differentially private algorithm cannot be further processed to reduce privacy (without access to the original dataset).
The Laplace mechanism is employed as a building block in the main algorithm we use to generate the (privacy-preserving) Opal Dataset.
Definition 6 (Laplace mechanism [1]). The Laplace distribution with mean 0 and scale b has the probability density function We shall remove the argument x, and simply denote the above by Lap(b). Let q : X n → R be a query.
The mechanism where β ∈ (0, 1]. If q is a counting query, then ∆q = 1, and the error α is From the CDF of the Laplace distribution, we see that for any t ≥ 0, The following definition relates to the output distribution of point functions on a dataset D.
A dataset is said to be dense, if the values of k and γ are large, and sparse otherwise.
Note that we have deliberately not made the second part of the definition precise. This is because we shall only use the above definition to informally interpret the output of the algorithm (described next), for which the relative difference between dense and sparse datasets suffices.

The Stability-based Histogram Algorithm
In this section we describe the algorithm we used to generate differentially private Opal data. The algorithm, which appears in [6, §7.1], [11], slightly modifies the online version of the algorithm proposed in [12], and generates a differentially private synthetic dataset (approximately) answering all point functions q y , where y ∈ X . That is, the algorithm can be used to approximate the histogram of a dataset D. We represent the algorithm in Algorithm 1, and then discuss the intuition behind the algorithm followed by its privacy and utility guarantees. We call this algorithm the stability-based histogram algorithm, following [6, §3.3]. Shortening further, we shall refer to this algorithm as the SBH algorithm from now onwards.
Set a x ← round(a x ). 10 if a x > 0 then append a x copies of x to D out .
11 Output D out .

Some Remarks about the SBH Algorithm
The algorithm leverages on the answers to the point functions being stable in the neighbourhood of the dataset D. That is if the local sensitivity of the query does not change after removing a few rows from D, we can consider the answers to those queries as being stable. The "few" in the previous sentence is characterized precisely via the threshold set in step 6 of the SBH algorithm. We shall refer to the right hand term in the inequality as the threshold. If the dataset is dense 8 then the answers to most point functions on points in the dataset are expected to be above the threshold, and hence will be present in the output (after perturbation via the Laplace mechanism). However, this might not hold in general for all datasets. Consider for instance a dataset D each row of which contains a unique ID. This means that the answer to each point function on the dataset is either 1 (if the ID is present in the dataset), or 0 (if the ID is not present in the dataset). With overwhelming probability (depending on δ) the output will be an empty dataset. 9 Thus, in order to get some non-trivial output from the algorithm, the dataset should not be too sparse. Hence, in principle, the algorithm can be used for any dataset, even those that contain identifying information. It is simply the case that such identifying information will result in the algorithm not reproducing those rows in the output (by virtue of being sparse). In order to ensure that the algorithm produces some non-trivial synthetic dataset, we therefore removed some of the information that would make the original dataset sparse and aggregated other information to improve density. We will give more details on this in Section 4.

Privacy and Utility of the SBH Algorithm
The privacy of the SBH algorithm is established in the following theorem whose proof we reproduce from [6,12] for completeness.
Proof. Notice that it suffices to argue privacy for the answers a x to the queries q x , since the output dataset D out can be constructed through the queries q x and their answers a x via post-processing. Consider two neighbouring datasets D and D ′ , where D ′ is obtained from D by replacing row x with row x ′ . Then the only point queries whose answers differ in the two datasets are q x and q x ′ . Since each point query q y is independent of any other point query, we can look at the two aforementioned queries separately. After proving privacy for each, we can use composition to argue privacy for both together.
Consider the answers a x (D) and a x (D ′ ) to the query q x on the datasets D and D ′ , respectively. Since the row x is in D, we know that q x (D) > 0. If it is also true that q x (D ′ ) > 0 then a x (D) and a x (D ′ ) are (ǫ/2, 0)-indistinguishable due to the Laplace mechanism, where the subsequent steps 6 and 7 maintain (ǫ/2, 0)-indistinguishability by the closure under post-processing property of differential privacy. If on the other hand we have q x (D ′ ) = 0, then a x (D ′ ) is always 0. But q x (D) = 1, since D and D ′ are neighbouring datasets that differ in only one row, i.e., x, and therefore agree on all other rows. Now, we want to show that the probability that a x (D) = 0 is bounded by δ/2. We call the event a x (D) = 0 as the bad event. This is only possible if Therefore, by setting b = 2 ǫ and t = ln 2 δ in Eq. 1, we get Thus the answers a x (D) and a x (D ′ ) are (0, δ/2)-indistinguishable. Together with the previous case, by composition, answers a x (D) and a x (D ′ ) are (ǫ/2, δ/2)-indistinguishable. By symmetry, the same holds for the answers a x ′ (D) and a x ′ (D ′ ). For all other point functions the answers are identically distributed in the two datasets. Therefore, by composition all answers are (ǫ, δ)-indistinguishable. The rounding step in Step 9 is simple post-processing. Hence, the mechanism is (ǫ, δ)-differentially private.
The following theorem states the utility of the SBH algorithm.

Why the SBH Algorithm?
When applied to the Opal dataset, the SBH algorithm had several advantages that we highlight in the following.

Computational Efficiency
The SBH algorithm has the advantage that the run time is polynomial in n, i.e., the number of rows in the dataset, as opposed to polynomial in the size of the domain X , which in turn is exponentially large in the number of attributes. In fact, the domain size |X | can become substantially large with only a few attributes of high cardinality. For instance, consider a domain X having 4 attributes, each with cardinality 1000. Then the size of the domain, i.e., |X | is already 10 12 . To see why the SBH algorithm has run time polynomial in n, note that we need not run through each point x ∈ X mentioned in step 2 of the algorithm. Instead, we need only run through points that exist in the dataset (since the point functions of all the points not in the dataset D have by definition answers of 0). However, care must be taken with this modification of the algorithm for reasons of privacy. More specifically, we need to ensure that the rows of the dataset D are either randomly shuffled or sorted in some prescribed order independent of the data, e.g., lexicographic order. This can be done either before or after the application of the (modified) algorithm. To see why order is important, consider two neighbouring datasets D and D ′ that only differ in the first row. In dataset D, the first row is x, and in dataset D ′ the first row is x ′ . The rest of the rows in the two datasets are identical (both in order and value). Now assume that q x (D) and q x ′ (D ′ ) are both non-zero and significantly greater than the threshold 2 ǫ ln 2 δ of the SBH algorithm. Then, with overwhelming probability the first few rows in the output dataset from D will be equal to the point x and the first few rows in the output dataset from D ′ will be equal to the point x ′ . Thus, the two outputs are not (ǫ, δ)-indistinguishable for any reasonable values of ǫ and δ. It is easy to see how this is avoided when the original dataset D is sorted according to some fixed order independent of the dataset. Or, equivalently, via a random shuffle.

Introducing New Points
Another feature of the SBH algorithm is that it does not introduce new points in its output. That is, it only outputs those points that exist in the original dataset D, and any points not in D, but in the domain, are not present in the output. This is, of course, done with the drawback that some points of D are stripped from the output. In essence, points with low or zero counts are both mapped to zero counts. It was one of the desired characteristics of the synthetic Opal dataset that no new points be added. Without this requirement, a straightforward mechanism to output the histogram of some dataset D, i.e., answering all point functions, is to apply Laplace noise of magnitude 1/ǫ to the answer a x (D) of each point x ∈ X (even points that are not present in D). Of course all possible points in the (unrestricted) domain might include points that have no meaning in the real world. For instance, a point might correspond to a trip whose route is not in service at that particular time. In a post-processing step, these anomalies can potentially be ruled out. But doing so in general is not easy, as each row needs to be checked for consistency. In the absence of rules to automatically check for consistency, this becomes a prohibitive task. Nevertheless, the algorithm could be used if a dictionary of all possible trips (tap locations and time combinations) is provided. 10 However, such a modification now relies on the domain size, and depending on the size, this algorithm can become prohibitive.

Application to the Opal Dataset
In this section we describe how we applied the SBH algorithm on the Opal dataset and our choice of privacy parameters.

Producing the Output
Looking at the SBH algorithm, it is clear that as long as the given dataset is sufficiently dense, the output will contain many points from the original dataset. In order to make the dataset more dense we performed a number of pre-processing steps. Note that these steps were taken to increase the density of the dataset(s) to control the impact on utility only. While steps similar to these are used in other settings in an attempt to provide privacy, these do not need to be interpreted as improving privacy in our case, as privacy is automatically guaranteed by the process being differentially private. As discussed below, we actually partitioned the dataset into disjoint partitions. After that we applied the SBH algorithm on several combination of columns (attributes) from each partition to release several differentially private synthetic datasets. The following is the summary of the steps taken.
1. We removed any unique identifiers. These by definition make the dataset sparse.
2. We binned the tap-on and off times to within a 15 minute window.
3. The number of possible tap-on and tap-off locations for buses (i.e., bus stops) lead to sparseness.
We therefore collapsed them into postcodes.
4. We partitioned the dataset into 4 × 14 = 56 disjoint datasets. This was done by first splitting the dataset by the four transport modes and then separating the datasets belonging to different days.
5. For each partitioned dataset, we only retained tap-on and tap-off times and locations (the date and mode of transport is now a constant).
6. Fix a partitioned dataset D i , where i indicates the partition number. We further partitioned the dataset into 6 different datasets according to the combination of columns. These 6 combinations were: (1) tap-on times, (2) tap-on locations, (3) tap-off times, (4) tap-off locations, (5) tap-on times and locations, and (6) tap-off times and locations. We label these datasets D i,j , where 1 ≤ j ≤ 6. Note that these new partitions are not disjoint.
7. We ran the SBH algorithm on each dataset D i,j to obtain the corresponding synthetic dataset, where 1 ≤ i ≤ 56 and 1 ≤ j ≤ 6. The parameters used for the SBH algorithm for the dataset D ·,j were ǫ j and δ j , subject to the condition that 6 j=1 ǫ j = ǫ and 6 j=1 δ j = δ. Note that implicitly we are saying that the same parameter pair (ǫ j , δ j ) is used for datasets D i,j for 1 ≤ i ≤ 56.
We now show that the whole process is differentially private.
Proof. First note that steps 1, 2, 3 and 5 are essentially fixing the domain X and therefore apply equally to all datasets D from X n . Therefore, these steps have no bearing on differential privacy. For the remaining steps, first fix an i. Then we see that all outputs from the datasets D i,j , 1 ≤ j ≤ 6, are altogether ( 6 j=1 ǫ j , 6 j=1 δ j ) = (ǫ, δ)-differentially private due to the sequential composition theorem (see Theorem 2). Now, all outputs D i,j , for 1 ≤ i ≤ 56 and 1 ≤ j ≤ 6 are (ǫ, δ)-differentially private according to the parallel composition theorem (See Theorem 3), since each set D i,j , 1 ≤ j ≤ 6, is (ǫ, δ)-differentially private. This completes the proof. Remark 2. Recall our discussion on trip privacy in Remark 1. We note that since any identifying information has already been removed in the output datasets, and since the datasets have been decoupled into different datasets based on transport modes and dates, there is no obvious link between the trips. Therefore, we believe that the somewhat weaker notion of trip privacy, as opposed to all trips from an individual, is reasonable in this case.

Choice of Parameters
Our discussion in this section applies to a generic disjoint partition i, where 1 ≤ i ≤ 56. We therefore omit the subscript i and will simply refer to the 6 further partitions of the dataset D i , as D 1 , . . . , D 6 . Recall that according to our labelling, datasets D 1 , . . . , D 4 correspond to the one-way marginal counts, and datasets D 5 and D 6 correspond to the two-way marginal counts. We set the values of ǫ j 's as follows The decision of assigning ǫ j 's is one of balancing privacy against utility. The higher privacy budget assigned to the two-way marginals ensured that more points were present in the output datasets. This means that the overall value of ǫ was 8 (by basic composition). This value of ǫ is admittedly higher than what is generally considered in the differential privacy literature. 11 However, due to the removal of sensitive or identifying information, we believe that this is a reasonably trade-off between privacy and utility.
For δ, recall that in theory δ is supposed to be smaller than any inverse polynomial power of n, where n is the size of the dataset D. However, in practice, we need to instantiate δ with some value. Once we instantiate δ, by definition δ is a constant, and is no longer equivalent to its theoretical definition. Therefore, in practice we need to ensure that δ is a small constant (relative to the size of the dataset). By looking at the SBH algorithm, we see that we need to set δ such that the probability of the bad event 12 is small. This probability is given by δ j /2. We fixed δ j = 1/8000000 ≈ 2 −23 , making this probability approximately 2 −24 . The value of δ j ≈ 2 −23 implies that the overall value of δ (by basic composition) is less than 2 −20 or 10 −6 . This value of δ has been used before in the literature [13, §6], and is slightly far from another value of 2 −30 recommended in [14, §8, p. 11].

Conclusion
Privacy-preserving high dimensional data release is a difficult problem. Research in differential privacy has resulted in many proposed algorithms that seek to generate synthetic versions of the data such that they give approximately correct answers to a specific set of queries. However, in many cases such algorithms take time proportional to the data universe, i.e., the size of the data domain, which in turn is exponential in the number of attributes present in the dataset. Thus, in practice many of these algorithms are not viable for data release. 13 Furthermore, in the case of open data the usability factor is paramount. A synthetic dataset may contain rows that have no meaning in the real world (e.g., a trip via a route that does not exist.). The purpose of open data is to release the data for any one to use, experts and novices alike. For such users, presence of such anomalous rows (which are in fact artefacts of synthetic data) is not desirable. The algorithm to release the Opal dataset was chosen with these two main considerations in mind. It is possible that in the future better algorithms can be identified or developed that allow richer insights into transport data. We believe this release will guide efforts in that direction. 11 Although, not by far! For instance, the experimental evaluation of the DualQuery algorithm from Gaboardi et al. uses an ǫ up to 5 [13, §6]. 12 See the second paragraph in the proof of Theorem 5 for the definition of the bad event.
13 See [6] for a detailed comparison of differentially private algorithms from a computational point of view.