OptStream: Releasing Time Series Privately

Many applications of machine learning and optimization operate on data streams. While these datasets are fundamental to fuel decision-making algorithms, often they contain sensitive information about individuals and their usage poses significant privacy risks. Motivated by an application in energy systems, this paper presents OPTSTREAM, a novel algorithm for releasing differentially private data streams under the w-event model of privacy. OPTSTREAM is a 4-step procedure consisting of sampling, perturbation, reconstruction, and post-processing modules. First, the sampling module selects a small set of points to access in each period of interest. Then, the perturbation module adds noise to the sampled data points to guarantee privacy. Next, the reconstruction module reassembles non-sampled data points from the perturbed sample points. Finally, the post-processing module uses convex optimization over the private output of the previous modules, as well as the private answers of additional queries on the data stream, to improve accuracy by redistributing the added noise. OPTSTREAM is evaluated on a test case involving the release of a real data stream from the largest European transmission operator. Experimental results show that OPTSTREAM may not only improve the accuracy of state-of-the-art methods by at least one order of magnitude but also supports accurate load forecasting on the private data.


Introduction
Differential privacy (Dwork, McSherry, Nissim, & Smith, 2006) has emerged as a robust framework to release datasets while limiting the disclosure of participating individuals. Informally, it ensures that what can be learned about an individual in a differential private dataset is, with high probability, limited to what could have been learned about the individual in the same dataset but without her data.
Many applications of machine learning and optimization, in areas such as healthcare, traffic management, and social networks, operate over streams of data. The use of differential privacy for the private release of time series has attracted increased attention in recent years (e.g., (Dwork, Naor, Pitassi, & Rothblum, 2010;Fanti, Pihur, & Erlingsson, 2016;Ding, Kulkarni, & Yekhanin, 2017;Chen, Machanavajjhala, Hay, & Miklau, 2017)) where aggregated statistics are continuously reported. Two common approaches for time series data release are the event-level and user-level privacy models . The former focuses on protecting a single event, while the latter aims at protecting all the events associated with a single user, i.e., it focuses on protecting the presence of an individual in the dataset. Additionally, Kellaris, Papadopoulos, Xiao, and Papadias (2014) proposed the notion of w-event privacy to achieve a balance between eventc 1 AI Access Foundation. All rights reserved. arXiv:1808.01949v2 [cs.CR] 30 Oct 2018 F. FIORETTO & P. VAN HENTENRYCK level and user-level privacy, trading off utility and privacy to protect event sequences within a time window of w time steps. This paper was motivated by a desire to release private streams of energy demands, also called loads, in transmission systems. The goal is that of protecting changes in consumer loads up to some desired amount within critical time intervals. Although customer identities are typically considered public information (e.g., each facility is served by some energy provider), their loads can be highly sensitive as they may reveal the economic activities of grid customers. For example, changes in load consumption may indirectly reveal production levels and strategic investments and other similar information. Moreover, these time series are often input to complex analytic tasks, e.g., demand forecasting algorithms (Nogales, Contreras, Conejo, & Espínola, 2002) and optimal power flows (Ochoa & Harrison, 2011). As a result, the accuracy of the private datasets is critical and, as shown later in the paper, existing algorithms for time series fall short in this respect for this application.
The main contribution of this paper is a new privacy mechanism that remedies these limitations and is sufficiently precise for use in forecasting and optimization applications. The new algorithm, called OPTSTREAM, is presented under the framework of w-event privacy and is a 4-step procedure consisting of sampling, perturbation, reconstruction, and post-processing modules. The sampling module selects a small set of points for private measurement in each period of interest, the perturbation module introduces noise to the sampled data points to guarantee privacy, the reconstruction module reconstructs the non-sampled data points from the perturbed sampled points, and the postprocessing module uses convex optimization over the private output of the previous modules, as well as the private answers of additional queries on the data stream, to redistribute the noise to ensure consistency of salient features of the data. OPTSTREAM is also generalized to answer queries over hierarchical streams, allowing data curators to monitor simultaneously streams produced by energy profile data at different levels of aggregation. It is important to emphasize that, although OPT-STREAM was motivated by an energy application, it is potentially useful for many other domains, since its design is independent of the underlying problem.
OPTSTREAM is evaluated on real datasets from Réseau de Transport d'Électricité, the French transmission operator and the largest in Europe. The dataset contains the energy consumption for one year at a granularity of 30 minutes. OPTSTREAM is also compared with state-of-the-art algorithms adapted to w-event privacy. Experimental results show that OPTSTREAM improves the accuracy of state-of-the-art algorithms by at least one order of magnitude for this application domain. The effectiveness of the proposed algorithm is measured, not only in terms of the error between the reported private streams and the original stream but also in the accuracy of a load forecasting algorithm based on the private data. Finally, the paper shows that the sampling and optimization-based post-processing steps are critical in achieving the desired performance and that the improvements are also observed when releasing hierarchical streams of data.
The rest of this paper is organized as follows. Section 2 discusses the stream model, summarizes the privacy goals of this work, and reviews the notion of differential privacy over streams. Section 3 describes OPTSTREAM and the design choices of its components. Section 4 analyzes the accuracy of the proposed framework and shows how it reduces the error introduced to preserve privacy when compared to a standard solution. Section 5 extends OPTSTREAM to the α-indistinguishability privacy model, allowing privacy protection of arbitrary quantities and which is critical for the motivating application. Additionally, OPTSTREAM is extended to handle hierarchical stream data. Section 6 performs a comprehensive experimental analysis of real data streams from energy load profiles. Section 7 discusses key aspects of the privacy model adopted to privately releasing streams 2 OPTSTREAM: RELEASING TIME SERIES PRIVATELY of data, as well as differences with the event-based model for data streams. Section 8 discusses the related work and, finally, Section 9 concludes the work.

Preliminaries
This section first reviews basic concepts in differential privacy. It then presents the w-event privacy model used to protect privacy in data streams and its definition of differential privacy.

Differential Privacy
This section reviews the standard definition of differential privacy (Dwork et al., 2006). Differential privacy focuses on protecting the privacy of an individual user participating to a dataset. Such notion relies on the definition of a adjacency relation ∼ between datasets. Two datasets X, X are called neighbors if their content differs in at most one tuple: X ∼ X ⇔ X − X ≤ 1.
Definition1 (Differential Privacy) Let A be a randomized algorithm that takes as input a dataset and outputs an element from a set of possible responses. A achieves -differential privacy if, for all sets O ⊆ O and all neighboring datasets X, X ∈ D: The level of privacy is controlled by the parameter ≥ 0, called the privacy budget, with values close to 0 denoting strong privacy. The adjacency relation ∼ captures the participation of an individual into the dataset. While differential privacy algorithms commonly adopts the 1-Hamming distance as adjacency relation between datasets, the latter can be generalized to be any symmetric binary relation ∼∈ D 2 . In particular, the relation ∼ captures the aspects of the private data D that are considered sensitive and has been generalized to protect locations of individuals (Fawaz & Shin, 2014) and quantities in general . When a single entry is associated with a user in the database, an algorithm satisfying Equation (1) prevents an attacker with access to the algorithm's output from learning anything substantial about any individual.

PROPERTIES OF DIFFERENTIAL PRIVACY
Differential privacy enjoys several important properties, including composability and immunity to post-processing.
Composability Composability ensures that a combination of differentially private algorithms preserve differential privacy (Dwork & Roth, 2013).
Theorem1 (Sequential Composition) The composition A(D) = (A 1 (D), . . . , A k (D)) of a col- Theorem2 (Parallel Composition) Let D 1 and D 2 be disjoint subsets of D and A be andifferentially private algorithm. Then computing A(D ∩ D 1 ) and A(D ∩ D 2 ) satisfies -differential privacy.
Post-processing Immunity Post-processing immunity ensures that privacy guarantees are preserved by arbitrary post-processing steps (Dwork & Roth, 2013).
Theorem3 (Post-Processing Immunity) Let A be an -differentially private algorithm and g be an arbitrary mapping from the set of possible output sequences O to an arbitrary set. Then, g • A is -differentially private.
We now introduce two useful differentially private algorithms.

THE LAPLACE MECHANISM
A numeric query Q, mapping a dataset to R d , can be made differentially private by injecting random noise to its output. The amount of noise to inject depends on the sensitivity of the query, denoted by ∆ Q and defined as, In other words, the sensitivity of a query is the maximum L 1 -distance between the query outputs from any two neighboring dataset D and D . For instance, ∆ Q = 1 for a query Q that counts the number of users in a dataset. The Laplace distribution with 0 mean and scale b, denoted by Lap(b), has a probability density function Lap(x|b) = 1 2b e − |x| b . It can be used to obtain an -differentially private algorithm to answer numeric queries (Dwork et al., 2006). In the following, we use Lap(λ) d to denote the i.i.d. Laplace distribution over d dimensions with parameter λ.
Theorem4 (Laplace Mechanism M Lap ) Let Q be a numeric query that maps datasets to R d . The Laplace mechanism that outputs Q(D) + z, where z ∈ R is drawn from the Laplace distribution Lap ∆ Q d , achieves -differential privacy.

SPARSE VECTOR TECHNIQUE
The Sparse Vector Technique (SVT) is an important tool of differential privacy (Dwork & Roth, 2013;Hardt & Rothblum, 2010) that allows to answer a sequence of queries without incurring a high privacy cost. The SVT mechanism is given a sequence of queries Q = q 1 , q 2 , . . . and a sequence of real valued thresholds Θ = θ 1 , θ 2 , . . . and outputs a vector indicating whether each query answer q i is above or below the corresponding threshold θ i . In other words, the output is a vector { , ⊥} where is the number of queries answered and (resp. ⊥) indicates that the answer to a noisy query is (resp. is not) above a noisy threshold. The SVT mechanism is summarized in Algorithm 1. It takes as input a dataset D, a sequence of queries Q = q 1 , q 2 , . . ., each with sensitivity no more than ∆ Q , a sequence of thresholds Θ = θ 1 , θ 2 , . . ., and a constant k, denoting the maximum number of queries to be answered with value . Its output consists of a sequence of answers a 1 , a 2 , . . . with each a i ∈ { , ⊥}. For each query, SVT perturbs the corresponding threshold and checks if the perturbed individual query answer is above the noisy threshold.
The SVT mechanism is useful especially in situations when one expects that most answers fall below the threshold, since the noise depends on k. The SVT mechanism will be used in this paper to find good sampled points in a stream. 4 OPTSTREAM: RELEASING TIME SERIES PRIVATELY Algorithm 1: SVT -Sparse Vector Technique input : D: the dataset Q = q 1 , q 2 , . . .: a sequence of queries Θ = θ 1 , θ 2 , . . .: a sequence of thresholds k: the maximum number of queries to be answered positively : the privacy budget Break if count ≥ k; 9 else 10 output a i = ⊥;

The w-Event Privacy Model for Data Streams
This section presents the privacy model for streams adopted in this paper. A data stream D is an infinite sequence of elements in the data universe U = I × T , where I denotes the set of user identifiers and T is a possibly unbounded set of time steps. In other words, each tuple (i, t) describes an event reported by user i that occurred at time t. Time is represented through discrete steps T = {1, 2, . . .} and user events are recorded periodically (e.g., every 30 minutes). In a data stream D, tuples are ordered by arrival time. If tuple (i, t) arrives after tuple (i , t ), then t ≥ t . Additionally, In the following, D[t] denotes a stream prefix, i.e., the sequence D 1 , . . . , D t of all tuples observed on or before time t. Additionally, D denotes the set of all datasets describing collections of tuples in U .

Example1
Consider a data stream system that collects location data from WiFi access points (APs) in a collection of buildings. Users correspond to MAC addresses of individual devices that connect to an AP. An item (i, t) in the data stream represents that the fact that user i has made at least one connection to an access point at time step t. In the following table, user 02:18:98:09:1a:a4 reports a connection at times t = 1 and t = 2. The example represents a data stream prefix D[3]. The data curator receives information from an unbounded data stream D in discrete time steps. At time t, the curator collects a dataset D t of tuples (i, t) where every row corresponds to a unique user. The curator reports the result of a count query Q : D → R that reports how many users are in the dataset at time t, i.e., Q(D t ) = |{i : (i, t) ∈ D t }|.

