dataesr/scientific-paragraphs-categorization huggingface dataset:
ALEXIS CVETKOV-ILIEV received the Engineering degree in optics from the  Institut d'Optique Théorique et Appliquée, Palaiseau, France , in 2019, and the M. S. degree in automation, signal and image processing from  Paris-Saclay University, Gif-sur-Yvette, France , in 2019. He is currently pursuing the Ph. D. degree in machine learning with  Inria-French National Institute for Computer Science Research. His research interests include embedding methods for relational data, with the aim of facilitating data integration and analysis across databases. ALEXANDRE ALLAUZEN has been a Professor at the  École Supérieure de Physique et de Chimie Industrielles de la Ville de Paris (ESPCI) , since 2019. His research affiliation is in the  Machine Intelligence and Learning Systems (MILES) Project of the Laboratoire d'Analyse et de Modélisation de Systèmes pour l'Aide à la Décision (LAMSADE), Paris-Dauphine University and Paris Sciences & Lettres (PSL).
2. We investigate a recent deep learning tool-generative adversarial networks (GAN)-to simulate animal trajectories. GANs consist of a pair of deep neural networks that aim to capture the data distribution of some experimental dataset. They enable the generation of new instances of data that share statistical properties. This study aims at identifying relevant deep network architectures to simulate central-place foraging trajectories, as well as at evaluating GANs drawbacks and benefits over classical methods, such as state-switching hidden Markov models (HMM).
| INTRODUC TI ON Recent advances in telemetry enabled ecologists to track freeranging animals and to gather large trajectory datasets  (Chung et al. , 2021; Ropert-Coudert et al. , 2009). GPS recorders have been at the forefront of this breakthrough and can now provide accurate data on the movements of many species, such as mammals  (McMahon et al. , 2017) , seabirds  (Yoda, 2019)  and many other largesized vertebrate  (Kays et al. , 2015). These movement data contain crucial information about animal behaviour, including habitat selection, migration patterns and foraging strategies but present key challenges for movement ecologists to explain underlying animal movement ecology  (Nathan et al. , 2008). Since the movement processes of many animals are relatively poorly known, simulation of trajectories is fundamental to tracking data analysis.
, 2020). Deep learning refers to neural networks with multiple layers of processing units  (LeCun et al. , 2015). By decomposing the data into these multiple layers, deep neural networks allow learning complex features to represent the data with high level of abstraction at multiple scales. Recently, deep learning tools have demonstrated their great ability to simulate complex systems using generative adversarial networks (GAN)  (Goodfellow et al. , 2014). GANs consist in a pair of deep neural networks that aim to capture the data distribution of some experimental dataset, and that enable to generate new developments to better capture local-scale features. In this context, embedding HMM-based priors in GAN schemes appears as a promising research direction.
The other major difference with statistical inference approaches classically exploited in movement ecology lies in the calibration approach from data. Rather than using an explicit likelihood criterion, the calibration of the generator of a GAN involves the simultaneous training of another deep network D (referred to as the discriminator) that learns how to distinguish simulated data (i. e. G(z)) from real data. The typical architecture of a GAN is given in Figure  1a. If no discriminator can distinguish the simulated and real data, it means that the generator truly samples the unknown distribution of the training dataset  (Goodfellow et al. , 2014).
| Adversarial training and spectral regularization For a given architecture, networks' parameters are estimated using adversarial training, that is the two networks compete in a minimax two-player game given by Equation 2. Discriminator D is trained to maximize the probability of assigning the correct label to both training examples and samples from G, that is to maximize logD(x) + log(1 -D(G(z))). Generator G is simultaneously trained to fool the discriminator, that is to minimize log(1 -D(G(z))). Numerically, we apply stochastic gradient descents over the discriminator and generator successively where at each iteration, we compute the training losses for a randomly sampled subset of m trajectories within the training dataset 1 : (2) min G max D x∼p data (x) logD(x) + z∼p z (z) log(1 -D(G(z))).
in foraging trips where seabirds look for preys at sea and come back to their colony. Data points have been linearly re-interpolated at regular time steps, and coordinates have been centred on the colony's location and normalized. In particular, red-footed booby tracks were substantially downsampled in order to provide a simplistic dataset on which to evaluate distinct GAN architectures (see Table  1 ). Finally, trajectories have been padded with zeros so that all longitude/latitude time series from a dataset would have the same length.
| Architecture selection experiment We first designed an experiment to compare different GAN architectures. For this experiment, we considered the simplest dataset with a 1-hr time resolution (see Table  1 ). All trajectories involved 20 time steps. We evaluated four different GAN corresponding to every generator-discriminator pair for the considered CNN and LSTM architectures; for example, we call 'LSTM-CNN' the GAN with a LSTM network as generator and a CNN as discriminator. For all generators, the input random noise vector consisted of 20 samples from a uniform distribution on 0, 1. We trained all networks over 5,000 epochs with a learning rate of 2e-4 using the loss functions given in Equation 3. The score of each approach was assessed by computing the mean squared error of the logarithmic Fourier decomposition spectrum of simulated and real trajectories, ℒ spectral (see Equation 4).
HMM For comparison, we fitted a 'state-of-the-art' state-switching HMM to seabirds CPFTs. We followed the methodology presented by  Michelot et al. (2017) , which relies on a rigorous statistical inference. Movements were described as a sequence of step lengths and turning angles that we fitted with gamma distribution and von Mises distribution respectively. Three behavioural modes were used for the Peruvian datasets, that is 'searching', 'foraging' and 'inbound', while a fourth mode, 'resting', was added with the Brazilian dataset (Figure  5 ). For the modes of 'searching', 'foraging' and 'resting', we described movement as correlated RW, while for the mode 'inbound' we used a biased RW with attraction towards the colony. In order to force the return to the colony, we fixed some terms of the transition matrix, thus ensuring that the sequence of modes alternates first with 'searching', 'foraging' and 'resting', and is then forced to stay in mode 'inbound'.
| GAN versus HMM experiment On both datasets, GAN and HMM schemes managed to simulate relatively realistic CPFT (see Figure  5 ). However, the spectral distribution of GAN-derived synthetic trajectories matched the spectral distribution of real trajectories better (Figure  6 ). In particular, the mean spectral error ℒ spectral was about four times smaller, using GANs than using HMMs (Table  3 ). This was particularly highlighted for the medium frequencies (Figure  6 ). On the Peruvian dataset, the HMM failed to reproduce spectral features both at lower and higher frequencies (Figure  6a ), and on the Brazilian dataset, it failed in the higher frequency range only (Figure  6b ). By contrast, HMMs outperformed GANs to sample relevant step distributions (Figure  7 ). GAN models capture the real data distribution better, as they can simulate a set of trajectories that share global statistics with the reference dataset.
For instance, our synthetic trajectories have consistent trip distance, trip duration and the straightness index distributions (see Figure  7 ). The straightness index of a trajectory is defined as two times the quotient between the max range to the colony and the trip total distance. The trained GANs also capture spatial information as they reproduce position distributions of observed trajectories (Figure  8 ; Table  3 ). GAN-derived synthetic trajectories were indeed mainly heading towards some area of interest (i. e. westward of the colony on the Peruvian dataset, and to the north-east and south-east of the colony on the Brazilian dataset), while HMMderived trajectories are uniformly spread in all directions around the colony.
Capturing the variability of foraging strategies with respect to species, sex or breeding stage is a key element in understanding what drives the decisions of the animals  (Phillips et al. , 2021). Peruvian boobies Sula variegata tracked in this study breed in a highly productive upwelling system, the Humboldt Current System, and feed on relatively F I G U R E 4 Comparison of GAN architectures: Examples of trajectories generated by the architectures tested on the 20-step dataset (see Table  1 ). The four different GANs correspond to every generator-discriminator pairs abundant Peruvian anchovies  (Jahncke & Goya, 1998). For these reasons, they performed mainly short foraging trips of about 25 km, eventually travelling up to 75 km at a mean speed of 11 m/s (Figure  7 ). 1 ) derived from seabird species with distinct foraging strategies.
By contrast, masked boobies breeding at Fernando de Noronha forage mainly in oligotrophic waters (de Santana Campelo et al. , 2019). They have to travel way further from their colony during trips of 6-7 hr in average. They also spend substantial time sitting on water in the vicinity of foraging areas. We demonstrated the great ability of GANs to capture the global statistical properties of these distinct trajectory datasets F I G U R E 5 GAN versus HMM. Real trajectories used for training are in blue, synthetic trajectories generated by a 'CNN-CNN' GAN are in orange and trajectories generated by HMM are in green. (a) Stands for the 200-step Peruvian dataset and (b) stands for the 200-step Brazilian dataset (see Table 1). All positions at less than 1 km from the colony were removed F I G U R E 6 GAN versus HMM.
This work is a contribution to the TRIATLAS project (European Union's Horizon 2020 research and innovation program-grant F I G U R E 8 GAN versus HMM. Kernel density estimation of position distributions on real trajectories used for training (blue), 100 synthetic trajectories generated by a 'CNN-CNN' GAN (orange) and by HMM (green). (a) Stands for the 200-step Peruvian dataset and (b) stands for the 200-step Brazilian dataset (see.
Case studies and experiments 2. 2. 1 | Datasets GPS recorders were fitted to tropical boobies during their breeding period at the Pescadores Island, Peru in from 2008 to 2013, and at the Fernando de Noronha archipelago, Brazil, from 2017 to 2019 (Table1). This work was conducted with the approval of the Peruvian federal agency, Programa de Desarrollo Productivo Agrario Rural, commonly known as 'Agrorural'. Headquarters of Agrorural are located at Av. Salaverry 1388, Lima, Peru, and of the Brazilian Ministry of Environment-Instituto Chico Mendes de Conservação da Biodiversidade (Authorization No 52583-5). Trajectories consist.
Background: A pharmacometrics (PMx) workflow usually requires several software tools to cover all the steps from data analysis to model evaluation and simulations. However, these tools do not always communicate well together, compromising the efficiency of the whole process. Highly inspired by the markdown/pandoc system, we developed Peccary, an R package and its dedicated Shiny Application with the objective to accelerate the use of previously released R packages through various translation and metaprogramming processes. Methods: Peccary was developed with an agile method, progressively aggregating snippets of R code produced during real-life pharmacometrics works. Its first subpackage, PeccAnalysis, can be used to produce and evaluate various R code for population description (using table1 package), plot exploration (ggplot) and noncompartment analysis (pknca).
The second subpackage, PeccaReverse, allows writing a structural model using a minimalist (simplified deSolve) syntax, before metaprogramming model simulations (using either deSolve or RxODE) and design evaluation (through PopED), along with performing various model syntax translations (e. g. , into NONMEM, Monolix or nlmixr files). Finally, the third subpackage, PeccaResult, standardizes run outputs of several PMx software (NONMEM, Monolix, Adapt, nlmixr) to perform various diagnostic evaluation tasks.
Pharmacometricians routinely use a variety of tools ranging from generic programming software (e. g. , R) to specific PMx software (e. g. , NONMEM  7  , Monolix  8  , Phoenix WinNonLin 9 , in addition to multiple dedicated R packages). These PMx programs' performance can be assessed both in terms of efficacy and efficiency. Efficacy is the ability of software to produce a desired or intended output, while efficiency represents the resources (time, effort) required to generate the intended output  10. The efficacy of most of the PMx software is satisfying, thanks to the variety of available programs and the flexibility that they allow. Efficiency, on the other hand, can be improved, through a simplification of the model-coding or the improvement of interoperability, since switching from one software to another with the same model is standard practice to complete a PMx project, but most of the software uses different syntax for coding the same elements (e.
Development process Software can be developed through various methods. In 1999, Eric Raymond published an influential essay in which he compared software built as a cathedral to those built as a bazaar  33. Briefly, software built as a cathedral are very well thought out and structured before any code integration whereas bazaar systems imply much less preparation but need an organic development through immediate code creation and aggregation. Peccary was developed with the bazaar methodology principles. Concretely, Peccary's development followed the main author's daily work as a pharmacometrician. Whenever a specific need to produce an output was encountered, an immediate solution was coded in R, most of the time (but not always) trying to build a generic function with a metaprogramming system.
Overview of the workflow The current structure of Peccary, depicted in Figure  1 , comprises three subpackages. Briefly, PeccAnalysis deals with pre-modeling work, PeccaReverse with model building and simulation, and PeccaResult with model diagnostics. Peccary is the main package that gathers these three subpackages under one platform usable both in R console or inside a Shiny App. Inside the Shiny App, users can create a Peccary's project, allowing to save in the same place metadata of both the datasets (their path, separator, decimal, and "NA" strings) and various analysis (e. g. , exploratory plots or model simulations). This system allows the analyst to reload any desired datasets when reopening the Shiny App easily, switch from one dataset to another with a single action, or reload and secondarily modify any pre-saved data analysis.
PeccAnalysis PeccAnalysis gathers all functions made to analyze the data before any modeling work. This mostly includes three different activities, namely 1) population description, 2) plot exploration, and 3) non-compartmental analysis (NCA). The theophyline dataset pre-existing in R is used for demonstrative purpose, with the addition of the following columns: dose level (DL) as the rounded real-dose, the presence or absence of a side effect (true or false), and the gender (men or women) leading to Table  1 :.
Population dataset description The population description generally requires two steps. The first step is to extract covariate information from the full dataset. Because PK/PD datasets generally contain multiple rows per ID (one for each observation and one for each drug administration), extracting only the covariate information as a reduced dataset is needed. This has been simplified with a function (pecc_search_cov()), automatically creating a covariate table by only inputting Of note, the ". " argument (non-used above) allows the user to manually choose the desired covariates to display (instead of printing them all) but also to transform the numeric covariates into factors, even though the main interest of this function relies on its ability to detect the covariates automatically.
Non-compartmental analysis (NCA) Peccary simplifies the use of the pknca package 22 for performing NCA in several ways. As a first step, the function automatically creates the dose dataset, either using an EVID column, or assuming dose administration at time 0 (depending on the inputs). Second, it simplifies the computation of AUC from time 0 to X (X being a numeric argument) by using the pknca "intervals" system. Integrating "intervals" also makes it easier to toggle the computation of more NCA parameters by modifying the metaprogrammed code (for instance setting vss. last to True in the following example). Third, it automatically transforms the final pknca results into an organized data frame, directly including all possible covariates (extracted with pecc_search_cov()) for further analysis.
Results are shown in Table  4. demoNCA <-peccary_pknca(demoDF, Time, conc,Subject = Subject, dose = Dose, AUC0_x = 24, computeMedian = F, outputExpr = "both") ## NCA_eval <-{ ## conc_obj <-PKNCAconc(data = demoDF, formula = conc ~ Time | ## Subject) ## dose_obj <-PKNCAdose(data = demoDF %>% group_by(Subject) %>% ## slice(1) %>% mutate(`:=`(Time, 0), `:=`(conc, 0)), formula = Dose ## Time | Subject) ## intervals_manual <-data. frame(start = 0, end = c(24, Inf), ## cmax = c(F, T), tmax = c(F, T), auclast = c(T, T), aucinf. obs = c(F, ## T), cmin = c(F, T), tlast = c(F, T), vss. last = c(F, ## F), cl. obs = c(F, F)) ## data_obj_automatic <-PKNCAdata(conc_obj, dose_obj, intervals = intervals_manual) ## pk. nca(data_obj_automatic) ## } ## left_join(NCA_eval$result %>% filter(end != 24) %>% select(Subject, ## PPTESTCD, PPORRES, end) %>% distinct() %>% spread(key = PPTESTCD, ## value = PPORRES), NCA_eval$result %>% filter(end == 24) %>% ## select(Subject, PPORRES) %>% rename(`:=`(AUC24, PPORRES))) %>% ## left_join(demoDF %>% distinct(Subject, Wt, Dose, DL, side_effect, ## gender)) demoNCA[1:5, c("Subject","gender","cmax", "auclast", "AUC24", "tmax")] %>% kable The inputs, produced plot, and metaprogrammed code (both Peccary dependent and Peccary independent) are displayed on the same page.
In addition, each dataset can store the metadata of each analysis, such as a plot that can be recreated when reopening the Shiny app, before eventually being re-modified. On the left panel, the user can efficiently switch from one dataset to another (among the ones stored in a project or inputted since the beginning of the session). Of note, a very similar function (peccary_pknca()) metaprograms the NCA computation from scratch, manually computing all classical NCA parameters that do not require extrapolation (Cmax, Tmax, AUCTlast,. ). # demoNCA <-peccary_NCA(demoDF, timecol = Time, obscol = conc, Subject, auc_0_X = 24) In both cases, a table with NCA individual parameters is computed. In the Shiny app, a table1 function summarizes the results by possible covariates, along with the generation of either a boxplot or a scatter plot depending on the specific covariate the user wants to analyze.
Those plots are generated using the GGpubr package 37 , directly integrating statistical tests. The following code generates boxplots (Figure  4 ) using NCA results: plot_boxplot(df =demoNCA, x = gender, auclast, cmax, tmax, AUC24, outputExpr = "both", methodCompar = "wilcox. test") ## demoNCA %>% group_by(gender) %>% mutate(`:=`(gender, paste0(gender, ## "\n(n=", length(gender), ")"))) %>% gather(auclast, cmax, ## tmax, AUC24, key = "key", value = "value") %>% ggplot(aes(factor(gender), ## value)) + geom_boxplot() + geom_point() + facet_wrap(~key, ## scales = "free") + ggpubr::stat_compare_means(comparisons = list(c("M\n(n=9)", ## "W\n(n=3)")), method = "wilcox. test") + scale_y_log10() + labs(x = "gender") + ## theme_bw()  The following code produces a scatter plot (Figure  5 ) to visualize the relationship between a continuous covariate and NCA parameters: plot_correlation(df = demoNCA, x = Wt, auclast, cmax, tmax, AUC24, outputExpr = "both", cor.
PeccaReverse PeccaReverse is the second Peccary subpackage whose role is to simplify model creation, dynamic exploration, simulations, and translation into other software syntaxes. A simplified deSolve syntax has been used as the core language of PeccaReverse. For example, to create two compartments for a PK model with oral drug absorption, one can simply write the structural model as follows: model_demo <- "dGut <--ka * Gut dCentral <-ka * Gut + Periph * k21 -Central * k12 -ke * Central dPeriph <-Central * k12 -Periph * k21 conc_output <-Central/vd" Peccary also contains a PK/PD library to avoid writing frequently used models from scratch. Then, the deSolve_pecc() function automatically extracts all the model compartments, parameters, and initial states (if provided) from the equations, and also reconstitutes both deSolve and RxODE expressions: deSolve_pecc(model_demo) ## $model ## function(t, state, parameters) { ## with(as.
Perfusions are natively handled by RxODE package, while it was hard-coded (with an on/off time dependent zero-order input) when producing a deSolve code. Regardless of the simulation software used (deSolve, RxODE), the simulated values can be plotted with two additional pieces of information: 1) a table containing which outputs the user wants to display and if observations points should be added (with various filtering systems); 2) a table containing for each plot (several can be produced simultaneously) additional information such as the scales to use (logarithmic or continuous) or the wrapping systems. It is possible to wrap the plot either by output, protocol, set of parameter values, a mix of them or none. In the following example, we wrapped the plot both by the set of parameter values and by protocol, every other characteristic (here the outputs) being dissociated using different colors (Figure  7 ).
# What to plot (output), and should we add observation points (not used here) plot_table <-tribble(~Plot, ~Todisplay, ~Point, ~Filter_of_dataset, ~YTYPE, ~Check, 1, "Periph", F, "", NA, T, 1, "conc", F, "", NA, T ) Overall, this system is highly flexible with many different possible uses, such as exploring the dynamics of a model by looking at several variables simultaneously, exploring the impact of modifying parameter values, comparing different dose regimens,. Because it is possible to add observation plots (with various systems to control in which panels some subsets of data are displayed), different model structures or initial values can be tried for "manually" capturing the data before moving to a parameter estimation software. A recent feature allows having a first parameter estimation based on naive pool methods, using the R Optim function to optimize square residual sums.
g. , one or several YTYPE with normal or log-normal variabilities but without covariate), but was in practice judged not efficient enough compared to simply copy/pasting the structural model code directly in the Monolix suite, and thus not further developed. For NONMEM, minor manual modifications would be required after the translation, for instance if the user wants to change the used ADVAN or the estimation method. Parameters can be coded with or without MU referencing, and a block for handling data below the levels of quantification can be automatically added.