dataesr/scientific-paragraphs-categorization huggingface dataset:
By using static dimensional tables, we avoid the stream-stream joins. The problem of generating inner join results between the two data streams is that, at any time, the view of the dataset is incomplete for both sides of the joining, making it inefficient to find the matching values between two inputs data streams. Any row received from the input stream can match with any future not yet received row from the other input stream. Thus, the solution for this is to buffer the past input as a streaming state to match every future input with past input and accordingly to generate join results. As such, our implementation supports joins between a streaming and static relational table. In this setting, consider the query Q = (b, q, sum) in the context of Figure  5 , asking for totals by branch. In this query, the grouping and measuring attributes appear in the same fact table.
Rewritings to SQL In this section, we present a detailed description of how the evaluation mechanism leverages these rules and an HIFUN rewritten set Q mapped to a physical-level mechanism of Spark Structured Streaming, and the semantics of SQL when the evolving datasets are stored in an unbounded append-only relation table. Common Grouping and Measuring Rewriting Rule. In this rewriting rule, the SQL query is created by customizing the reduction step of SQL group-by query by adding the aggregate functions related to the n operations on the common measuring attribute, which appears in the rewritten HIFUN Q set. Common Grouping Rewriting Rule. In this rewriting, the SQL query is created similarly to the previous rewriting rule. In the reduction step of the SQL group-by query, the aggregate functions are added to the n operations for the n corresponding measuring attributes-which appear in the rewritten HIFUN Q set.
Setup and Datasets For our experiments we used a cluster that consisted of four nodes, each equipped with 38 cores at 2. 2 GHz, 250 GB RAM and 1 TB storage. A synthetic dataset, 50 GB, was split into 10 files of 5 GB each (80 million records). Our contribution in this paper lies mainly in the definition of the query rewriting rules for the HIFUN language and their implementations in two versatile low-level configurations that demonstrate the generality of the approach. As such, the experiments presented in this section only verify the applicability of the whole approach. The source code, the dataset and the queries can be found online (https://github. com/petrosze/ContHIFUN accessed on 8 May 2021). Each dataset is represented as an RDD and each RDD was pushed into a queue and treated as a batch of data in the DStream, and processed like a stream.
To distribute the data uniformly among all the cluster workers, the data follow a uniform distribution. The following experiments were conducted in synthetic datasets stored in distributed file system (HDFS). In the case of the MapReduce execution model, the source dataset was provided in a single text file, and the analysis context of this dataset is depicted in Figure  6 , whereas in the case of the SQL execution model, the source dataset was structured according to relational table, and the analysis context of this dataset is depicted in Figure  7. The attribute values were produced following uniform distribution, achieving a workload balance between all cluster nodes used.
Evaluating Incrementality We evaluated the effectiveness of the incremental approach, contrasting it to the batch approach. The batch computation approach looks at the entire dataset when new data are available to be processed. From this perspective, two different scenarios were evaluated: In the first scenario, Q was executed by the evaluation of the included queries individually (e. g. , without rewriting), and in the second scenario, the rewritten set Q was executed as defined by the rewritten theory. The incremental computation approach is more efficient by examining only the new incoming data in the last time interval and incorporates the increment in the result. From this perspective we evaluate the two scenarios again: the first scenario required the execution of the Q; the second scenario required the execution of rewritten Q.
As shown, as the dataset grows, the evaluation cost remains stable independently of the overall increasing data size. On the other hand, when the queries are evaluated over a batch data, the evaluation cost grows linearly to the size of the input batch data. Furthermore, as shown, the execution time of the non-rewritten queries is dramatically higher as the dataset increases, independently of the applicable rewriting rule. However, when the rewritings are used, in total, querying consumes significantly less execution time, exploiting the shared common attributes. In addition, we can observe that the execution times are similar to when the MapReduce and the SQL execution models are used for the same rewritings (Figures  8  and 10 ).
Conclusions In this paper, we leveraged the HIFUN language, while adding an incremental evaluation mechanism using Spark Streaming. We presented an approach allowing the incremental updating of continuous query results, thereby preventing costly re-computation from scratch. We also showed the additional benefits of query rewriting, enabled by the adoption of the HIFUN language. The query rewriting rules can be implemented in the physical layer as well, further benefiting the efficiency of query answering. We demonstrated experimentally the considerable advantages gained by using the incremental evaluation-reducing the overall evaluation cost using both the MapReduce implementation and the SQL one. Our system provides a compact solution for big data analytics and can be extended to support a big variety of dataset formats; its evaluation mechanisms work regardless of the nature of the data.
Query Input Preparation. A set of attributes which are included in grouping and measuring part of Q is used to extract the information from the initial unstructured dataset. A map function is used that applies the given attributes to each record of the initial DStream and returns a new DStream which contains the information useful for the next evaluation steps. (b)Grouping Partition Construction. In this step, a map function constructs the grouping partition as follows. The mapper receives the tuples created from the previous step and extracts the key-value pairs. The result is a new PairDStream in which the key K is the value of the grouping attribute of each data item or the value of the grouping attributes if the domain of ans Q is the Cartesian product of two or more grouping attributes.
Classification distance between N3, LoC and UWS We started by studying the similarity between states associated with deepest unconsciousness in our dataset: N3 sleep, LoC and the UWS group of patients. As an exploratory first step, we calculated the difference in FC for each state vs. wakefulness and then averaged across subjects. These differences are shown in Fig  2A , both in matrix form and as anatomical renderings of the functional connections associated with the top and bottom 5% differences. A similar pattern of FC changes is evident for N3 and LoC (correlation between FC difference matrices: R = 0. 65), consisting of reduced FC in occipital and parietal regions, and increased FC in frontal regions. On the other hand, UWS patients did not present such clear patterns, with high magnitude FC differences scattered throughout the whole brain (UWS vs.
LoC: R = -0. 1; UWS vs. N3: R = -0. 1). This suggests that average FC changes relative to conscious wakefulness during N3 sleep and LoC present substantial similarities, but are generally different from those seen in UWS patients. Next, we used individual subject FC data to train and evaluate three random forest classifiers to distinguish N3, LoC and UWS from their corresponding wakefulness baseline. After training and testing by cross-validation, each classifier was applied to recognize the other two brain states from the corresponding W data (i. e. transfer learning was assessed). Arrows in Fig 2B indicate significant transfer learning classification accuracy; for example, an arrow from LoC to N3 indicates that a random forest classifier trained to distinguish LoC from W presented significant accuracy when applied to distinguish N3 from W.
The three classifiers presented high and significant (p<0. 001) performance when distinguishing W from the brain states used for their training (indicated as self arrows in Fig  2B ): N3 vs. W, <AUC> = 0. 948 ± 0. 005; LoC vs. W, <AUC> = 0. 949 ± 0. 004; UWS vs. W, <AUC> = 0. 973 ± 0. 001 (mean ± std). Next, we used the trained classifiers to sort datasets different from the ones they were originally trained to distinguish. We found that algorithms trained using N3 sleep generalized well to the classification of LoC from W and vice-versa, yielding significant transfer learning (p<0. 05) for the classifier trained using N3 sleep and evaluated on LoC (<AUC> = 0. 92 ± 0. 02), and for the classifier trained using LoC and evaluated on N3 sleep (<AUC> = 0. 91 ± 0. 01). However, significant transfer learning was not obtained for classifiers trained or evaluated using the UWS dataset, thus establishing that the descriptive classifier distance metric dissociated physiological and pharmacologically-induced states of unconsciousness from the group of patients with most severe disorders of consciousness.
e. not restricted to sensory regions. Deep sleep and propofol-induced anesthesia present similarities in terms of brain activity and their associated neurochemical pathways. Both states are associated with slow  [44]  and regular activity of cortical origin  [15, 25] , breakdown of large-scale FC  [45, 46] , and increased inhibitory neurotransmission  [47] ; furthermore, propofol anesthesia may result in sleep-like homeostatic regulation  [48]. The results we presented in Fig 2  are  in line with these observations and also point towards marked differences between these states and the conditions of MCS and UWS patients, which have been previously shown to present distinct changes in EEG dynamics  [49]. A recent article demonstrated significant transfer learning between datasets comprising propofol anesthesia and DoC patients, which is at odds with the results of our analysis  [50].
For instance, functional connectivity was estimated from recordings acquired in different centers, which could represent a potential source of confounds. However, since our approach focused on transfer learning accuracy and each machine learning classifier was trained using a control group acquired using a matched scanner and data acquisition protocol, we believe it was less vulnerable to classification biases related to different experimental conditions. The use of anatomical connectivity estimated in a group of healthy participants could represent another limitation for the modeling of patient data. Nevertheless, since brain-injured patients may present heterogeneous lesion locations  [51]  it could be that the average healthy connectivity constitutes a reasonable first estimate. Also, since the perturbations failed to induce widespread transitions between LoC/sleep and DoC (even when considering the same anatomical connectivity) we can expect that this result will be furthered when incorporating more accurate group-specific connectivity.
Ethics statement Sleep dataset. Written informed consent and the experimental protocol was approved by the local ethics committee "Ethik-Kommission des Fachbereichs Medizin der Goethe-Universita ¨t Frankfurt am Main, Germany" with the ethics application title "Visualisierung von Gehirnzusta ¨nden in Schlaf und Wachheit zum Versta ¨ndnis der Abnormita ¨ten bei Epilepsie und Narkolepsie" and the assigned number: 305/07 in Frankfurt (Germany). Propofol sedation and anesthesia dataset. Written informed consent, approval by the Ethics Committee of the Medical School of the University of Liège. DoC dataset. Written informed consent to participate in the study was obtained directly from healthy control participants and the legal surrogates of the patients, approval by the Ethics Committee of the Medical School of the University of Liège.
Experimental data We analyzed fMRI recordings from 81 participants scanned at two independent research sites: Frankfurt: 15 subjects during wakefulness and sleep; Liège: 14 healthy subjects during wakefulness and under propofol sedation and anesthesia; 16 patients diagnosed as MCS, 15 patients diagnosed as UWS, and 21 healthy and awake controls. Sleep dataset. Simultaneous fMRI and EEG was measured for a total of 73 subjects EEG via a cap (modified BrainCapMR, Easycap, Herrsching, Germany) was recorded continuously during fMRI acquisition (1505 volumes of T2 � -weighted echo planar images, TR/TE = 2080 ms/30 ms, matrix 64 × 64, voxel size 3 × 3 × 2 mm 3 , distance factor 50%; FOV 192 mm2) with a 3 T Siemens Trio (Erlangen, Germany). An optimized polysomnographic setting was employed (chin and tibial EMG, ECG, EOG recorded bipolarly [sampling rate 5 kHz, low pass filter 1 kHz] with 30 EEG channels recorded with FCz as the reference [sampling rate 5 kHz, low pass filter 250 Hz].
Scalp potentials measured with EEG allow the classification of sleep into 4 stages (wakefulness, N1, N2 and N3 sleep) according to the American Academy of Sleep Medicine (AASM) rules  (54). Pulse oximetry and respiration were recorded via sensors from the Trio [sampling rate 50 Hz]) and MR scanner compatible devices (BrainAmp MR+, Brai-nAmpExG; Brain Products, Gilching, Germany), facilitating sleep scoring during fMRI acquisition. We selected 15 subjects who reached stage N3 sleep (deep sleep) and contiguous time series of least 200 volumes for all sleep stages. Previous publications based on this dataset can be consulted for further details (see, e. g. ,  [68] ). Propofol sedation and anesthesia. Resting-state fMRI volumes from 18 healthy subjects were acquired in four different states following propofol injection: wakefulness, sedation, unconsciousness, and recovery.
Data acquisition was performed in Liège (Belgium). Subjects fasted for at least 6 h from solids and 2 h from liquids before sedation. During the study and the recovery period, electrocardiogram, blood pressure, pulse oximetry (SpO2), and breathing frequency were continuously monitored (Magnitude 3150M; Invivo Research, Inc. , Orlando, FL). Propofol was infused through an intravenous catheter placed into a vein of the right hand or forearm. An arterial catheter was placed into the left radial artery. Throughout the study, the subjects breathed spontaneously, and additional oxygen (5 l/min) was given through a loosely fitting plastic facemask. The level of consciousness was evaluated clinically throughout the study with the scale used in  [69]. The subject was asked to strongly squeeze the hand of the investigator.
Functional images were acquired on a 3 Tesla Siemens Allegra scanner (Siemens AG, Munich, Germany; Echo Planar Imaging sequence using 32 slices; repetition time = 2460 ms, echo time = 40 ms, field of view = 220 mm, voxel size = 3. 45×3. 45×3 mm 3 , and matrix size = 64×64×32). Previous publications based on this dataset can be consulted for further details (see, e. g. ,  [46] ). Disorders of consciousness. The dataset comprised resting-state fMRI volumes on healthy controls (>18 years old and free of psychiatric and neurological history) and unsedated patients presenting disorders of consciousness (Department of Radiology, Centre Hospitalier Universitaire (CHU), Liège). The cohort included 21 healthy controls (8 females; mean age, 45 ± 17 years), 43 patients (25 in MCS, 18 in UWS, 12 females; mean age, 47 ± 18 years.
For each participant and for each brain state, we used FSL tools to extract and average the BOLD signals from all voxels. The FSL preprocessing included a 5mm spatial smoothing (FWHM), bandpass filtering between 0. 01-0. 1 Hz, and brain extraction (BET), followed by a transformation to a standard space (2mm MNI brain) and down sampling for a final representation in a 45x54x45, 2mm voxel space. The following preprocessing steps were performed using specially developed Matlab scripts. First, we corrected the data by performing regressions between the displacement parameters, the average signals extracted from the white matter and ventricles, their first derivatives, and the voxel-wise BOLD signals, retaining the residuals for further analysis. Next, we applied volume censoring (i. e. scrubbing), and discarded subjects who presented significant relative head displacements in more than 20% of the recorded frames, with a criterion for movement significance set as a displacement between consecutive frames exceeding 0.
5 mm (see the supplementary information for the statistical analysis of the scrubbing process across the different data sets). For the remaining subjects, we removed the first 3 frames and those which exceed the aforementioned threshold. Finally, we averaged all voxels within each ROI defined in the automated anatomical labeling (AAL) atlas, considering only the 90 cortical and subcortical noncerebellar brain regions  [72]  to obtain one BOLD signal per ROIs. This way, we obtain datasets with comparable smoothness and stability that can be compared across conditions. During preprocessing, 4 subjects were removed from the anesthesia data set, as well as 9 MCS patients and 3 UWS patients (see supplementary information). Structural Connectivity. The structural connectome was obtained applying diffusion tensor imaging (DTI) to diffusion weighted imaging (DWI) recordings from 16 healthy righthanded participants (11 men and 5 women, mean age: 24.
75 ± 2. 54 years) recruited online at Aarhus University, Denmark. For each participant a 90x90 SC matrix was obtained that represents the connectivity between ROIs. Data preprocessing was performed using FSL diffusion toolbox (Fdt) with default parameters. The probtrackx tool in Fdt was used to provide automatic estimation of crossing fibers within each voxel, which has been shown to significantly improve the tracking sensitivity of non-dominant fiber populations in the human brain. The connectivity probability from a seed voxel i to another voxel j was defined as the proportion of fibers passing through voxel i that reached voxel j (sampling of 5000 streamlines per voxel  [73] ). All the voxels in each AAL parcel were seeded (i. e. grey and white matter voxels were considered). The connectivity probability P ij from region i to region j was calculated as the number of sampled fibers in region i that connected the two regions, divided by 5000 × n, where n represents the number of voxels in region i.
Fitting to empirical data We selected the group-averaged static functional connectivity of each state of consciousness as the empirical observable to be fitted by the model. The BOLD signals corresponding to each ROI in the AAL template were filtered in the frequency range of 0. 04-0. 07 Hz, since this frequency band has been shown to contain more reliable and functionally relevant information compared to other frequency bands, and also to be less affected by noise  [76] [77] [78] [79]. Subsequently, the filtered time series were transformed into z-scores. For each state of consciousness, the amount of participants was selected based on the presence of uninterrupted epochs of that state lasting more than 194 samples (W sleep = 15; N1 = 15; N2 = 15; N3 = 15; W prop = 14; S = 14; LoC = 14; W con = 21; MCS:16; UWS:15).
/jcms/c2_ 16986309/fr/comite-d-ethique-hospitalo-facultaire-Funding: S. L. is supported by the  University  and  University Hospital of Liège , the  Belgian National Funds for Scientific Research  (https://www. flagera. eu/ourfunders/fund-for-scientific-research-fnrs-f-rs-fnrs/, FRS-FNRS), the  European Union 's  Horizon 2020 Framework Programme for Research and Innovation  under the  Specific Grant  Agreement No. 945539  (https://www. humanbrainproject. eu/en/, Human Brain  Project  SGA3 ), the  European Space Agency (ESA , https://www. esa. int/) and the  Belgian Federal Science Policy Office (BELSPO , https:// www. belspo. be/belspo/index_en. stm) in the framework of the  PRODEX Programme, "Fondazione Europea di Ricerca Biomedica ", the  Bial Foundation , the  Mind Science Foundation  and the  European Commission , the fund Generet, the  King Baudouin Foundation ,  DOCMA  project  [EU-H2020-MSCA-RISE-778234 ].
gbhi. org/projects/multi-partner-consortium-expand-dementiaresearch-latin-america-redlat]. The contents of this publication are solely the responsibility of the authors and do not represent the official views of these Institutions. G. D. is supported by a Spanish national research project (ref. PID2019-105772GB-I00 MCIU AE , https://www. csic. es/en/csicI) funded by the  Spanish Ministry of Science, Innovation and Universities (MCIU , https://www. ciencia. gob. es/portal/site/MICINN?lang_choosen=en), State Research Agency (AEI) ;  HBP SGA3 Human Brain Project Specific Grant Agreement 3  (grant agreement no. 945539 , https://www. humanbrainproject. eu/en),funded by the  EU H2020 FET  Flagship programme; SGR Research Support Group support (ref. 2017 SGR 1545), funded by the  Catalan Agency for Management of University and Research Grants  (AGAUR, https:// Competing interests: The authors have declared that no competing interests exist.
Machine learning (ML) libraries are gaining vast popularity, especially in the Python programming language. Using the latest version of such libraries is recommended to ensure the best performance and security. When migrating to the latest version of a machine learning library, usages of deprecated APIs need to be updated, which is a time-consuming process. In this paper, we propose MLCatchUp, an automated API usage update tool for deprecated APIs of popular ML libraries written in Python. MLCatchUp automatically infers the required transformation to migrate usages of deprecated API through the differences between the deprecated and updated API signatures. MLCatchUp offers a readable transformation rule in the form of a domain specific language (DSL). We evaluate MLCatchUp using a dataset of 267 real-world Python code containing 551 usages of 68 distinct deprecated APIs, where MLCatchUp achieves 90.
I. INTRODUCTION One factor behind the recent surge in popularity of machine learning (ML) is the availability of easy to use ML libraries, typically implemented in Python. However, similar to other libraries, Python ML libraries are also affected by API deprecations. The problem may even be more significant for Python ML libraries, as more popular libraries tend to see more evolution and thus have many deprecated APIs  [1] ,  [2]. Deprecation of APIs may occur with each update of the library. To use a new release of a library, updating usages of deprecated APIs is often required. However, the update can be cumbersome and time-consuming, and thus users may prefer to continue using the older version  [3] -  [7]. The use of the older version, however, may expose the program to lower performance and to security issues  [3] ,  [4].
Thus, a tool that supports the update of deprecated API usages is beneficial. Several studies have attempted to automate updates process of deprecated API usages  [8] -  [11]. However, prior works mainly target Java programs, and no study has attempted to automate the update for Python deprecated API usages. Python has several unique features compared to Java:  (1)  Python is dynamically-typed, compared to Java which is staticallytyped. In Python, variable types may change during code execution, and information regarding variable and function return types are typically unavailable. (2)  Python has two types of parameters, i. e. , positional and keyword parameters, while Java only supports positional parameter. Python also supports parameter default values. In this paper, we present MLCatchUp, an automated update tool for usages of deprecated APIs of popular Python ML libraries.