F. FIORETTO & P. VAN HENTENRYCK
Example2 Consider the data stream prefix of Example 1. The associated result of the count queries executed onto each dataset of the data stream is given in the following table.
In our target application, the data curator is interested in publishing every element Q(D t ) for a recurring period of w time steps. A w-period is a set of w contiguous time steps t − w + 1,. . . ,t (w ≥ 1). Thus, the answers to each query Q(D t ) are generated in real time for windows of w time steps. As a result, this paper adopts the w-event privacy framework by Kellaris et al. (2014).

Differential Privacy on Streams
The w-event privacy framework (Kellaris et al., 2014) extends the definition of differential privacy to protect data streams and has become a standard privacy notion for data streams (see, for instance, (Rastogi & Nath, 2010;Dwork & Roth, 2013;Bolot, Fawaz, Muthukrishnan, Nikolov, & Taft, 2013;Chan, Shi, & Song, 2011)). The framework operates on stream prefixes and two data streams prefixes In other words, two stream prefixes are w-neighbors if their elements are pairwise neighbors and all the differing elements are within a time window of up to w time steps. As a result, when ensuring the privacy guarantees, the w-event framework does not consider data streams where the differences are beyond a time window of size w: It only needs to consider windows of w elements.
Definition2 (w-privacy) Let A be a randomized algorithm that takes as input a stream prefix D[t] of arbitrary size and outputs an element from a set of possible output sequences O. Algorithm A satisfies w-event -differential privacy (w-privacy for short) if, for all t, all sets O ⊆ O, and all w-neighboring stream prefixes D[t] and D [t]: An algorithm satisfying w-privacy protects the sensitive information that could be disclosed from a sequence of finite length w. When w = 1, w-privacy reduces to event-level privacy  that protects the disclosure of events in a single time step. All the properties of differential privacy discussed above carry over to w-privacy. The Laplace mechanism which adds Laplace noise to each element of the stream with parameter w∆ Q / achieves w-privacy (Kellaris et al., 2014).
The algorithms studied in this paper satisfy Definition 2. When clear from the context, the paper uses -differential privacy to denote w-event privacy. A list of common symbols is summarized in Table 1.

OptStream For Stream Release
This section describes OPTSTREAM, a novel algorithm for private data stream release. OPT-STREAM consists of four steps: (1) data sampling, (2) perturbation, (3) reconstruction of the nonsampled data points, and (4) optimization-based post-processing. The algorithm takes as input the data stream, denoted by D I = D I 1 , D I 2 , . . ., the period size w whose privacy is to be protected, the privacy budget , and some hyper-parameters used by its procedures, which will be described later. Its output is a data stream summaryx = (x 1 ,x 2 , . . .) where eachx t represents a private version of the aggregated real data in D I t . Here, an aggregation operation is one that transforms the dataset into a numerical representation (e.g., a count). The four steps can be summarized as follows: 1. SAMPLE: selects a small set of points for each w-period. Its goal is to perform a dimensionality reduction over the data stream whose sample points can be used to generate private answers to each query with low error.
2. PERTURB: adds noise to the sampled data points to guarantee privacy.
3. RECONSTRUCT: reconstructs the non-sampling data points from the perturbed sampled points. Its goal is to map the dimension-reduced data stream back to the original space, generating thus w data points.
4. POST-PROCESS: uses the private output of the above modules, as well as private answers to additional queries on the data stream to ensure consistency of salient features of the data.
OPTSTREAM balances two types of errors: a perturbation error, introduced by the application of additive noise at the sampling points, and a reconstruction error, introduced by the reconstruction procedure at the non-sampled points. The higher the number of samples in a w-period, the more perturbation error is introduced while the reconstruction error may be reduced, and vice-versa. Section 4 describes the error generated by these two components and analyzes the number of samples that minimizes the error. OPTSTREAM processes the data stream in consecutive and disjoint w-periods. To simplify notation, throughout this section, the paper uses D = D 1 , . . . , D w and x = x 1 , . . . , x w to denote, respectively, the current w-period being processed, and its univariate discrete series representation, where each x i denotes the result of an aggregation function aggr(D i ) that transforms the dataset into a numerical representation. Similarly, we use D and x to denote their neighboring counterparts. Additionally, given a set of time steps indexes S, x[S] denotes the collection of points {x i |i ∈ S}. : the data stream w: the size of the period : the privacy budget k, θ, F : hyperparameters output:x = (x 1 ,x 2 , . . .): a private data stream summary Let t be the current time step For simplicity, we will assume that the sensitivity of the aggregation operations is one. The results directly generalize to arbitrary sensitivities.
OPTSTREAM is depicted in Algorithm 2. When a new w-period is observed (line 1), the algorithm extracts the relevant portion of the stream (line 2) and calls function RELEASE, which releases a private version of the data stream in the current w-period (line 3).
In addition to the portion D of the data stream to release, the size of the w-period w, and the privacy budget , function RELEASE takes, as inputs, three hyperparamers: k, θ, and F . Parameters k and θ are used by procedure SAMPLE and represent the maximum number of data points to extract in the w-period and a threshold value respectively. Parameter F is a set of features queries used by procedure POSTPROCESS; these queries and their uses will be covered in detail later. The four steps of Function RELEASE operate on a discrete series representation x of the data stream (line 4). The privacy budget to be used in each step is computed in line (5). Procedure SAMPLE takes as input the sequence of values x, the maximum number k of data points to sample, and the portion s ≥ 0 of the privacy budget used in the sampling process 1 (line 6). It outputs the set S of indexes associated with the values of x whose privacy must be protected. Procedure PERTURB takes, as input, the vector x[S] of sampled data points from x and outputs a noisy versionx S of x, using a portion p > 0 of the overall privacy budget (line 7). Procedure RECONSTRUCT takes, as inputs, the vectorx S from the perturbation step and the size w of the period and outputs a vectorx of size w whose values are private estimates of the data stream in the w-period (line 8). Next, procedure POSTPROCESS takes as input the vector of pointsx, additional feature queries Q F (D) for each feature F in the set of data features F (which are defined in detail in Section 3.4), and uses a 1. s can be 0 if the sampling processes does not access the real data to make a decision on which points to sample. 8 OPTSTREAM: RELEASING TIME SERIES PRIVATELY portion o > 0 of the overall privacy budget to compute a final estimatex of x (line 9). Finally, the private estimatesx are released (line 10).
Lemma1 Let s + p + o = . When the SAMPLE, PERTURB, and POST-PROCESS procedures satisfy s -, p -, and o -differential privacy, respectively, Algorithm 2 satisfies -differential privacy.
Any sampling, perturbation, and reconstruction algorithms can be used within Algorithm 2, provided that they achieve the intended purpose and satisfy the required privacy guarantees. The next section describes two variants of the sampling and reconstruction algorithms that may reduce the error (Section 4) and are shown to perform well experimentally (Section 6). The perturbation procedure is a standard application of the Laplace mechanism (Theorem 4) on the set of sampled data points and parallel composition (Theorem 2). The post-processing step is described in Section 3.4.

