dataesr/scientific-paragraphs-categorization huggingface dataset:
Backgrounds In this section, we introduce some notations, problematic and backgrounds necessary for the presentation of the VCNet architecture in the next section. Let X ⊆ R p represents the p-dimensional feature space and l ≥ 2 a number of classes. A training dataset, denoted D = {(x i , y i )} n i=1 , is such that x i ∈ X and y i ∈ {1,. , l} for each i ∈ {1,. , n}. For a new example x, the prediction consists in deciding to which class ŷ the example x belongs. For more generality, we consider probabilistic prediction: the prediction is a probability vector, denoted p ∈ [0, 1] p. Then, the predicted class is the most likely class according to p. The counterfactual generation yields an example x which is close to x and whose prediction ŷ is different from ŷ in case the counterfactual is valid.
Experiments and Results Our experiments are organized in four steps. Our main objective is to show that VCNet generates counterfactuals that are both valid (counterfactuals actually belong to another class) and realistic (counterfactuals are close to examples of the same class). In the first set of experiments, we present results of a cVAE on a synthetic dataset to confirm the actual disentanglement of the content and the class. These experiments also aim at providing some intuition about the reason why VCNet works. In the second set of experiments, we compare the results of VCNet with CounterNet, the state-of-the-art algorithm for self-explainable counterfactual generation. The reader interested in the results of more counterfactual generation systems may refer to the original article of Guo et al.
[9]. Our experiments use the same datasets and data preprocessing. In the third experiment, we evaluate the impact of join training on the quality of counterfactuals. We propose a post-hoc version of our framework and compare the results obtained with the jointly trained VCNet. Finally, we present some qualitative experiments on the MNIST dataset. We choose to present experiments on MNIST firstly because it has been widely used in the field of counterfactual generation and, secondly, because it illustrates that VCNet may be applied on different types of data (tabular, images, time series,. ). The hyperparameters and architectures of the models used in these experiments are detailed in Supplementary material. The code to reproduce the results of this section is also provided in supplementary material.
cVAE for counterfactual generation Our proposal is based on using a cVAE to generate counterfactuals. It relies on the capability of a cVAE to actually disentangle the class and its content such that the decoder can be used to generate counterfactual examples by changing the class conditioning. In this experiment, we generate a synthetic dataset of examples in R 8 with three classes. Each class is distributed according to a multidimensional Gaussian distribution (see Figure  2.
on the left). A cVAE, i. e. a couple of an encoder ϕ(x, c) and a decoder ψ(z, c), is trained on a set of 10k examples. The complete code of these experiments is available in supplementary material for the sake of reproducibility. Figure  2  illustrates the capability of a cVAE to generate realistic examples when changing the class that conditions the decoder. The figure on the left illustrates the dataset. Each colored group of point corresponds to a class. The three figures on the right illustrate datasets that have been generated x = ψ(ϕ(x, c), c ) where x is an example from the test that belongs to class c (origin class). Each figure corresponds to one origin class, the colors of the point correspond to the conditioning class (c ). We observe that all figures look similar. This means that taking ψ(ϕ(x, c), c ) generates an example that looks similar to an example of class c whatever the origin class of x.
Comparison between VCNet and CounterNet This section compares the quality of counterfactuals of VCNet against CounterNet. We conduct evaluations on six binary-classification datasets with various properties: Adult  [14] , HELOC  [8] , OULAD  [15] , Breast Cancer Wisconsin  [3] , Student performance  [4]  and Titanic  [11]. Some of these datasets contain only numerical variables but some others, such as Adult, contain both numerical and categorical variables. More details about the datasets can be found in the supplementary material of the article. To evaluate the counterfactual quality, we used the following four metrics that are classical in the literature. Prediction gain: The prediction gain is given by the difference between the predicted probability of the counterfactual x and the predicted probability of the example x, according to the counterfactual class  [20].
The insight behind this metric is that the counterfactual should be close to an existing example of the same predicted class relative to the rest of the data. Note that to be evaluated, this metric requires a set of m examples X ∈ R m×p. For each dataset, we choose a random sample of size 25% for counterfactual generation. Then, we compute the mean and standard deviation of each metric for every selected random sample. Table  1  provides results of VCNet and CounterNet  [9]. More information on the reproducibility of CounterNet results is available in Supplementary material. It is worth noting that Table  1  contains additional results for post-hoc VCNet that will be discussed in Section 5. 3. Counterfactual quality: VCNet achieves perfect validity for 4 of the 6 datasets, and a lower validity of respectively 4.
5% and 7. 5% for the 2 other datasets (Student and Titanic) compared to CounterNet. As far as prediction gain and proximity score are concerned, VCNet outperforms CounterNet for all the 6 datasets. The higher the prediction gain, the more confidence one can have in the prediction related to the class change of the counterfactual. At the same time, a low proximity score reflects the achievement of counterfactuals that are close to real examples belonging to the same class as predicted for the counterfactual. For the last evaluated metric that is proximity, we observe that VCNet achieves higher values than CounterNet on 5 of the 6 datasets. A larger proximity value means that the counterfactuals are obtained at the cost of larger changes in the input space. Predictive accuracy: Both CounterNet and VCNet are self-explainable models, and if the previous results show that VCNet generates better counterfactuals, it can not be at the expense of the prediction accuracy.
Qualitative results on MNIST dataset We evaluated VCNet on the MNIST dataset 4  with metrics suggested in Section 5. 2. This experiment illustrates that VCNet is adaptable to several types of data including image datasets. As CounterNet was not applied to image data in the original paper, we do not offer a comparison with this model here. This avoids a poor adaptation of CounterNet and an unfair comparison. VCNet gives a mean validity of 0. 99, a mean prediction gain of 0. 98 and an accuracy of 0. 98. The counterfactual quality metrics on MNIST show that VCNet is a good model to generate realistic and valid counterfactuals and, at the same time, to make accurate predictions. These results suggest that VCNet has also good capabilities to generate counterfactuals for images, and not only for tabular data.
We conclude that VCNet generates valid and realistic counterfactuals. The VCNet counterfactuals are realistic in the sense that they are close to existing examples of the same predicted class (VCNet has better proximity scores than CounterNet) and also the result of a higher confidence in the class change (VCNet has better prediction gains than CounterNet). Finally, VCNet is simple to train because the training procedure is not based on counterfactuals directly, but on the disentanglement of the class and the content of examples by the cVAE. It allows proposing a simple optimisation procedure which makes our approach easier to put in practice. This is illustrated by its successful application to a dataset of images. In addition, it is also assessed in terms of model accuracy. Our experiments show that our join-training approach keeps its competitive prediction performance against CounterNet.
B Implementation Details B. 1 VCNet Details We choose a binary cross entropy loss as the reconstruction error for the cVAE part and a cross entropy loss for the predictor part. We apply a grid search to tune hyperparameters that are specific for each datasets, these values are report in Table  3. We used an Adam optimizer for every dataset. Table  4  describe the model architecture for every dataset. It contains the dimensions for each block of VCNet. For example, with the adult dataset, the shared encoding transforms an example x i of size 29 into a vector h i of size 15. Then the encoder of the cVAE part takes a concatenation of h i and the prediction vector pi to produce a vector of size 16. This vector is transform by the encoder to a lower representation of size 8 and finally a vector of size 5.
I. INTRODUCTION O VER the past decade, the pervasive usage of smart de- vices and location-tracking systems has made it possible to study and understand human mobility at unprecedented scales. A number of studies based on measurements from millions of data subjects have repeatedly demonstrated that human mobility is highly regular  [5]  and predictable  [30] , as people tend to follow the same patterns over and over, and they do so in ways that are clearly periodic. Regularity is easily found in the both spatial and temporal dimensions of the movements of most individuals. As an example, let us consider Fig. 1 , which shows heatmaps of the locations visited by three random users in our reference dataset (presented later in Section III-A). Although these plots summarize three weeks of data, a small set of frequently visited places emerges for all users, along with systematic paths connecting them.
III. SAMPLING INDIVIDUAL MOBILITY FOR TRAJECTORY RECONSTRUCTION We aim at answering the question "at what frequency should one periodically sample individual human movements so that they can be reconstructed from the collected samples with minimum loss of information?". We approach the question in a systematic way, using a reference dataset collected by volunteers in several countries through diverse initiatives as presented in Section III-A. We first perform a spectral analysis of such data, in Section III-B: by considering human movements as a signal in time and studying its spectrum in frequency, we observe the absence of low sampling frequencies that can capture a large portion of the human mobility. Next, in Section III-C, we refine the result via an extensive quantitative investigation of the exact trade-off between the sampling frequency and the quality of the recorded movement.
A. REFERENCE DATASET In this study, we employ a dataset of real-world individual mobility data collected from three different initiatives. [4]. It consists of GPS trajectories recorded through different GPS loggers and smartphone applications. Although sample rates vary significantly across users and time periods, the vast majority of Geolife positioning data is recorded at intervals from one to five seconds. Geolife traces are publicly available at the official project website 3. In order to build a consistent reference dataset, we first homogenize the GPS trajectory data from the three sources above. Specifically, we segment the mobility traces of all users into one-week trajectories and analyze them separately, under the rationale that human activities have been shown to have a weekly periodicity  [28] ,  [29]  hence weekly logs let us capture most of the regularity of human mobility.
These weekly trajectories have heterogeneous quality in terms of completeness of the mobility information, and many feature relatively long periods with missing or erroneous data: we thus filter the trajectories, retaining only those that contain 1 https://macaco. inria. fr/macacoapp/. 2 https://www. openstreetmap. org. 3 https://www. microsoft. com/en-us/research/project/ geolife-building-social-networks-using-human-location-history/. complete GPS records in at least six out of seven distinct weekdays. As a result, our reference dataset is composed of 1,052 weeks of the mobility of 119 different individuals, which cover sensibly different geographical spans and can encompass a single city or multiple continents. Tab. 1 provides a break down of the number of users and trajectories on a persource basis.
Fig. 4 (a)-(c) give further detail, portraying the distribution of the number of weekly trajectories associated to a particular user, separately for each data collection initiative. The plots show that the vast majority of users contribute one to ten weeks of movement data, hence ensuring that the data is representative of a fairly diverse base of individuals. Also, our dataset contains 4 weeks of data on average for each individual and up to 48 weeks for a single user: these observation periods are long enough that the data of a single individual often captures irregular patterns due to nonperiodic endeavours of the user. It is to be noted that the sampling periodicity in the retained weeks is not uniform. Despite the filtering on completeness, the different techniques employed to collect the GPS positioning information lead to uneven recording intervals across, and even within, the original data sources.
In addition to this, weekly trajectories may have minor temporal gaps due to offline GPS receivers, or interruptions in the data collection service. Fig. 4d  shows the Cumulative Distribution Function (CDF) of the sampling intervals observed in all one-week trajectories of our reference dataset. In 95% of cases, consecutive positioning samples are collected within 10 minutes from each other; in the case of the OSM and GeoLife sources, 90% to 95% of points are less than 10 seconds apart, as highlighted in Fig. 4e. In all cases, the sampling intervals above appear sufficient to capture well human movements on a weekly basis, and allow for a reliable approximation of the time-continuous mobility via a simple linear space-time interpolation on the available location samples. We then resample all interpolated trajectories with the same frequency, i.
Based on the spectra, we make two important remarks: (i) the hundreds of very diverse trajectories in our dataset all yield spectra with very similar shapes; (ii) the spectral shapes do not show evidence of a bandwidth threshold beyond which the signal power becomes clearly negligible, i. e. they do not identify a clear operational point for effective sampling. We can explain both these phenomena by considering that the unidimensional movement signals typically feature constant values linked by very steep transitions and deep spikes, as exemplified in Fig. 5 : capturing such a behavior requires a near-infinite bandwidth, which results in spectra with a slow decay for high frequencies. In other words, although it exhibits a clear periodicity  [30] , human mobility is, in fact, a succession of long periods where individuals are almost static, with fast transitions between important locations  [33].
1) Measuring error in reconstructed trajectories We first create downsampled versions of the one-week trajectories in our reference dataset, using a wide range of sampling intervals, from 10 minutes to 12 hours. We then reconstruct complete trajectories from their retained sample by linearly interpolating such points. Finally, we assess how such time-continuous downsampled trajectories compare to the original ones: specifically, we measure the error in retrieving the individual trajectory from sampled data via the average Haversine distance. Given two points on Earth surface, p a = (φ a , λ a ) and p b = (φ b , λ b ), their Haversine distance is computed as H(p a , p b ) = R • 2 • atan2 √ θ, (1 -θ). (3) Here, atan2 is a well-known function that returns a unambiguous phase value in Cartesian to polar coordinates conversion, and θ = sin 2 (∆ φ /2) + cos(λ a ) • cos(φ b ) • sin 2 (∆ λ /2), where ∆ φ = φ b -φ a , and ∆ λ = λ b -λ a.
Also, R = 6, 371 km is the Earth radius. The average Haversine distance of two (original and downsampled) trajectories is the mean of all Haversine distances between each original sample and its counterpart, i. e. the sample associated to the same timestamp, in the downsampled trajectory. 2) Linear relationship of sampling frequency and error In the following, we report results aggregated on a per-user basis, since we find all trajectories of a same individual to yield very similar properties. Also, while we show in detail the results of a few representative users, all individuals in our reference datasets exhibit similar behaviors. Fig. 9  shows the evolution of the average Haversine error against the sampling interval for a choice of eight individuals. Each plot presents results for all of the one-week trajectories of one person: as multiple weekly trajectories are aggregated in every plot, we outline the mean (dots), 25-75% quantiles (dark blue region), and 10-90% quantiles (light blue region) of the error, i.
e. average Haversine distance, measured over all trajectories of the user. Remarkably, a neat linear relationship characterizes all plots. Indeed, a simple linear model H = α • T = α/f, (4) fits very well the mean error, as shown by the solid lines in Fig. 9. In (4), H is the average Haversine distance between the original and downsampled trajectories, T is the sampling interval, and f is its reciprocal, i. e. the sampling frequency. The result holds for all individuals in our dataset, as proven in Fig. 10a. The plot portrays the CDF, computed over all users, of the Root Mean Square Error (RMSE) between the linear fitting (i. e. the solid line in Fig. 9 ) and the mean Haversine distance at different sampling intervals (i. e. dots in Fig. 9 ); in other words, the RMSE quantifies the accuracy of the linear approximation in representing how the distance varies with the sampling frequency.
When looking at the value of α, we remark that it is not identical across users: the plots in Fig. 9  also report the equation of the linear fit, and we can note some diversity in the values. The heterogeneity of α in our complete dataset is illustrated in Fig. 10b , which displays the CDF of the error-sampling ratio associated to all our user base. Over 98% of users have slopes uniformly distributed between 1 and 6 m/min. Hence, for the vast majority of individuals, the inaccuracy of their recorded trajectory grows by 1 to 6 meters for each minute added to their movement sampling interval. All the results presented above are derived based on our reference dataset of over 1,000 weeks of mobility of 119   different users. While the linear relationship of the sampling interval and accuracy of the reconstructed trajectory yields in all of the considered cases, we cannot generalize our conclusions beyond the dataset we have access to.
More formally, the concept underpinning DuctiLoc is that the knowledge of the α value that characterizes the mobility of a given individual is sufficient to estimate the sampling frequency needed to achieve a given localization error. Indeed, a sampling frequency f * =α/ H * shall grant a target average error H * , according to (4). Several important remarks are in order, as follows. • Given the high heterogeneity of α values observed in Fig. 10b , the relationship above allows adapting the sampling rate to the mobility habits of each individual in a significant way: for instance, the same localization accuracy can be achieved by sampling the position of volunteers in our dataset at a frequency that can vary sixfold, with obvious implications on the possible energy and resource savings for users whose mobility is characterized by lower α values.
A. DUCTILOC DESIGN The operation of our location sampling technique is outlined in Alg. 1. DuctiLoc receives as input the target localization error H * , which is the system parameter controlling the desired accuracy of the sampled trajectory; it also needs the value of the user-specific error-sampling ratio α, as defined in Section III-C2. Algorithm 1: DUCTILOC pseudocode input: H * , α 1 T max ← H * /α 2 do 3 (φ, λ, v) ← samplePosition 4 updateLocation (φ, λ) 5 v ← (1 -γ) • v + γv 6 T next ← H * /v 7 T ← min {T next , T max } 8 sleep (T ) 9 while (1) The algorithm first computes T max (line 1), i. e. the maximum time interval between any two sampling events. According to our previous discussion, we set T max = 1/f * , i. e. T max = H * /α, since this guarantees an average localization error H *.
2) Warm start The cost of the cold start mode can be avoided if minimal information about the mobility of the user is available when DuctiLoc is first run. The warm start mode takes advantage of the fact that α can be inferred from high-level historical statistics on the movement patterns of an individual. Tab. 2,  computed on all users in our reference dataset, shows that the value of α correlates well with a range of features that have been largely used in the literature to characterize individual movement patterns. The Pearson's correlation coefficients are especially high for features that capture the breadth of movements of a person, i. e. the radius of gyration, number of visited locations, or area of the convex hull of visited locations: this implies that individuals who have more varied mobility incur an average localization error that grows faster under a sparser sampling.
The library internally relies on the Google Fused Location Provider to obtain location samples from the Android OS. Once DuctiLoc obtains a new location, it saves both the location and the current instant speed (calculated in our implementation using the previously collected sample) in an internal database. Next, DuctiLoc updates the EWMA-based speed v and calculates the time T to the next sample collection as per Alg. 1. The location sampling app receives the location samples from the DuctiLoc library, and saves them in an internal database. At the same time, the app is also responsible for collecting statistics about its own utilization of device battery and CPU, via the Android dumpsys tool. Dumpsys is a tool built into the Android OS, which allows obtaining precise information about the status of running services.
• Sensor-based: an app using an accelerometer-based location sampling process, by exploiting the fact that low-power accelerometer sensors embedded in modern smartphones can identify user movements so as to to avoid unnecessary location sampling in stationary conditions  [36] ,  [37]. More precisely, at every three minutes the app collects a short burst of measurements from the in-built accelerometer of the mobile phone, during two seconds. If the variance of values in the measured burst is greater than a threshold, a movement is detected, and a location sample is collected. For the choice of threshold, we selected the value 0. 5 (m/s 2 ) 2. For the selection of this value, we got inspired by the paradigm proposed in  [38]. We firstly applied a variety of values on our data collected by our volunteers as thresholds for detecting movement.
We found 0. 5 (m/s 2 ) 2 to give the best results. Then, we employed the data used in  [39]  to separately study the acceleration variance for humans under active, driving, walking and inactive state. We found driving to be the mobile status with the lower acceleration variance, with a median value of 0. 72 (m/s 2 ) 2. Consequently, we chose 0. 5 (m/s 2 ) 2 as a conservative threshold for our comparison experiments. All three apps collect and send to the same external server the following data: (i) device-related information, including a unique random identifier for data pseudonymization, the Android version, and the manufacturer, model, and release of the device; (ii) the collected location samples, including the latitude, longitude, horizontal accuracy, and timestamp of the location; (iii) the energy consumption information, including the estimated power utilization of the app, in mAh; (iv) CPUrelated information, including the total CPU time used by the app, in ms.