The Sampling Procedures
The goal of the sampling procedure is to select k points of the given w-period that summarize the entire data stream period well. This section considers two strategies.
Equally-Spaced Sampling A first strategy is to sample k equally-spaced data points in the wperiod. Since this approach does not inspect the values of the data stream to make its decisions, it does not consume any privacy budget, i.e., s = 0.
L 1 -Based Sampling The second strategy also selects k out of w points but tries to minimize the error between the original data points and the points generated by a linear interpolation of the k selected points. Let ξ [i,j] be a function capturing the line segment between two points x i and x j , i.e., Consider an ordered sequence S = (ι 1 , . . . , ι k ) of k indexes in [w] and define ξ S as a piecewise linear function whose pieces are line segments between every two adjacent points in S, The L 1 -based sampling procedure aims at selecting a sequence S of k indexes ι 1 < ι 2 < . . . < ι k in a w-period that minimizes the L S 1 -scoring function defined as, O M p J L 6 u p E 6 0 0 t 6 f O i 5 q W n U 7 G q t W j 8 2 D b t q n Z p W T u p 2 / c z K n D t 6 c 5 X 1 9 f I i A x c Z u M h A y z C n K I M 5 m n 3 9 w H j y C Z / C i P W h P 2 q v 2 N o s W t P n M P v g B 7 f 0 L F c 2 c B Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " h W T V U W F I o S m O 2 c K 5 T Q z x j + 1 c V 5 E = " > A A A C F 3 i c d V B L S w M x G M z W V 6 2 v V Y 9 e g k X o Q Z b d r d o e C 1 4 8 V r Q P 6 K 4 l m 2 b b 0 O y D J C u W Z f + F F / + K F w + K e N W b / 8 Z s H 6 C i A 4 F h Z r 7 k y 3 g x o 0 K a 5 q d W W F p e W V 0 r r p c 2 N r e 2 d / T d v b a I E o 5 J C 0 c s 4 l 0 P C c J o S F q S S k a 6 M S c o 8 B j p e O P z 3 O / c E i 5 o F F 7 L S U z c A A 1 D 6 l O M p J L 6 u p E 6 0 0 t 6 f O i 5 q W n U 7 G q t W j 8 2 D b t q n Z p W T u p 2 / c z K n D t 6 c 5 X 1 9 f I i A x c Z u M h A y z C n K I M 5 m n 3 9 w H j y C Z / C i P W h P 2 q v 2 N o s W t P n M P v g B 7 f 0 L F c 2 c B Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " h W T V U W F I o S m O 2 c K 5 T Q z x j + 1 c V 5 E = " > A A A C F 3 i c d V B L S w M x G M z W V 6 2 v V Y 9 e g k X o Q Z b d r d o e C 1 4 8 V r Q P 6 K 4 l m 2 b b 0 O y D J C u W Z f + F F / + K F w + K e N W b / 8 Z s H 6 C i A 4 F h Z r 7 k y 3 g x o 0 K a 5 q d W W F p e W V 0 r r p c 2 N r e 2 d / T d v b a I E o 5 J C 0 c s 4 l 0 P C c J o S F q S S k a 6 M S c o 8 B j p e O P z 3 O / c E i 5 o F F 7 L S U z c A A 1 D 6 l O M p J L 6 u p E 6 0 0 t 6 f O i 5 q W n U 7 G q t W j 8 2 D b t q n Z p W T u p 2 / c z K n D t 6 c 5 X 1 9 f I i A x c Z u M h A y z C n K I M 5 m n 3 9 w H j y C Z / C i P W h P 2 q v 2 N o s W t P n M P v g B 7 f 0 L F c 2 c B Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " h W T V U W F I o S m O 2 c K 5 T Q z x j + 1 c V 5 E = " > A A A C F 3 i c d V B L S w M x G M z W V 6 2 v V Y 9 e g k X o Q Z b d r d o e C 1 4 8 V r Q P 6 K 4 l m 2 b b 0 O y D J C u W Z f + F F / + K F w + K e N W b / 8 Z s H 6 C i A 4 F h Z r 7 k y 3 g x o 0 K a 5 q d W W F p e W V 0 r r p c 2 N r e 2 d / T d v b a I E o 5 J C 0 c s 4 l 0 P C c J o S F q S S k a 6 M S c o 8 B j p e O P z 3 O / c E i 5 o F F 7 L S U z c A A 1 D 6 l O M p J L 6 u p E 6 0 0 t 6 f O i 5 q W n U 7 G q t W j 8 2 D b t q n Z p W T u p 2 / c z K n D t 6 c 5 X 1 9 f I i A x c Z u M h A y z C n K I M 5 m n 3 9 w < l a t e x i t s h a 1 _ b a s e 6 4 = " r w j K + C m M c y H s k v X E j 9 0 B N B P c W e s = " > A A A B 7 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S L 0 V B I V 9 F j w 4 r G C a Q t t K J v t p l 2 6 2 Y T d i V h C f 4 M X D 4 p 4 9 Q d 5 8 9 + 4 b X P Q 1 g c D j / d m m J k X p l I Y d N 1 v Z 2 1 9 Y 3 N r u 7 R T 3 t 3 b P z i s H B 2 3 T J J p x n 2 W y E R 3 Q m q 4 F I r 7 K F D y T q o 5 j U P J 2 + H 4 d u a 3 H 7 k 2 I l E P O E l 5 E N O h E p F g F K 3 k 5 0 / 9 y 2 m / U n X r 7 h x k l X g F q U K B Z r / y 1 R s k L I u 5 Q i a p M V 3 P T T H I q U b B J J + W e 5 n h K W V j O u R d S x W N u Q n y + b F T c m 6 V A Y k S b U s h m a u / J 3 I a G z O J Q 9 s Z U x y Z Z W 8 m / u d 1 M 4 x u g l y o N E O u 2 G J R l E m C C Z l 9 T g Z C c 4 Z y Y g l l W t h b C R t R T R n a f M o 2 B G / 5 5 V X S u q h 7 b t 2 7 v 6 o 2 a k U c J T i F M 6 i B B 9 f Q g D t o g g 8 M B D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / L n Y 6 U < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " r w j K + C m M c y H s k v X E j 9 0 B N B P c W e s = " > A A A B 7 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S L 0 V B I V 9 F j w 4 r G C a Q t t K J v t p l 2 6 2 Y T d i V h C f 4 M X D 4 p 4 9 Q d 5 8 9 + 4 b X P Q 1 g c D j / d m m J k X p l I Y d N 1 v Z 2 1 9 Y 3 N r u 7 R T 3 t 3 b P z i s H B 2 3 T J J p x n 2 W y E R 3 Q m q 4 F I r 7 K F D y T q o 5 j U P J 2 + H 4 d u a 3 H 7 k 2 I l E P O E l 5 E N O h E p F g F K 3 k 5 0 / 9 y 2 m / U n X r 7 h x k l X g F q U K B Z r / y 1 R s k L I u 5 Q i a p M V 3 P T T H I q U b B J J + W e 5 n h K W V j O u R d S x W N u Q n y + b F T c m 6 V A Y k S b U s h m a u / J 3 I a G z O J Q 9 s Z U x y Z Z W 8 m / u d 1 M 4 x u g l y o N E O u 2 G J R l E m C C Z l 9 T g Z C c 4 Z y Y g l l W t h b C R t R T R n a f M o 2 B G / 5 5 V X S u q h 7 b t 2 7 v 6 o 2 a k U c J T i F M 6 i B B 9 f Q g D t o g g 8 M B D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / L n Y 6 U < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " r w j K + C m M c y H s k v X E j 9 0 B N B P c W e s = " > A A A B 7 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S L 0 V B I V 9 F j w 4 r G C a Q t t K J v t p l 2 6 2 Y T d i V h C f 4 M X D 4 p 4 9 Q d 5 8 9 + 4 b X P Q 1 g c D j / d m m J k X p l I Y d N 1 v Z 2 1 9 Y 3 N r u 7 R T 3 t 3 b P z i s H B 2 3 T J J p x n 2 W y E R 3 Q m q 4 F I r 7 K F D y T q o 5 j U P J 2 + H 4 d u a 3 H 7 k 2 I l E P O E l 5 E N O h E p F g F K 3 k 5 0 / 9 y 2 m / U n X r 7 h x k l X g F q U K B Z r / y 1 R s k L I u 5 Q i a p M V 3 P T T H I q U b B J J + W e 5 n h K W V j O u R d S x W N u Q n y + b F T c m 6 V A Y k S b U s h m a u / J 3 I a G z O J Q 9 s Z U x y Z Z W 8 m / u d 1 M 4 x u g l y o N E O u 2 G J R l E m C C Z l 9 T g Z C c 4 Z y Y g l l W t h b C R t R T R n a f M o 2 B G / 5 5 V X S u q h 7 b t 2 7 v 6 o 2 a k U c J T i F M 6 i B B 9 f Q g D t o g g 8 M B D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / L n Y 6 U < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " r w j K + C m M c y H s k v X E j 9 0 B N B P c W e s = " > A A A B 7 H i c b V B N S 8 N A E J 3 4 W e t X 1 a O X x S L 0 V B I V 9 F j w 4 r G C a Q t t K J v t p l 2 6 2 Y T d i V h C f 4 M X D 4 p 4 9 Q d 5 8 9 + 4 b X P Q 1 g c D j / d m m J k X p l I Y d N 1 v Z 2 1 9 Y 3 N r u 7 R T 3 t 3 b P z i s H B 2 3 T J J p x n 2 W y E R 3 Q m q 4 F I r 7 K F D y T q o 5 j U P J 2 + H 4 d u a 3 H 7 k 2 I l E P O E l 5 E N O h E p F g F K 3 k 5 0 / 9 y 2 m / U n X r 7 h x k l X g F q U K B Z r / y 1 R s k L I u 5 Q i a p M V 3 P T T H I q U b B J J + W e 5 n h K W V j O u R d S x W N u Q n y + b F T c m 6 V A Y k S b U s h m a u / J 3 I a G z O J Q 9 s Z U x y Z Z W 8 m / u d 1 M 4 x u g l y o N E O u 2 G J R l E m C C Z l 9 T g Z C c 4 Z y Y g l l W t h b C R t R T R n a f M o 2 B G / 5 5 V X S u q h 7 b t 2 7 v 6 o 2 a k U c J T i F M 6 i B B 9 f Q g D t o g g 8 M B D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / L n Y 6 U < / l a t e x i t > x 6 < l a t e x i t s h a 1 _ b a s e 6 4 = " w e 4 u A m k 0 F q X S 4 T 5 / g D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / Q L I 6 X < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " w e 4 u A m k 0 F q X S 4 T 5 / g D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / Q L I 6 X < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " w e 4 u A m k 0 F q X S 4 T 5 / g D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / Q L I 6 X < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " w e 4 u A m k 0 F q X S 4 T 5 / g D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / Q L I 6 X < / l a t e x i t > x 1 < l a t e x i t s h a 1 _ b a s e 6 4 = " g G p t u D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / O p 4 6 W < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " e U L K m g k T D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / O p 4 6 W < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " e U L K m g k T D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / O p 4 6 W < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " e U L K m g k T D z D K 7 w 5 y n l x 3 p 2 P R e u a U 8 y c w B 8 4 n z / O p 4 6 W < / l a t e x i t > x 4 < l a t e x i t s h a 1 _ b a s e 6 4 = " g w R d j 8 e X c + l q 0 l p 5 g 5 h T 9 w P n 8 A z S K O l Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " g w R d j 8 e X c + l q 0 l p 5 g 5 h T 9 w P n 8 A z S K O l Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " g w R d j 8 e X c + l q 0 l p 5 g 5 h T 9 w P n 8 A z S K O l Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " g w R d j 8 H l x D E + 6 g B T 4 w 4 P A M r / D m S O f F e X c + l q 0 l p 5 g 5 h T 9 w P n 8 A z S K O l Q = = < / l a t e x i t > Figure 1: Illustration example of the L S 1 function, with S = 1, 3, 6. The solid black curve connects the data point x, the dashed red curve denotes the function ξ S , and the red arrows denote the distance between the points in x and the function ξ S . The L S 1 (D) value is the sum of these distances. Figure 1 provides an example with a graphical illustration of the L S 1 function. The black solid curve delineate x. The set S = (1, 3, 6) and the sampled points x 1 , x 3 , and x 6 are colored red. ξ S is the piecewise linear function passing through the sampled points and is represented with dashed red lines. The red arrows denote the distance between the points in x and their corresponding values in ξ S and the L S 1 -score for the set S is the sum of these distances. The procedure assumes that the first and the last points of x are in S.
Intuitively, the set of k points that minimizes (4) produce the minimal reconstruction error when linear interpolation is used as a reconstruction procedure. However, finding the set of k points minimizing the L 1 -scoring function may be computationally expensive. Hence this paper presents a differentially-private greedy algorithm that approximates (4). The sampling procedure is depicted in Algorithm 3 and is an instantiation of the SVT mechanism where the queries compute the L 1 -scores of the potential interpolation steps.
The mechanism takes, as inputs, the data stream x processed for the current w-period, the number of points k to sample for measurements, along with the privacy budget s and a user defined threshold θ ≥ 0 which influences the acceptable L 1 -score for choosing the next point to sample. The values choice for θ in our application of interest are detailed in Section 6. Line (1) initializes the set of sample points S with the first element of the w-period (this choice is necessary for executing the interpolation in the next steps), and it tracks the last point t p selected for sampling. The algorithm first generates the noise ρ (line 2) for the threshold θ (line 5). For all but the first time step, the algorithm adds Laplace noise with parameter 4k∆ L / to the L [tp,i] 1 -query (line 4), where ∆ L is the largest sensitivity associated with any of the L 1 scoring functions invoked by the algorithm (see Theorem 6). If the result is above the threshold, then point i is added to S (line 6) and the last selected point t p is updated (line 7). The mechanism keeps track of the number of index points already stored. It stops when the size of S matches k (line 10). The mechanism also tests if there are enough points to reach k (line 8) and adds the remaining points if needed (line 9).
To run the mechanism, it is necessary to determine the sensitivity ∆ where D and D are two w-neighboring data streams in a w-period.
The following theorem shows that ∆ [a,b] L 1 can be bounded, yielding a procedure to privately sample k points in the w-period using an efficient, suboptimal, version of Equation (4).
Theorem6 For an arbitrary w-period and fixed indexes a, b ∈ [w] with a < b, the sensitivity ∆ Proof. Consider two data stream w-periods D and D such that D ∼ w D and focus, without loss of generality, on their associated stream counts x and x . Let ξ and ξ be shorthands for ξ [a,b] and ξ [a,b] . The goal is to bound and each term of the summation can be bounded independently.
(2) The case ξ (i) < x i and ξ(i) < x i is symmetric. (3) The case ξ (i) ≥ x i and ξ(i) < x i requires a further case analysis.
(4) Finally, the last case, ξ (i) < x i and ξ(i) ≥ x i , is symmetric to previous one. Therefore Let S = (ι 1 , . . . , ι k ) be a sequence of k indexes in [w]. Because of the stopping criteria, the largest contiguous interval [ι i , ι j ] for i, j ∈ [k] has size w − k. The sensitivity of the L 1 -score on such an interval is bounded by 2(w − k). Algorithm 3 thus uses Theorem7 Algorithm 3 is s -differential private.
Proof. The proof is a direct consequence of the correctness of the SVT mechanism (Hardt & Rothblum, 2010), Theorem 6, and the definition of ∆ L .

The Perturbation Procedure
Given the set S of k sampling indexes for a w-period, the perturbation process takes as input the k-ary vector of the data stream measurements x[S] and outputs a noisy versionx S of such vector satisfying p -differential privacy. The process simply applies the Laplace mechanism with parameter k∆ A / p , where ∆ A is the sensitivity of the aggregation query.
The above result follows by straightforward application of the Laplace mechanism (Theorem 4) on a set of k points and parallel composition (Theorem 2).

The Reconstruction Procedure
The RECONSTRUCT procedure takes as input the noisy measurementsx S ∈ R k at the sample points S in x and outputs a vectorx ∈ R w of private estimates for the sub-stream x. Each valuex i ofx is obtained evaluating the function ξ S at i. Section 4 analyzes how well the polynomial approximates the data stream at any point x i . The reconstruction procedure is not required to query the real data stream and uses exclusively private information to compute its output. Hence, the outputx remains s + p -differential private by post-processing immunity of differential privacy (Theorem 3).
Algorithm 4: POSTPROCESS -Optimization-based post-processing input :x: the private data stream seen in the current w-period Q F (D); the set of feature queries o : the privacy budget output:x: a private post-processed data stream returnx =ẋ 11 , . . . ,ẋ 1w

The Optimization-based Post-Processing
The noise introduced in the previous steps may substantially alter the values of the elements in the w-period, so that some global properties of interest, such as the total sum of elements in the w-period may differ from its original value. The goal of the post-processing step is to redistribute the noise introduced by the previous steps using noisy information on aggregated values of the w-period. It does so by casting the noise redistribution as an optimization problem whose solution guarantees the consistency of different estimates of identical quantities. The POST-PROCESS step computes the final estimatesx of the w-period data x using the private datax and additional queries over x. The procedure is summarized in Algorithm 4. It uses the concept of features to capture semantic properties of the application of interest and queries these features in addition to using the noisy inputx of the original data stream. For example, two important features in the analysis of WiFi connections profiles are those periods when peaks typically occur, as well as the total amount of connections occurring in an w-period.
Formally, a feature is a partition of the w-period and the size of the feature is the number of elements in the partition. We say that a feature F is a sub-feature of F, denoted by F ≺ F, if F is obtained by sub-partitioning F. The feature query Q F (D) on data stream D associated with feature Example3 Consider a w-period x = (10,15,20,23,41,72,55,50,88,72,40,18) of size 12 reporting the number of WiFi connections to an access point in a day-period. Consider a feature F 1 = {1, . . . , 12} that includes the indexes for all the elements of the w-period. The associated feature query Q F 1 (D) = (10,15,20,23,41,72,55,50,88,72,40,18) returns each frequency value observed during the day. Next, we consider a sub-feature F 2 of F 1 , defined as The optimization-based post-processing takes as input the noisy data streamx from the reconstruction procedure and a collection of features queries Q F (D) for each F in the set of features F = {F 1 , . . . , F p }. For notational simplicity, we assume that the first feature always partitions the data stream w-period into singletons, i.e., F 1 = {{i} : i ∈ [w]}. The noisy answer to this query is the outputx of the perturbation procedure (line (8) of Algorithm 2). When viewed as queries, the inputs to the mechanism can be represented as a set of values Q F i (D) = c i = (c i1 , . . . , c im i ) (1 ≤ i ≤ p) or, more concisely, as c = (c 11 , . . . , c pmp ). Finally, we assume that the partial ordering ≺ of features is given.
This first step of Algorithm 4 (line 1) applies the Laplace mechanism with privacy parameter p−1 to each feature query (excluding the first one whose answerx is already private), i.e., The resulting valuesc = (c 11 , . . . ,c pmp ) are then post-processed by the optimization algorithm depicted in line (2) to obtain the values x * = (x * 11 , . . . , x * pmp ). Finally, the mechanism outputs a data streamx = (ẋ * 11 , . . . ,ẋ * 1w ). The essence of Algorithm 4 is the optimization model depicted in line (2). Its decision variables are the post-processed valuesẋ = (ẋ 11 , . . . ,ẋ pmp ), and λ = (λ 1 , . . . , λ p ) ∈ (0, 1] p is a vector of reals representing weights for the terms of the objective function. The objective minimizes the squared weighted L 2 -Norm ofẋ −c, where the weight λ i of element x ij −c ij is 1 m i . The optimization is subject to a set of consistency constraints among comparable features and non-negativity constraints on the variables. For each pair of features (F i , F i ) with F i ≺ F i , constraint O2 selects an element d ij ∈ F i and all its subsets d i l ∈ F i and imposes the constrainṫ which ensures that the post-processed valueẋ ij is consistent with the sum of the post-processed values of its partition in F i . By definition of sub-features, there exists a set of elements in F i whose union is equal to d ij .
Theorem9 The optimization-based post-process achieves o -differential privacy.
Proof. Since each feature partitions the w-period over the data stream, each feature query is a count query with sensitivity 1. Thus, eachc ij (i > 1) obtained from the Laplace mechanism is odifferential-private by Theorem 4 and the valuesx =c 11 , . . . ,c 1w are differential private (Theorems 7 and 8). Additionally, (c 11 , . . . ,c pmp ) is o -differential-private by Theorem 1. Finally, the result follows from post-processing immunity (Theorem 3).
Observe that the mechanisms considered in this paper all operate over the universe of the data stream in the w-period. This is the case for instance of the Laplace mechanisms which runs in polynomial time in the size of the w-period. The next theoretical result characterizes the complexity of the optimization model depicted in line (2) and hence the complexity of Algorithm 4. Recall that a δ-solution to an optimization problem is a solution whose objective value is within distance δ of the optimum. 14 OPTSTREAM: RELEASING TIME SERIES PRIVATELY Theorem10 A δ-solution to the optimization to the optimization model in line (2) (Algorithm 4) can be obtained in time polynomial in w, the number of features, and 1 δ .
Proof. First observe that the number of variables and constraints in the optimization model are bounded by a polynomial in size of the period w and the number of features p. Indeed, since the features are partitions, every set d i l in Constraint (O2) is a subset of exactly one d ij . The result then follows from the fact that the optimization model is convex, which implies that a δ-solution can be found in time polynomial in the size of the universe, the number of features, and 1 δ (Nemirovski, 2004).

Error analysis
This section analyzes how the sampling and reconstruction procedure can improve the accuracy of the output. It characterizes the error E x − x 2 2 of the results of Algorithm 2 over a w-period stream release, when the equally-spaced approach is selected as a sampling procedure and no postprocessing is applied (i.e., when the algorithm releasesx (line 8, Algorithm 2)).

Sample and Reconstruct
Consider a w-period of the data stream x using the same notational assumptions introduced in the previous period, and thus we focus in a w-period in [1, w]. Let k = |S| be the number of samples selected for measurements, by the equally-spaced sampling in addition to the initial point. This determines the length of each segment m = w/k during which the RECONSTRUCT procedure interpolates values without extra measurements. We assume m to be an even integer. Let L be the Lipschitz constant defined as L := sup t∈ [w] x t − x t−1 .

Theorem11
The error introduced by Algorithm 2 (ignoring post-processing) with the equallyspaced sampling procedure with parameter k is bounded by O m 2 L 2 w + 2 w 2 L + w 3 m 2 2 .
Proof. For notational simplicity, consider the first interval I = {1, . . . , m} of the w-period, where the sample points 1 and m are selected. Thus, x 1 and x m are measured privately. The reconstruct procedure uses linear interpolation between x 1 and x m to recover the values of the non-sampling points x 2 , . . . , x m−1 .
For each point i ∈ [m], there are two sources of error: the perturbation error e p and the reconstruction error e r . The worst-case reconstruction error is bounded by e r = mL. The perturbation error e p is the additive Laplace noise. There are k measurements taken, and hence the privacy budget must be divided by k, which results in e p = |x i − x i | = Lap(k/ ). This error adds to the perturbation error at every point in the w-period. Therefore, for all i ∈ [m], the expected error is: Multiplying this quantity by the number m of points in the interval gives As a result, the error x[I] − x[I] 2 2 is bounded by O(m 3 L 2 + 2m 2 L k + m( k ) 2 ). Multiplying the above by the number of intervals w m in the w-period gives the final error which is bounded by For m = w L , the above expression generates an error of O(w 2 L/ ). 2 In comparison, applying the Laplace mechanism to produce a private sub-stream in the w-period produces an error of 2 . The result above shows that choosing a sampling parameter k to sample uniformly every m time steps may allow Algorithm 2 to produce outputs with a substantially lower error than those obtained by the Laplace mechanism. Although this result applies to the equally-spaced sampling procedure, Section 6 demonstrates experimentally that the L1-sampling procedure outperforms its equally-spaced counterpart.

Optimization-based Post-Processing
The following result is from (Fioretto, Lee, & Van Hentenryck, 2018). It bounds the error of the optimization-based post-processing. It proves that the post-processing step can accommodate any side-constraints without degrading the accuracy of the mechanism significantly.

Theorem12
The optimal solution to the optimization model in line (9) of Algorithm 2 satisfies Proof. It follows that: where the first inequality follows from the triangle inequality on weighted L 2 -norms and the second inequality follows from by optimality of x * and the fact that x is a feasible solution to constraints (O2) and (O3).

Privacy Model Extensions
This section first presents an extension of the privacy model that protects disclosure of arbitrary quantities within the w-event privacy model. It then generalizes the theoretical results of OPT-STREAM to this extended privacy model. Finally, it describes an extension of OPTSTREAM that supports hierarchical data streams.

α-Indistinguishability for Data Streams
The application studied in this paper requires the private release of energy load consumption streams. Unlike the previous setting, where the participation of users is revealed at each time step, the new privacy setting requires the load consumption of each customer to be revealed for each time steps. To capture this requirement, the data stream setting presented in Section 2.2 is extended to an infinite sequence of elements in the data universe U = I × R × T , where I and T are defined as in Section 2.2, and R is the set of possible events (i.e., the data items generated by users). In other words, each tuple (i, r, t) describes an event that occurred at time t in which user i reported value r. Each user transmits an aggregate summary of the stream periodically (e.g., every 30 minutes) and the discrete time step k represents an aggregate (e.g., the sum or the average) of all values describing the event occurring in time period k. This setting implies that a tuple (i, r, t) describes the aggregate behavior of user i during the time period t. Here, a numerical count query Q : D → R |I| returns an |I|-dimensional vector corresponding to the aggregated reports of each user in I. The following example illustrates such behavior.
Example4 Consider a data stream system that collects power consumption data from customers of an electric company distributed on a wide geographical region. Customers may correspond to facilities (such as homes, hospitals, industrial buildings) or electrical substations, transmitting their power consumption at regular intervals (e.g., every 30 minutes). The value r t ∈ R transmitted by a customer at time t is a real number denoting the average amount of power (in MegaWatts) the customer required during time interval t. The table below represents a the scenario in which user customer 1 consumes 3.1 MW at time t = 1, 3.2 MW at time t = 2, and 2.8 MW at time t = 3. Customer identities are assumed to be a public information, as every facility consumes power. However, their load fluctuations are considered to be highly sensitive. Indeed. changes in power consumption may indirectly reveal production levels and hence strategic investments, decreases in sales, and other similar information. These changes should not be revealed within some applicationspecific period of w time steps. Thus, within each w-period, the privacy goal of the data curator is to protect observed increases or decreases of power consumptions. More precisely, consider r t u and r t u be two distinct values that may be reported by user u at time t and that satisfy |r t u − r t u | ≤ α for some positive real value α. An attacker should not be able to confidently determine that u reported value r t u instead of value r t u and vice-versa. This goal can be achieved by using a more general adjacency relation between datasets. This relation needs to capture the distance between reported quantities whose magnitudes must be protected up to some given value α > 0. The value α is called the indistinguishability level. This generalized definition of differential privacy has been adopted in several applications and has sound theoretical foundations (e.g., (Koufogiannis, Han, & Pappas, 2015;Andrés et al., 2013;Chatzikokolakis et al., 2013) 3 ). Consider a dataset X to which n individuals contribute their real-valued data r i ∈ R, i.e., X = (r 1 , . . . , r n ) ∈ R n . For α > 0, an adjacency relation that captures the indistinguishability of a single individual to the aggregating scheme is: Such adjacency definition, in our target domain, is useful to hide increases or decreases of loads up to some quantity α. The generalization of differential privacy that uses the above adjacency relation is referred to as α-indistinguishability . The w-privacy definition, introduced in Definition 2, can be extended to use αindistinguishability by replacing the standard neighboring relation between datasets with the adjacency relation defined in Equation (5). More precisely, for a given α > 0, two data streams prefixes This privacy definition combines w-event privacy (Kellaris et al., 2014) and a metric-based generalization of differential privacy  in order to meet the requirements of the motivating application. Notice that (w, α)-indistinguishability is a generalization of w-privacy, and it reduces to w-privacy when α = 1. OPTSTREAM can be naturally extended to satisfy this definition, by calibrating the noise introduced by the Laplace mechanism, used during the sampling (Theorem 6), perturbation (Theorem 8), and post-processing (Theorem 9) steps, to satisfy the above definition. More practically, it is achieved by updating the definition of query sensitivity as: Thus, in the (w, α)-indistinguishability model, the sensitivity of each query Q used during the perturb (see Section 3.2) and the post-process (see Section 3.4) procedures is ∆ Q = α, and the sensitivity ∆ L of of the queries adopted in the L1-based reconstruction procedure (see Section 3.3) is ∆ L = 2α(w − k) . The behavior of OPTSTREAM for different indistinguishability levels is presented in Section 6.

Hierarchical Data Streams
OPTSTREAM can also be generalized to support hierarchical data streams. A data stream D is called hierarchical if, for any time t, there is an aggregation entry a = (i a , r a , t) associated with an aggregation set S a ⊆ I that reports the sum of values reported by all entries in S a at time t, i.e., r a = u∈Sa r t u . More formally, a data stream is hierarchical if, for any two aggregation entries a 1 , a 2 , either S a 1 ⊂ S a 2 or S a 2 ⊂ S a 1 holds or S a 1 ∩ S a 2 = ∅ is true. 18 OPTSTREAM: RELEASING TIME SERIES PRIVATELY A set of aggregation entries S can be represented hierarchically through a tree (called an aggregation tree) in which the root is defined by the entry that is not contained in any other entries and the children of an aggregation entry p are all the entries in D whose identifiers are contained in S p . The height of a hierarchical data is the maximum path length from the root to any leaf of its tree.
Example5 In our target application, a data curator is interested in the aggregated load consumption stream at the level of a small geographical region, at a group of regions within the same electrical sub-station, and finally at the nation-level. These aggregations form a hierarchy whose root is represented by the nation-level aggregation entry, its children by the electrical sub-station entries, and the tree leaves by the region-level entries.
To answer each query of the hierarchical stream, OPTSTREAM is extended as follows. For each wperiod, the algorithm runs the sampling, perturbation, and reconstruction procedure for each level of the aggregation tree representing the hierarchical stream. Finally, the post-processing optimization takes as input the answers to all the aggregation entries queries with the set of features being equal to the set of aggregation entries. The post-processing step thus enforces consistency between the aggregation counts at a node and the sum of counts at its children nodes in the tree, in addition to the features described earlier in the paper.
Theorem13 For a hierarchy of height h, OPTSTREAM, when using a privacy budget of /h for each level of the hierarchy, satisfies -differential privacy.
The result follows from the privacy guarantee of OPTSTREAM (Theorem 1), parallel composition of differential privacy across each level of the hierarchy (Theorem 2), and sequential composition of differential privacy, for each of the h hierarchical queries (Theorem 1).

Evaluation
This section evaluates OPTSTREAM on real data streams for a number of tasks. It first evaluates the accuracy of the private release of a stream of data within the w-privacy model. Then, it studies the accuracy of each of the four individual components of the algorithm. Finally, it evaluates the algorithm within the (w, α)-indistinguishability model.

Dataset
The source data was obtained through a collaboration with Réseau de Transport d'Électricité, the largest energy transmission system operator in Europe. It consists of a one-year national-level load energy consumption data with a granularity of 30 minutes. The data is aggregated at a regional level and R denotes the set of regions. Each data point in the stream represents the total load consumption of the customers served within a region during a 30 minute time period. Thus, for every region R ∈ R, a stream of data x(R) = x 1 (R), x 2 (R), . . . is generated where x t (R) represents the energy demand to supply in order to serve the region R at time t. When the streams of all regions are aggregated, the resulting load consumption data constitutes a data stream of the energy profile at a national level.
For evaluation purposes, the experiments often consider a representative region (Auvergne -Rhône-Alpes) to analyze the data stream release. For the evaluation of hierarchical data streams, the experiments consider a hierarchical aggregation tree of height 2, where the root node is the national level and each of the leaves corresponds to one region. Table 2 lists an overview of the data streams derived from the real energy load consumption data for each French region in 2016. Each data stream contains 17,520 entires.  Algorithms The following sections evaluate two versions of OPTSTREAM, with equally-spaced sampling and with the L1-sampling. They are compared against the Laplace mechanism and the Discrete Fourier Transform (DFT) algorithm (Rastogi & Nath, 2010). All the algorithms release private data associated with the sub-streams x for each w-period.
To ensure -differential privacy for each w-period, the Laplace mechanism applies Laplace noise with parameter /w to each value in the period. To ensure -differential privacy, the DFT algorithm works as follows. For each w-period, and given a value k < w, it first computes the Fourier . It then considers the k coefficients of lowest frequencies -which represent the high-level trends in x -and perturbs them using Laplace noise with parameter √ k∆ 2Q / , where ∆ 2Q is the L 2 sensitivity of the count query. It then pads the vector of noisy coefficients with a (w − k)-dimensional vector of 0's to obtain a w-dimensional vector. Finally, it applies the Inverse Discrete Fourier Transform (IDFT) to this w-dimensional vector to obtain a noisy estimate of the elements in the w−period. In more details, iff j is the j-th perturbed coefficient of the series, the noisy estimate for the value x j is obtained through the IDFT function as: 1 w ji)f j .

Stream Data-Release in the w-Privacy Model
This section evaluates the accuracy of privately releasing a data stream within the w-privacy model. It first studies the prediction error of the algorithms. It then analyzes the accuracy of privately releasing hierarchical streams on aggregated queries. Finally, it analyzes the accuracy of forecasting tasks from the released private data streams. The experiments set the number of Fourier coefficients in the DFT and sampling steps in OPT-STREAM to 10. The privacy budget allocated to perform each measurement is split equally. Additionally, for OPTSTREAM s = p = o = 1 3 , and the L1-sampling procedure uses a threshold value θ of 1000 (which is about one tenth of the average load consumption in each region). This information was publicly revealed. Finally, OPTSTREAM uses the following feature query set F = {F 1 , F 2 , F 3 } in the optimization-based post processing step, with F 1 ≺ F 2 ≺ F 3 . F 1 is defined as described in Section 3.4; F 2 partitions each w-period in 4 sets, the intervals [0, 14), [14, 24), [24, 36), and [36, 48) that correspond to aggregated consumption for the following times of the day: [0am-7am), [7am-12pm), [12pm-6pm), and [6pm-0am) respectively. F 3 partitions each w-period in a single set, listing all the time steps within the w-period and thus describing the aggregated daily energy consumption. The query set represents salient moments in the day associated with different consumption patterns. These are proxy of consumer behaviors and thus energy consumption. Because these queries return private answers, the privacy is guaranteed by the post-processing immunity of DP (see Theorem 3). Finally, if an algorithm reports negative noisy value for a stream point, we truncate it to zero. Figure 2 clearly illustrates that, for a given privacy disclosure level, OPTSTREAM produces private streams that are more accurate than its competitors when visualized. The next paragraph quantifies the error reported by the algorithms.

AVERAGE L 1 -ERROR ANALYSIS
This section reports the average L 1 -error for each w-period produced by the algorithms. For each input data stream x R associated to a region R ∈ R (illustrated in Table 2) and each reported private streamx R , we compare the average L 1 -error defined as: 1 N R x R − x R 1 , where N R is the length of the data stream associated with region R. Figure 3 reports the average errors across all streaming regions r ∈ R for the months of February (left), June (middle), and October (right). The consumptions in these three months capture different customers load profile behaviors due to different weather patterns and durations of the day light. Each histogram reports the log 10 value of the average error of 30 random trials. Two version of OPTSTREAM (OPTSTREAMES and OPTSTREAMLS) are presented and correspond to the qqually-spaced sampling, and the L1-sampling procedures, respectively. While all algorithms induce a notable L 1 -error which increases as the privacy budget decreases, the figure highlights that OPTSTREAM consistently outperforms competitor algorithms. Additionally, OPTSTREAM with L1-sampling is found to outperform its equally-spaced sampling counterpart, especially for large privacy budgets. For small privacy budgets, the two versions of the algorithm tend to perform similarly. This is due to the fact that the L1-score becomes less accurate as the amount of noise increases.

HIERARCHICAL PRIVATE DATA-STREAM RELEASE
This section evaluates the extensions proposed in Section 5.2 for releasing aggregated queries over hierarchical data streams. We answer the following queries over contiguous w-periods for the whole duration of the stream: count queries over the data stream x(R) = x 1 (R), x 2 (R), . . . for each region R ∈ R listed in Table 2, as well as count queries x = x 1 , x 2 , . . ., where each x t = R∈R x t (R) represents the aggregated load consumption at national level. Thus, we create a hierarchy of two levels and answer simultaneously all queries. We allocate a privacy budget of 2 to each level of

February
June October Figure 4: L 1 -error analysis: Hierarchical energy load stream data for the months of February, June, and October. The y-axis reports log 10 of the average L 1 -error at national level (top) and at the regional level (bottom).
the hierarchy. OPTSTREAM is compared against the Laplace mechanism applied to each stream data, using a uniform allocation of the privacy budget ( 2 ) for each query in a different level of the stream hierarchy and the DFT algorithm which answers queries over each data stream by uniformly allocating a portion of the privacy budget at each level of the hierarchy. Figure 4 shows the results for three different months of the year: February (left), June (middle), and October (right), and under different indistinguishability parameters α for privacy budget = 1.0. The top row of the figure reports the average L 1 -errors when releasing stream data x(R) associated with each region R, while the bottom row gives the L 1 -errors when releasing the stream data x at national level. Each histogram reports the log 10 value of the average error of 30 random trials. The results illustrates similar trends to those in previous experiments. Overall, OPTSTREAM with the adaptive L1-sampling produces stream data with the lowest average L 1 -errors for both levels of the stream hierarchy. In addition to the improved error it is important to note that OPT-STREAM ensures the consistency of the values of the private stream in the hierarchy, i.e., for each time step, the reported sum of the loads across all regions equals the reported load at national level. Neither the Laplace mechanism nor DFT do ensure such property.

IMPACT OF PRIVACY ON FORECASTING DEMAND
The final results evaluate the capability of the released private streams to accurately predict future consumptions. To do so, we adopt the Autoregressive Moving Average (ARMA) model (Alwan & Roberts, 1988;Zhang, 2003;Cochrane, 2005;Hipel & McLeod, 1994). ARMA is a popular  & Roberts, 1988;Cochrane, 2005), i.e., ARMA(p, q) combines AR(p) and MA(q) and is suitable for univariate time series modeling. In an AR(p) model, the future value of a variable x t is assumed to be a linear combination of the past p observations and a random error: where c is constant, β t is a random variable modeling white noise at time t, and the φ i (i = 1, . . . , p) are model parameters. A MA(q) model uses the past q errors in the time series as the explanatory variables. It estimates a variable x t using µ + β t + q i=1 θ i β t−i , where the θ i (i = 1, . . . , q) are model parameters, µ is the expectation of x t , and the β t terms are white noise error terms. The ARMA model with parameters p and q refers to the model with p autoregressive terms and q moving-average terms: It estimates a future time step value x t as c In our experiments, we use an ARMA model with parameters p = q = 1 to estimate the future 48 time steps (corresponding to a day) when trained with the past four weeks of the private data stream estimated using Laplace, DFT, and OPTSTREAM with L1-sampling. All models use the same parameters adopted in the previous sections. Figure 5 visualizes the forecast for the load consumptions in the Auvergne-Rhône-Alpes region for February 2, 2016. The black and gray solid lines illustrates, respectively, the real load values observed so far and those of the day to be forecasted. The dotted red lines illustrates the private stream data estimated so far (and used as input to the prediction model) and the solid red lines depict the prediction obtained using the ARMA model. Figure 5 shows the forecast results using the real data (Real) and the private stream obtained through Laplace, DFT, and OPTSTREAM, respectively. The figure clearly shows that OPTSTREAM is able to visually produce better estimates for the next day forecast.
We also quantitatively evaluate the average L 1 -error for each prediction produced by the mechanisms. We adopt the same setting as above for the prediction and report, in Figure 6, the average L 1 -error for predicting each day in the month of February, June, and October for the Auvergne-Rhône-Alpes region. Each histogram reports the log 10 value of the average error of 30 random trials. We observe that OPTSTREAM reports the smallest errors compared to all other privacypreserving algorithms, and that the error made by OPTSTREAM in reporting the next day forecast is closer to the error made in the forecast prediction using the real data than when using another method.

Evaluation of OPTSTREAM Individual Components
We also evaluate the effect of the different sampling strategies as well as the benefits of the postprocessing procedure of OPTSTREAM. Figure 9 visualizes the real (first column) and OPTSTREAM-based private version (other columns) load consumption data for the Auvergne-Rhône-Alpes region in January, 2016. The top row and bottom rows illustrate results for privacy budgets of ✏ = 0.1 and 0.01, respectively.
In order from the second to the last row, Figure 9 illustrates the results of a version of OPT-STREAM that enables, exclusively the perturbation step (hP, , i), the perturbation and the optimization steps (hP, , Oi), the perturbation and the sampling steps (hP, S, i), and all steps (hP, S, Oi ). The privacy budget is divided equally among all active components of the algorithm.

Evaluation of OPTSTREAM Individual Components
We also evaluate the effect of the sampling step as well as the benefits of the post-processing procedure of OPTSTREAM. Figure 7 visualizes the real (first column) and OPTSTREAM-based private version (other columns) load consumption data for the Auvergne-Rhône-Alpes region in January, 2016. The top row and bottom rows illustrate results for privacy budgets of = 0.1 and 0.01 respectively. 25 F. FIORETTO & P. VAN HENTENRYCK hP, , i < l a t e x i t s h a 1 _ b a s e 6 4 = " f 6 r v v m q z l I Z G M k U L x N c Q K X 2 f l 3 c = " > A A A C C X i c b V D L S s N A F J 3 U V 4 2 v q E s 3 g 0 V w I S U R U Z c F N y 4 r 2 A c 0 o U y m N + 3 Q y S T M T I Q S u n X j r 7 h x o Y h b / 8 C d f + M 0 z U J b D 1 z u 4 Z x 7 m b k n T D l T 2 n W / r c r K 6 t r 6 R n X T 3 t r e 2 d 1 z 9 g / a K s k k h R Z N e C K 7 I V H A m Y C W Z p p D N 5 V A 4 p B D J x z f z P z O A 0 j F E n G v J y k E M R k K F j F K t J H 6 D v Y 5 E U M O d v M M + 5 R J W j Z s + 7 I w + k 7 N r b s F 8 D L x S l J D J Z p 9 5 8 s f J D S L Q W j K i V I 9 z 0 1 1 k B O p G e U w t f 1 M Q U r o m A y h Z 6 g g M a g g L y 6 Z 4 h O j D H C U S F N C 4 0 L 9 v Z G T W K l J H J r J m O i R W v R m 4 n 9 e L 9 P R d Z A z k W Y a B J 0 / F G U c 6 w T P Y s E D J o F q P j G E U M n M X z E d E U m o N u H Z J g R v 8 e R l 0 j 6 v e 2 7 d u 7 u o N S 7 L O K r o C B 2 j U + S h K 9 R A t 6 i J W o i i R / S M X t G b 9 W S 9 W O / W x 3 y 0 Y p U 7 h + g P r M 8 f C W + Y m Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " f 6 r v v m q z l I Z G M k U L x N c Q K X 2 f l 3 c = " > A A A C C X i c b V D L S s N A F J 3 U V 4 2 v q E s 3 g 0 V w I S U R U Z c F N y 4 r 2 A c 0 o U y m N + 3 Q y S T M T I Q S u n X j r 7 h x o Y h b / 8 C d f + M 0 z U J b D 1 z u 4 Z x 7 m b k n T D l T 2 n W / r c r K 6 t r 6 R n X T 3 t r e 2 d 1 z 9 g / a K s k k h R Z N e C K 7 I V H A m Y C W Z p p D N 5 V A 4 p B D J x z f z P z O A 0 j F E n G v J y k E M R k K F j F K t J H 6 D v Y 5 E U M O d v M M + 5 R J W j Z s + 7 I w + k 7 N r b s F 8 D L x S l J D J Z p 9 5 8 s f J D S L Q W j K i V I 9 z 0 1 1 k B O p G e U w t f 1 M Q U r o m A y h Z 6 g g M a g g L y 6 Z 4 h O j D H C U S F N C 4 0 L 9 v Z G T W K l J H J r J m O i R W v R m 4 n 9 e L 9 P R d Z A z k W Y a B J 0 / F G U c 6 w T P Y s E D J o F q P j G E U M n M X z E d E U m o N u H Z J g R v 8 e R l 0 j 6 v e 2 7 d u 7 u o N S 7 L O K r o C B 2 j U + S h K 9 R A t 6 i J W o i i R / S M X t G b 9 W S 9 W O / W x 3 y 0 Y p U 7 h + g P r M 8 f C W + Y m Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " f 6 r v v m q z l I Z G M k U L x N c Q K X 2 f l 3 c = " > A A A C C X i c b V D L S s N A F J 3 U V 4 2 v q E s 3 g 0 V w I S U R U Z c F N y 4 r 2 A c 0 o U y m N + 3 Q y S T M T I Q S u n X j r 7 h x o Y h b / 8 C d f + M 0 z U J b D 1 z u 4 Z x 7 m b k n T D l T 2 n W / r c r K 6 t r 6 R n X T 3 t r e 2 d 1 z 9 g / a K s k k h R Z N e C K 7 I V H A m Y C W Z p p D N 5 V A 4 p B D J x z f z P z O A 0 j F E n G v J y k E M R k K F j F K t J H 6 D v Y 5 E U M O d v M M + 5 R J W j Z s + 7 I w + k 7 N r b s F 8 D L x S l J D J Z p 9 5 8 s f J D S L Q W j K i V I 9 z 0 1 1 k B O p G e U w t f 1 M Q U r o m A y h Z 6 g g M a g g L y 6 Z 4 h O j D H C U S F N C 4 0 L 9 v Z G T W K l J H J r J m O i R W v R m 4 n 9 e L 9 P R d Z A z k W Y a B J 0 / F G U c 6 w T P Y s E D J o F q P j G E U M n M X z E d E U m o N u H Z J g R v 8 e R l 0 j 6 v e 2 7 d u 7 u o N S 7 L O K r o C B 2 j U + S h K 9 R A t 6 i J W o i i R / S M X t G b 9 W S 9 W O / W x 3 y 0 Y p U 7 h + g P r M 8 f C W + Y m Q = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " f 6 r v v m q z l I Z G M k U L x N c Q K X 2 f l 3 c = " > A A A C C X i c b V D L S s N A F J 3 U V 4 2 v q E s 3 g 0 V w I S U R U Z c F N y 4 r 2 A c 0 o U y m N + 3 Q y S T M T I Q S u n X j r 7 h x o Y h b / 8 C d f + M 0 z U J b D 1 z u 4 Z x 7 m b k n T D l T 2 n W / r c r K 6 t r 6 R n X T 3 t r e 2 d 1 z 9 g / a K s k k h R Z N e C K 7 I V H A m Y C W Z p p D N 5 V A 4 p B D J x z f z P z O A 0 j F E n G v J y k E M R k K F j F K t J H 6 D v Y 5 E U M O d v M M + 5 R J W j Z s + 7 I w + k 7 N r b s F 8 D L x S l J D J Z p 9 5 8 s f J D S L Q W j K i V I 9 z 0 1 1 k B O p G e U w t f 1 M Q U r o m A y h Z 6 g g M a g g L y 6 Z 4 h O j D H C U S F N C 4 0 L 9 v Z G T W K l J H J r J m O i R W v R m 4 n 9 e L 9 P R d Z A z k W Y a B J 0 / F G U c 6 w T P Y s E D J o F q P j G E U M n M X z E d E U m o N u H Z J g R v 8 e R l 0 j 6 v e 2 7 d u 7 u o N S 7 L O K r o C B 2 j U + S h K 9 R A t 6 i J W o i i R / S M X t G b 9 W S 9 W O / W x 3 y 0 Y p U 7 h + g P r M 8 f C W + Y m Q = = < / l a t e x i t > hP, , Oi < l a t e x i t s h a 1 _ b a s e 6 4 = " b p 8 K d c Y g w i f Q 3 4 I H 5 5 D C 9 G B D w z U = " > A A A C B X i c b V B N S 8 N A E N 3 4 W e N X 1 K M e F o v g o Z R E R D 0 W v H i z g v 2 A p p T N d t I u 3 W z C 7 k Y o o R c v / h U v H h T x 6 n / w 5 r 9 x m + a g r Q 8 G H u / N M D M v S D h T 2 n W / r a X l l d W 1 9 d K G v b m 1 v b P r 7 O 0 3 V Z x K C g 0 a 8 1 i 2 A 6 K A M w E N z T S H d i K B R A G H V j C 6 n v q t B 5 C K x e J e j x P o R m Q g W M g o 0 U b q O U c + J 2 L A w a 5 X s E + Z p B V 8 i 2 1 f 5 m L P K b t V N w d e J F 5 B y q h A v e d 8 + f 2 Y p h E I T T l R q u O 5 i e 5 m R G p G O U x s P 1 W Q E D o i A + g Y K k g E q p v l X 0 z w i V H 6 O I y l K a F x r v 6 e y E i k 1 D g K T G d E 9 F D N e 1 P x P 6 + T 6 v C q m z G R p B o E n S 0 K U 4 5 1 j K e R 4 D 6 T Q D U f G 0 K o Z O Z W T I d E E q p N c L Y J w Z t / e Z E 0 z 6 q e W / X u z s u 1 i y K O E j p E x + g U e e g S 1 d A N q q M G o u g R P a N X 9 G Y 9 W S / W u / U x a 1 2 y i p k D 9 A f W 5 w + + m J b D < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " b p 8 K d c Y g w i f Q 3 4 I H 5 5 D C 9 G B D w z U = " > A A A C B X i c b V B N S 8 N A E N 3 4 W e N X 1 K M e F o v g o Z R E R D 0 W v H i z g v 2 A p p T N d t I u 3 W z C 7 k Y o o R c v / h U v H h T x 6 n / w 5 r 9 x m + a g r Q 8 G H u / N M D M v S D h T 2 n W / r a X l l d W 1 9 d K G v b m 1 v b P r 7 O 0 3 V Z x K C g 0 a 8 1 i 2 A 6 K A M w E N z T S H d i K B R A G H V j C 6 n v q t B 5 C K x e J e j x P o R m Q g W M g o 0 U b q O U c + J 2 L A w a 5 X s E + Z p B V 8 i 2 1 f 5 m L P K b t V N w d e J F 5 B y q h A v e d 8 + f 2 Y p h E I T T l R q u O 5 i e 5 m R G p G O U x s P 1 W Q E D o i A + g Y K k g E q p v l X 0 z w i V H 6 O I y l K a F x r v 6 e y E i k 1 D g K T G d E 9 F D N e 1 P x P 6 + T 6 v C q m z G R p B o E n S 0 K U 4 5 1 j K e R 4 D 6 T Q D U f G 0 K o Z O Z W T I d E E q p N c L Y J w Z t / e Z E 0 z 6 q e W / X u z s u 1 i y K O E j p E x + g U e e g S 1 d A N q q M G o u g R P a N X 9 G Y 9 W S / W u / U x a 1 2 y i p k D 9 A f W 5 w + + m J b D < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " b p 8 K d c Y g w i f Q 3 4 I H 5 5 D C 9 G B D w z U = " > A A A C B X i c b V B N S 8 N A E N 3 4 W e N X 1 K M e F o v g o Z R E R D 0 W v H i z g v 2 A p p T N d t I u 3 W z C 7 k Y o o R c v / h U v H h T x 6 n / w 5 r 9 x m + a g r Q 8 G H u / N M D M v S D h T 2 n W / r a X l l d W 1 9 d K G v b m 1 v b P r 7 O 0 3 V Z x K C g 0 a 8 1 i 2 A 6 K A M w E N z T S H d i K B R A G H V j C 6 n v q t B 5 C K x e J e j x P o R m Q g W M g o 0 U b q O U c + J 2 L A w a 5 X s E + Z p B V 8 i 2 1 f 5 m L P K b t V N w d e J F 5 B y q h A v e d 8 + f 2 Y p h E I T T l R q u O 5 i e 5 m R G p G O U x s P 1 W Q E D o i A + g Y K k g E q p v l X 0 z w i V H 6 O I y l K a F x r v 6 e y E i k 1 D g K T G d E 9 F D N e 1 P x P 6 + T 6 v C q m z G R p B o E n S 0 K U 4 5 1 j K e R 4 D 6 T Q D U f G 0 K o Z O Z W T I d E E q p N c L Y J w Z t / e Z E 0 z 6 q e W / X u z s u 1 i y K O E j p E x + g U e e g S 1 d A N q q M G o u g R P a N X 9 G Y 9 W S / W u / U x a 1 2 y i p k D 9 A f W 5 w + + m J b D < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " b p 8 K d c Y g w i f Q 3 4 I H 5 5 D C 9 G B D w z U = " > A A A C B X i c b V B N S 8 N A E N 3 4 W e N X 1 K M e F o v g o Z R E R D 0 W v H i z g v 2 A p p T N d t I u 3 W z C 7 k Y o o R c v / h U v H h T x 6 n / w 5 r 9 x m + a g r Q 8 G H u / N M D M v S D h T 2 n W / r a X l l d W 1 9 d K G v b m 1 v b P r 7 O 0 3 V Z x K C g 0 a 8 1 i 2 A 6 K A M w E N z T S H d i K B R A G H V j C 6 n v q t B 5 C K x e J e j x P o R m Q g W M g o 0 U b q O U c + J 2 L A w a 5 X s E + Z p B V 8 i 2 1 f 5 m L P K b t V N w d e J F 5 B y q h A v e d 8 + f 2 Y p h E I T T l R q u O 5 i e 5 m R G p G O U x s P 1 W Q E D o i A + g Y K k g E q p v l X 0 z w i V H 6 O I y l K a F x r v 6 e y E i k 1 D g K T G d E 9 F D N e 1 P x P 6 + T 6 v C q m z G R p B o E n S 0 K U 4 5 1 j K e R 4 D 6 T Q D U f G 0 K o Z O Z W T I d E E q p N c L Y J w Z t / e Z E 0 z 6 q e W / X u z s u 1 i y K O E j p E x + g U e e g S 1 d A N q q M G o u g R P a N X 9 G Y 9 W S / W u / U x a 1 2 y i p k D 9 A f W 5 w + + m J b D < / l a t e x i t > hP, S, i < l a t e x i t s h a 1 _ b a s e 6 4 = " C Q T k X Z y A Y 6 9 7 Y e l Z 2 F x e s 0 a v h X A = " > A A A C B H i c b V B N S 8 N A E N 3 4 W e N X 1 G M v i 0 X w U E o i o h 4 L X j x W t B / Q h L L Z T t q l m 0 3 Y 3 Q i l 9 O D F v + L F g y J e / R H e / D d u 0 x y 0 9 c H A 4 7 0 Z Z u a F K W d K u + 6 3 t b K 6 t r 6 x W d q y t 3 d 2 9 / a d g 8 O W S j J J o U k T n s h O S B R w J q C p m e b Q S S W Q O O T Q D k f X M 7 / 9 A F K x R N z r c Q p B T A a C R Y w S b a S e U / Y 5 E Q M O d q O K 7 6 r Y p 0 x S 2 5 e 5 1 n M q b s 3 N g Z e J V 5 A K K t D o O V 9 + P 6 F Z D E J T T p T q e m 6 q g w m R m l E O U 9 v P F K S E j s g A u o Y K E o M K J v k T U 3 x i l D 6 O E m l K a J y r v y c m J F Z q H I e m M y Z 6 q B a 9 m f i f 1 8 1 0 d B V M m E g z D Y L O F 0 U Z x z r B s 0 R w n 0 m g m o 8 N I V Q y c y u m Q y I J 1 S Y 3 2 4 T g L b 6 8 T F p n N c + t e b f n l f p F E U c J l d E x O k U e u k R 1 d I M a q I k o e k T P 6 B W 9 W U / W i / V u f c x b V 6 x i 5 g j 9 g f X 5 A 2 W C l p 0 = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " C Q T k X Z y A Y 6 9 7 Y e l Z 2 F x e s 0 a v h X A = " > A A A C B H i c b V B N S 8 N A E N 3 4 W e N X 1 G M v i 0 X w U E o i o h 4 L X j x W t B / Q h L L Z T t q l m 0 3 Y 3 Q i l 9 O D F v + L F g y J e / R H e / D d u 0 x y 0 9 c H A 4 7 0 Z Z u a F K W d K u + 6 3 t b K 6 t r 6 x W d q y t 3 d 2 9 / a d g 8 O W S j J J o U k T n s h O S B R w J q C p m e b Q S S W Q O O T Q D k f X M 7 / 9 A F K x R N z r c Q p B T A a C R Y w S b a S e U / Y 5 E Q M O d q O K 7 6 r Y p 0 x S 2 5 e 5 1 n M q b s 3 N g Z e J V 5 A K K t D o O V 9 + P 6 F Z D E J T T p T q e m 6 q g w m R m l E O U 9 v P F K S E j s g A u o Y K E o M K J v k T U 3 x i l D 6 O E m l K a J y r v y c m J F Z q H I e m M y Z 6 q B a 9 m f i f 1 8 1 0 d B V M m E g z D Y L O F 0 U Z x z r B s 0 R w n 0 m g m o 8 N I V Q y c y u m Q y I J 1 S Y 3 2 4 T g L b 6 8 T F p n N c + t e b f n l f p F E U c J l d E x O k U e u k R 1 d I M a q I k o e k T P 6 B W 9 W U / W i / V u f c x b V 6 x i 5 g j 9 g f X 5 A 2 W C l p 0 = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " C Q T k X Z y A Y 6 9 7 Y e l Z 2 F x e s 0 a v h X A = " > A A A C B H i c b V B N S 8 N A E N 3 4 W e N X 1 G M v i 0 X w U E o i o h 4 L X j x W t B / Q h L L Z T t q l m 0 3 Y 3 Q i l 9 O D F v + L F g y J e / R H e / D d u 0 x y 0 9 c H A 4 7 0 Z Z u a F K W d K u + 6 3 t b K 6 t r 6 x W d q y t 3 d 2 9 / a d g 8 O W S j J J o U k T n s h O S B R w J q C p m e b Q S S W Q O O T Q D k f X M 7 / 9 A F K x R N z r c Q p B T A a C R Y w S b a S e U / Y 5 E Q M O d q O K 7 6 r Y p 0 x S 2 5 e 5 1 n M q b s 3 N g Z e J V 5 A K K t D o O V 9 + P 6 F Z D E J T T p T q e m 6 q g w m R m l E O U 9 v P F K S E j s g A u o Y K E o M K J v k T U 3 x i l D 6 O E m l K a J y r v y c m J F Z q H I e m M y Z 6 q B a 9 m f i f 1 8 1 0 d B V M m E g z D Y L O F 0 U Z x z r B s 0 R w n 0 m g m o 8 N I V Q y c y u m Q y I J 1 S Y 3 2 4 T g L b 6 8 T F p n N c + t e b f n l f p F E U c J l d E x O k U e u k R 1 d I M a q I k o e k T P 6 B W 9 W U / W i / V u f c x b V 6 x i 5 g j 9 g f X 5 A 2 W C l p 0 = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " C Q T k X Z y A Y 6 9 7 Y e l Z 2 F x e s 0 a v h X A = " > A A A C B H i c b V B N S 8 N A E N 3 4 W e N X 1 G M v i 0 X w U E o i o h 4 L X j x W t B / Q h L L Z T t q l m 0 3 Y 3 Q i l 9 O D F v + L F g y J e / R H e / D d u 0 x y 0 9 c H A 4 7 0 Z Z u a F K W d K u + 6 3 t b K 6 t r 6 x W d q y t 3 d 2 9 / a d g 8 O W S j J J o U k T n s h O S B R w J q C p m e b Q S S W Q O O T Q D k f X M 7 / 9 A F K x R N z r c Q p B T A a C R Y w S b a S e U / Y 5 E Q M O d q O K 7 6 r Y p 0 x S 2 5 e 5 1 n M q b s 3 N g Z e J V 5 A K K t D o O V 9 + P 6 F Z D E J T T p T q e m 6 q g w m R m l E O U 9 v P F K S E j s g A u o Y K E o M K J v k T U 3 x i l D 6 O E m l K a J y r v y c m J F Z q H I e m M y Z 6 q B a 9 m f i f 1 8 1 0 d B V M m E g z D Y L O F 0 U Z x z r B s 0 R w n 0 m g m o 8 N I V Q y c y u m Q y I J 1 S Y 3 2 4 T g L b 6 8 T F p n N c + t e b f n l f p F E U c J l d E x O k U e u k R 1 d I M a q I k o e k T P 6 B W 9 W U / W i / V u f c x b V 6 x i 5 g j 9 g f X 5 A 2 W C l p 0 = < / l a t e x i t > hP, S, Oi < l a t e x i t s h a 1 _ b a s e 6 4 = " B 4 s z y b W q F 1 s O 5 g o Z Z z I a O 3 E 6 7 P Q = " > A A A C A H i c b V B N S 8 N A E J 3 U r x q / o h 4 8 e F k s g o d S E h H 1 W P D i z Y q 2 F Z p Q N t t N u 3 S z C b s b o Z R e / C t e P C j i 1 Z / h z X / j N s 1 B W x 8 M v H 1 v h p 1 5 Y c q Z 0 q 7 7 b Z W W l l d W 1 8 r r 9 s b m 1 v a O s 7 v X U k k m C W 2 S h C f y I c S K c i Z o U z P N 6 U M q K Y 5 D T t v h 8 G r q t x + p V C w R 9 3 q U 0 i D G f c E i R r A 2 U t c 5 8 D k W f U 7 t R h X d V d G N 7 c v 8 3 X U q b s 3 N g R a J V 5 A K F G h 0 n S + / l 5 A s p k I T j p X q e G 6 q g z G W P X i S t 0 5 r n 1 r z b s 0 r 9 v I i j D I d w B C f g w Q X U 4 R o a 0 A Q C E 3 i G V 3 i z n q w X 6 9 3 6 m L W W r G J m H / 7 A + v w B I z i U x w = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " B 4 s z y b W q F 1 s O 5 g o Z Z z I a O 3 E 6 7 P Q = " > A A A C A H i c b V B N S 8 N A E J 3 U r x q / o h 4 8 e F k s g o d S E h H 1 W P D i z Y q 2 F Z p Q N t t N u 3 S z C b s b o Z R e / C t e P C j i 1 Z / h z X / j N s 1 B W x 8 M v H 1 v h p 1 5 Y c q Z 0 q 7 7 b Z W W l l d W 1 8 r r 9 s b m 1 v a O s 7 v X U k k m C W 2 S h C f y I c S K c i Z o U z P N 6 U M q K Y 5 D T t v h 8 G r q t x + p V C w R 9 3 q U 0 i D G f c E i R r A 2 U t c 5 8 D k W f U 7 t R h X d V d G N 7 c v 8 3 X U q b s 3 N g R a J V 5 A K F G h 0 n S + / l 5 A s p k I T j p X q e G 6 q g z G W P X i S t 0 5 r n 1 r z b s 0 r 9 v I i j D I d w B C f g w Q X U 4 R o a 0 A Q C E 3 i G V 3 i z n q w X 6 9 3 6 m L W W r G J m H / 7 A + v w B I z i U x w = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " B 4 s z y b W q F 1 s O 5 g o Z Z z I a O 3 E 6 7 P Q = " > A A A C A H i c b V B N S 8 N A E J 3 U r x q / o h 4 8 e F k s g o d S E h H 1 W P D i z Y q 2 F Z p Q N t t N u 3 S z C b s b o Z R e / C t e P C j i 1 Z / h z X / j N s 1 B W x 8 M v H 1 v h p 1 5 Y c q Z 0 q 7 7 b Z W W l l d W 1 8 r r 9 s b m 1 v a O s 7 v X U k k m C W 2 S h C f y I c S K c i Z o U z P N 6 U M q K Y 5 D T t v h 8 G r q t x + p V C w R 9 3 q U 0 i D G f c E i R r A 2 U t c 5 8 D k W f U 7 t R h X d V d G N 7 c v 8 3 X U q b s 3 N g R a J V 5 A K F G h 0 n S + / l 5 A s p k I T j p X q e G 6 q g z G W P X i S t 0 5 r n 1 r z b s 0 r 9 v I i j D I d w B C f g w Q X U 4 R o a 0 A Q C E 3 i G V 3 i z n q w X 6 9 3 6 m L W W r G J m H / 7 A + v w B I z i U x w = = < / l a t e x i t > < l a t e x i t s h a 1 _ b a s e 6 4 = " B 4 s z y b W q F 1 s O 5 g o Z Z z I a O 3 E 6 7 P Q = " > A A A C A H i c b V B N S 8 N A E J 3 U r x q / o h 4 8 e F k s g o d S E h H 1 W P D i z Y q 2 F Z p Q N t t N u 3 S z C b s b o Z R e / C t e P C j i 1 Z / h z X / j N s 1 B W x 8 M v H 1 v h p 1 5 Y c q Z 0 q 7 7 b Z W W l l d W 1 8 r r 9 s b m 1 v a O s 7 v X U k k m C W 2 S h C f y I c S K c i Z o U z P N 6 U M q K Y 5 D T t v h 8 G r q t x + p V C w R 9 3 q U 0 i D G f c E i R r A 2 U t c 5 8 D k W f U 7 t R h X d V d G N 7 c v 8 3 X U q b s 3 N g R a J V 5 A K F G h 0 n S + / l 5 A s p k I T j p X q e G 6 q g z G W P X i S t 0 5 r n 1 r z b s 0 r 9 v I i j D I d w B C f g w Q X U 4 R o a 0 A Q C E 3 i G V 3 i z n q w X 6 9 3 6 m L W W r G J m H / 7 A + v w B I z i U x w = = < / l a t e x i t > In order from the second to the last row, Figure 7 illustrates the results of a version of OPT-STREAM that enables only the perturbation step ( P, •, • ), the perturbation and the optimization steps ( P, •, O ), the perturbation and the sampling steps ( P, S, • ), and all steps ( P, S, O ). The privacy budget is divided equally among all active components of the algorithm. When only the perturbation step is enabled (second column), OPTSTREAM has the same behavior of the Laplace mechanism. The addition of the optimization step (third column) helps increasing the fidelity of the data stream reported (for instance, the heavy peaks are less pronounced), although the overall signal is still noisy. When the perturbation step is combined with the sampling step under the L1 reconstruction procedure (fourth column), the resulting private stream captures with much higher fidelity the salient load peaks and the streams looks much more similar to the real one. However, a careful inspection reveals several shortcomings: Several load peaks are not captured accurately, and the loads are often distributed uniformly between sampled points, making the resulting stream unrealistic. Finally, the optimization-based post-processing shines when integrated with the perturbation and sampling steps (5-th column). The salient features of the data are effectively captured and the noise redistribution provides higher resemblance to the real data stream. Figure 8 details the L1-errors associated with the private energy loads for the months of February, June, and October. This quantitative analysis further highlights the importance of the four components of the proposed OPTSTREAM algorithm. It illustrates a gradual error reduction of the framework when it adopts, in order, the perturbation step only, the perturbations and the optimization steps, the perturbation and the sampling with linear interpolation steps, and finally, all four steps.

Stream Data-Release in the (w, α)-Indistinguishability Model
Having analyzed the algorithms in the w-privacy setting, this section illustrates the results of the private data streams released under the combined w-event and α-indistinguishability models (see Section 5.1). The motivating application requires releasing the private data streams without disclosing chosen amounts of load changes within a time window. We thus analyze the results of privately releasing a stream of data under the (w, α)-indistinguishability model and use an adapted version of OPTSTREAM, the Laplace mechanism, and the DFT algorithm. These versions recalibrate the Figure 9: Real load consumption data for the Auvergne-Rhône-Alpes region in January 2016, and its private versions obtained using Laplace, DFT, and OPTSTREAM with privacy budget = 1 and α = 10 (top), 50 (middle), and 100 (bottom). Figure 9 illustrates the real and private versions of the data stream for w-periods of size 48 (i.e., one day) given privacy budget of = 1 and indistinguishability parameter α = 10 (top row), α = 50 (middle row) and α = 100 (bottom row). Recall that the choice of the indistinguishability parameter α allows the data curator to ensure the protection of the observed increase/decrease power consumption up to α MegaWatts (MW), while the w-period specifies the length of the obfuscation period. The figure compares our proposed OPTSTREAM algorithm against the Laplace mechanism and DFT .
For DFT and OPTSTREAM, the experiments set the number of Fourier coefficients and sampling steps to 10 (when α ≤ 50) and 5 (when α = 100). As in the previous experiments, the privacy budget allocated to perform each measurement is divided equally. Finally, OPTSTREAM uses the same feature query set F used in the previous experiments. Figure 9 clearly illustrates that OPTSTREAM produces private streams that are more accurate than its competitors when visualized. This is especially evident for high indistinguishability parameters, when the Laplace mechanism can barely preserve any signal from the original data.
We now report the L 1 -errors averaged for each w-period produced by the algorithms. Figure 10 reports the average results for each streaming region for the months of February, June, and October, at varying of the indistinguishability parameter α = {10, 50, 100} given a privacy budget = 1.0.

February
June October Figure 10: L 1 -error analysis: Energy load stream data for the months of February, June, and October. The y-axis reports log 10 errors averaged across the L 1 errors for each stream data R ∈ R.
Each histogram reports the log 10 value of the average error of 30 random trials. While all algorithms induce an L 1 -error which increases as the indistinguishability level α increases, the figure highlights that OPTSTREAM consistently outperforms the other algorithms.

Discussion
One of the core advantages of the w-privacy model is that it provides flexibility regarding the size of the time frame to protect. OPTSTREAM exploits this flexibility to select a small set of representative points to sample and performs additional optimization over such values to redistribute noise and enhance accuracy. Practically, this means that the data stream needs to be batched in periods of w times steps, each of which is privately released at once.
Recall that the privacy model adopted in this paper combines the w-privacy model (Kellaris et al., 2014) with the definition of α-indistinguishability . The resulting (w, α)-indistinguishability model allow us to protect events related to quantities which are not directly related to user identities but can be used a proxy to disclose a secret (e.g., a sensitive information) about a user. For instance, in our application domain, it is important to both protect the given stream from inferences about load increases or decreases-which are typically related to sensitive user activities-while also protecting the stream in an entire day.
While setting w = 1 would allow to use OPTSTREAM to release the stream data online -without requiring batching -, this setting offers no room for OPTSTREAM to improve accuracy, since it would be similar to the Laplace mechanism. To the best of our knowledge, the only available algorithm that can release a private data stream online is PeGaSus (Chen et al., 2017). It uses a combination of the Laplace mechanism, a partitioning strategy to group values in contiguous time steps whose deviation is small, and a smoothing function. PeGaSus, was not introduced in the w-event model as it focuses on protecting data in a single time-step.
Despite the fact that the two algorithms were designed for solving different problems, we adapted PeGaSus to the w-privacy model and to satisfy the (w, α)-indistinguishability and compare it against OPTSTREAM for completeness. Figure 11 illustrates a comparison of the algorithms on privately releasing load streams for the Auvergne-Rhône-Alpes region in January 2016. The real 28 heavy-hitters on data streams while preserving differential privacy even if the internal memory of the algorithms is observed by an attacker. Kellaris et al. (2014) proposed the notion of w-event privacy to balance event-level and user-level privacy, trading off utility and privacy to protect event sequences within a time window of w time steps. OPTSTREAM applies to the last model.
Within the differential privacy proposal for data streams that fit such model, Wang, Zhang, Lu, Wang, Qin, and Ren (2016) proposed Rescue DP, which is designed explicitly for spatiotemporal traces. PeGaSus (Chen et al., 2017) is another seminal work that allows to protect event privacy using a combination of perturbation, partitioning, and smoothing. The algorithm uses a combination of Laplace noise to perturb the data stream for privacy, a grouping strategy which incrementally partitions the space of observed data points by grouping points with small deviations, and a smoothing schema which is used to post-process the private data stream. Both algorithms rely on the idea of contiguous grouping time steps and average the perturbed data within every region in a group. We compared OPTSTREAM against PeGaSus, which is the state-of-the-art on private data-stream release and has been showed to be effective in several settings. Rastogi and Nath (2010) proposed an algorithm which perturbs a small number of Discrete Fourier Transform (DFT) coefficients of the entire time series and reconstructs a released version of the Inverse DFT series. While, in the original paper, the algorithm requires the entire time-series, such approach has been used for w-event privacy in the context of data streams (Fan & Xiong, 2014). We also compare OPTSTREAM against DFT. Fan, Xiong, and Sunderam (2013) proposed Fast, an adaptive algorithm for private release of aggregate statistics which uses a combination of sampling and filtering. Their algorithm is based on user-level differential privacy, which is not comparable to the chosen model of w-event level differential privacy. Additionally, in their work, the authors compare the proposed approach against DFT (Rastogi & Nath, 2010) and, while showing improvements, the error remains within the same error magnitude of those produced by DFT. In contrast, our experimental analysis (Section 6) clearly illustrates that OPTSTREAM reduces the error of one order of magnitude when compared to DFT.
Finally, Chan et al. (2011) focused on releasing prefix-sums of the streaming data counts while adopting an event-based privacy model. Bolot et al. (2013) also used an event-based model and proposed an algorithm for answering sliding window queries on data streams. The model adopted in their work is however incompatible with the privacy model adopted in this work, and hence we did not compare against such approaches.

Conclusions
This paper presented OPTSTREAM, a novel algorithm for privately releasing stream data in the w-event privacy model. OPTSTREAM is a 4-step procedure consisting of sampling, perturbation, reconstruction, and post-processing modules. The sampling module selects a small set of data points to measure privately in each period of interest. The perturbation module injects noise to the sampled data points to ensure privacy. The reconstruction module reconstructs the data points excluded from measurement from the perturbed sampled points. Finally, the post-processing module uses convex optimization over the private output of the previous modules, along with the private answers of additional queries on the data stream, to ensure consistency of quantities associated with salient features of the data. OPTSTREAM was evaluated on a real dataset from the largest transmission operator in Europe. Experimental results on multiple test cases show that OPTSTREAM improves the accuracy of the state-of-the-art by at least one order of magnitude in this application domain. The accuracy improvements are measured, not only in terms of the error distance to the original stream but also in the accuracy of a popular load forecasting algorithm trained on private data sub-streams. The results additionally show that OPTSTREAM exhibits similar benefits on hierarchical stream data which is also highly desirable in practice. Finally, the experimental analysis has demonstrated that both the adaptive sampling and post-processing optimization are critical in obtaining strong accuracy. Future work will be devoted to generalizing these results to the streaming setting where a data element is emitted at each time step.