dataesr/scientific-paragraphs-categorization huggingface dataset:
For the evaluation of the two processing methods (SD and ML) and the unprocessed tracking data against video-based tracking data as the gold standard, two sets of registrations were analysed through video, generating two datasets:  (1)  the training dataset used to develop the ML method; and (2) the test dataset used to evaluate the two processing methods, as well as the unprocessed tracking data, against video-based tracking data. As described in the Section 2. 5, the training dataset was used in a cross-validation process to split the data into validation and training sets and select for the optimal models. The training dataset was composed of 4274 registrations classified as FR or CR by means of 241 h of video observations divided into 79 batches, varying from 0. 5 h to 7 h, involving 44 tracking tags over 11 days.
The batches were selected based on the visual representations of individuals' movement across all days to ensure a broad variation of movement sequences and a reasonable number of observations across zones, stations, and tracking tags. To avoid introducing noise in model training, the training dataset did not contain registrations from the winter-garden zone due to the limited camera view in the pop holes described earlier. The training dataset comprised 13% FR and 87% CR. The test dataset was composed of 865 registrations classified as FR or CR by means of 96 h of video observation. More specifically, 48 batches (six/pen) of 2-h video (including 47 randomly selected tracking tags) were randomly chosen over six days and reduced to 42 batches due to technical issues (e. g. , backpacks not visible from the cameras).
As the test dataset was used to evaluate two processing methods, including one that did not require training, the test dataset contained registrations from each of the five zones, including the winter garden. However, as the classifiers can only be tested on classes included in the training process, all registrations from the winter garden were processed solely by the SD method. Registrations in the winter garden were retained in the evaluation of both processing approaches for two main reasons: first, to avoid any bias towards poorer/greater performance of the SD method, if that zone would be more easily/laboriously detected by the tracking system compared to the other zones; second, even if the winter-garden zone is processed by the SD method when evaluating the ML method, its performance is still influenced by the ML method, typically when the ML method filters a registration to the litter zone reported between registrations in the winter-garden zone (as there would be one less transition to the winter garden).
When a registration to the winter-garden zone could not be clearly classified through video observation (i. e. , animal could be either in the pop hole or the winter garden), CR was used for biological relevance. We decided to define the pop-hole area (illustrated in Figure  1 ) as part of the winter-garden zone (and not the litter zone), as exposure to natural light in the pop hole is more similar to the winter-garden zone than the litter zone. To better evaluate the tracking system, in addition to the tracking system's registrations, the test dataset contained all true transitions observed during video observations that were not reported by the tracking system (missed transitions). Missed transitions represented 0. 6% of the test dataset. The test dataset comprised 5% FR and 95% CR.
Evaluation of the Two Data Processing Methods As the tracking system used in this study evaluated the location of a tag every time the tag received an LF-signal, longer records have more opportunities for self-correction and therefore are more likely to be accurately record the location. Therefore, an intuitive and simple way to process the data is to filter all registrations that last for less than a certain threshold (SD method). We used a one-minute threshold with the objective of minimizing loss of actual transitions while maintaining a good representation of the true data. To account for more of the available information during data processing, we used a machine learning approach (ML method) based on decision-trees, which, in addition to the registration duration used by the SD method, employed 13 features of the registrations (de-Sensors 2022,  22, 659  tailed in Table  1 ), including the RSS, the zone, and the station identities.
The zone identities of the previous and next registrations (of the same tag) were also included to account for the movement sequence. The durations of the previous and next registrations were also included, as we expected the duration to be the most important feature for detecting FR. Our goal was to build a model to process (clean) the data rather than generate predictions about hen movement patterns. We aimed to isolate the true signal of hen movement, which can be used in future research to evaluate the drivers of hen behaviour. As such, our model is independent of external factors that could be of potential interest for future investigation (e. g. , weather). Three classifiers (random forest, gradient boosting, CatBoost) based on decisiontrees  [19]  were used to account for potential non-linearity and interaction effects  [20].
The gradient-boosting classifier is a greedy algorithm that sequentially trains a shallow decision tree in order to correct the errors of the previously trained tree  [21] , and the CatBoost model is a recently developed gradient-boosting algorithm  [22, 23]  that was selected in this study for its ability to process categorical features during training (algorithms of the classifiers further detailed in Supplementary Text S2). Following hyperparameter selection through a 3-fold cross-validated grid search (detailed in Table  S1  of the Supplementary Materials) and model training on the training dataset, the performances of the classifiers were evaluated on the held-out test dataset using three common classifier performance measures  [24] : (1) accuracy, defined as the fraction of predictions correctly classified by the model; (2) precision of class X, defined as the proportion of the predicted class X that is correctly classified by the model; and (3) recall of class X, defined as the proportion of the observed (true) class X, that is correctly classified by the model.
To better contrast predictionsof the three tree-based classifiers on the test dataset in order to select one for the ML method, we used McNemar's non-parametric test for pairwise binary classifier comparison  [25]  to test the null hypothesis that two models have similar proportions of errors. The normalized importance of features was generated for the selected model to understand the model's reliance on each feature when producing its predictions. Finally, the ML method used the selected classifier to classify registrations as FR and CR and then filtered FR from the unprocessed data. However, due to the limitations of video in covering the pop-hole area, the SD method was applied here to filter registrations in the winter-garden zone. zone3exist binary feature that equals 1 if the tag registers a signal of at least three different zones during the last 10 s, and otherwise equals 0 next2zone = zone; previous2zone = zone binary feature that equals 1 if the registered second zone from the next/previous record is the same as the occurring zone, and otherwise equals 0 We contrasted the two data-processing approaches by applying them to the unprocessed test dataset (i.
e. , including CR and FR). The resulting two processed datasets (ML Sensors 2022,  22, 659  and SD datasets), as well as the unprocessed test dataset, were then compared against the respective gold-standard dataset (i. e. , registrations identified as CR through video observation). In each case, we evaluated two things: (1) the animal's location (or more specifically, their presence/absence in each zone) and (2) the animal's movement. To evaluate how well these datasets represented individuals' presence/absence in each zone at each second, we compared their associated categorical time series (containing five categories, one for each zone). The performance was evaluated in terms of accuracy, macro-averaged recall, and macro-averaged precision (where the macro-averaged recall/precision is the average of the recall/precision across each zone).
To evaluate how well these datasets represented individuals' movement, we compared the total number of individual transitions per batch, per zone in each case. Performance was evaluated with the explained variance score (EV) and the mean absolute error (MAE), defined as: EV = 1 - variance{y GS -ŷ} variance{y GS } , MAE = 1 n samples ∑ n samples -1 i=0 y GSi -ŷi where ŷ contains information from a processed dataset and y GS contains the respective gold-standard information. The EV is used to measure the magnitude of the expected effect on the number of transitions  [26]. The MAE is used to measure, in an unambiguous and natural manner, the magnitude of the expected average error  [27]  in terms of the number of transitions (for a two-hour batch). This analysis was performed with Python version 3.
Investigation of Influencing Factors When comparing large datasets with thousands of hours of tracking per animal, comparison with video recordings as a gold standard becomes impractical. Therefore, to further evaluate the tracking system, we used the tree-based classifier from the ML method to identify FR (IFR) and studied the estimated error rate, defined as the number of IFRs against the total number of registrations, in relation to specific factors. The estimated error rate had a value of one when all records were filtered by the ML method and a value of zero when none was filtered. This approach has some limitations due to probable FRs not being detected or some being falsely detected. However, by removing the limitation on the number of days and individuals used, a broader investigation of the systems' performance can be conducted.
Data processing with the ML method is shown in the Results section to filter most of the true FRs (recall of class FR: 93%) and to filter mostly true FRs (precision of class FR: 84%). Therefore, IFRs should highlight most of the FRs from the unprocessed data and should be composed mainly of FRs. We applied the ML method over a two-month period, involving 144 animals, during which the hens were kept under similar management conditions every day, including 15 h of artificial light and six hours with access to the winter garden. To avoid biasing the data towards a greater error rate when the winter garden was closed, we excluded all registrations of transitions to the winter garden for periods when it was closed. We evaluated the estimated error rate in relation to different areas by reporting the mean ± SD of the estimated error rate across individuals for each of the five zones in each of the eight pens (40 pen-zone areas).
Evaluation of the Two Data Processing Methods On the test dataset, the three classifiers showed stable (over 100 random seeds) accuracy, recall, and precision (Figure  S1  of the Supplementary Materials), and the McNemar's test showed a similar proportion of errors between each classifier (p > 0. 05). Thus, with an accuracy of 99%, we selected the CatBoost algorithm for the ML method because of its ability to handle categorical variables in Python. Additionally, 84% of the time that the model identified an FR, the model prediction was correct (precision of class FR). and 100% of the time that the model identified a CR, the model prediction was correct (precision of class CR). Additionally, 93% of the FR observations were classified by the model as FR (recall of class FR), and 99% of the CR observations were classified by the model as CR (recall of class CR).
The zone identity, RSS, and the previous registrations' zone identity were the three most important features, accounting for 21%, 19%, and 13% of the overall importance of the features, respectively, while duration accounted for 7% (Figure  3A ). To further illustrate the importance of the features, Figure  3B  show the RSS and duration of the test dataset's registrations, split into CR and FR (from video observations). The receiving strength of the LF signal was generally higher for the correct registrations of all indoor zones. We also observed longer duration of stay to be more frequent among the correct registrations, with the exception of registrations in the lower perch zone, where no difference in the duration of stay was observed between correct and false registrations. of the day was also added as a fixed effect.
The zone identity, RSS, and the previous registrations' zone identity were the three most important features, accounting for 21%, 19%, and 13% of the overall importance of the features, respectively, while duration accounted for 7% (Figure  3A ). To further illustrate the importance of the features, Figure  3B  show the RSS and duration of the test dataset's registrations, split into CR and FR (from video observations). The receiving strength of the LF signal was generally higher for the correct registrations of all indoor zones. We also observed longer duration of stay to be more frequent among the correct registrations, with the exception of registrations in the lower perch zone, where no difference in the duration of stay was observed between correct and false registrations. The unprocessed, SD and ML datasets all determined an individual's zone (every second), with an accuracy of 99%, 98%, and 100%, respectively, and displayed the same values (99%, 98%, and 100%, respectively) for the macro-averaged precision and macroaveraged recall.
We found the ML and the SD datasets to underestimate the number of transitions by an average 0. 27 and 0. 06 transitions per zone, respectively, for a two-hour batch, in contrast to the unprocessed dataset, which overestimated the number of transitions Sensors 2022,  22, 659  by approximately 0. 5 transitions per zone, on average, for a two-hour batch (average number of transitions per batch, per zone by video observation was 1. 8). The percentage of variance of the ground-truth data recovered by the unprocessed, SD and ML datasets was 23%, 91%, and 99%, respectively, which is further illustrated in Figure  4. The unprocessed, SD and ML datasets all determined an individual's zone (every second), with an accuracy of 99%, 98%, and 100%, respectively, and displayed the same values (99%, 98%, and 100%, respectively) for the macro-averaged precision and macroaveraged recall.
We found the ML and the SD datasets to underestimate the number of transitions by an average 0. 27 and 0. 06 transitions per zone, respectively, for a two-hour batch, in contrast to the unprocessed dataset, which overestimated the number of transitions by approximately 0. 5 transitions per zone, on average, for a two-hour batch (average number of transitions per batch, per zone by video observation was 1. 8). The percentage of variance of the ground-truth data recovered by the unprocessed, SD and ML datasets was 23%, 91%, and 99%, respectively, which is further illustrated in Figure  4.
Discussion We found the presented LF tracking system accurately determined the presence of animals in a given zone (at the second level), with macro-averaged precision, and macroaveraged recall of 99% when compared against video observations of the test dataset. This good performance might be explained by the tag algorithm, which searches for new transitions, on average, every 0. 5 s (i. e. , each time a tag receives an LF signal), thus regularly providing opportunities for correctional records. However, the number of transitions in a zone generated by the tracking system was overestimated and only explained 23% of the true variance (as observed by video). Therefore, the unprocessed tracking data did not constitute a good representation of individual transitions between the five zones, which could be emphasized by the observed differences in the estimated error rate within specific pen-zone areas.
As soon as 100 consecutive runs induce no adjustment of an LF signal, the calibration is complete. An automatic calibration would save time as only one person would work on the calibration. This would also offer new opportunities, such as smaller zones, allowing for registration of finer movements. For instance, in our settings, it might be possible to differentiate between the nest boxes and the balcony in front the nest boxes (currently, both are registered as the nest-box zone). Furthermore, automatic calibration would ensure more homogeneous LF values across markers from the same zone across all pens, and consequently, more comparable datasets across different stations and pens would be generated. Our tracking system's poor performance in representing individual transitions highlights the importance of processing automatically generated datasets.
Relevant dataprocessing studies are lacking, although they could help to standardize this process to generate comparable datasets across different studies. The benefit of this work is most essential in light of rapid development in technology in order to manage and improve the welfare of animals within commercial livestock systems  [1, 2, [30] [31] [32] [33] [34] [35]. We showed that the data processed by a simple filtering of registrations associated with short durations (<1 min) of stays was suitable for monitoring the number of transitions per individual per zone, accounting for 91% of the actual variance (as observed by video). We further reported a gain in performance using a tree-based classifier to filter false registrations, accounting for 99% of the true variance in the number of transitions per individuals, which could partly be explained by the additional information provided to the ML method.
Another possibility would be to include the SD method as part of the tag algorithm, although this would eliminate the possibility of registering fast transitions between two zones (<1 min). Sensors 2022,  22, 659  The ML method required additional efforts, for instance, more video observations, compared to the SD method and statistical modelling in R or Python. Therefore, the choice between both methods relies on a compromise between time accorded in data processing and the performance of the processed data. In the current study, the SD method recovered 8% less of the true variance in the number of transitions per individuals than to the MLmethod. To put this value in context, we used simulated sampling to estimate the impact of a comparable loss on the effect size (measured by the Pearson correlation) of a simulated movement variable, M, on a simulated health variable, H.
Failing to accommodate all these complex structural and stochastic features in a conventional model-based approach to statistical inference risks returning spurious insights into the underlying behavioral dynamics. Developing such a model with a single PLF data stream can be challenging. Provided multiple data streams, however, Sensors 2022, 22, 1 the logistical challenges presented by model-based analytical frameworks can rapidly compound, creating significant barriers to cross-sensor inferences, and thereby impeding researchers from extracting more holistic behavioral inferences from increasingly data-rich farm environments. Unsupervised Machine Learning (UML) tools may provide a more flexible and forgiving approach to knowledge discovery in the context of large sensor datasets  [6, 7]. Such algorithms excel at identifying and characterizing complex non-random behavioral patterns lying beneath the stochastic surface of a dataset, while often employing relatively few structural assumptions about the data  [8] [9] [10].
Hierarchical clustering-based techniques offer an intuitive and highly adaptable approach to visualizing high dimensional datasets that is particularly well-suited to exploratory data analysis  [4, 9]. Indeed, by reducing the complex behavioral signals present in a sensor dataset into a series of discrete clusters, such algorithms may be viewed as an empirical extension of classical ethological techniques. Discrete data, however, can be challenging to work with in most frequentist and even many Bayesian frameworks. Estimators based on information entropy, on the other hand, are purpose-made to quantify uncertainty in discretely encoded data without knowledge of the underlying distribution, and thus naturally complement hierarchical clustering-based algorithms  [7, 11, 12]. Clustering algorithms, by virtue of their incredible flexibility, have successfully been applied to a range of PLF data streams  [7, [13] [14] [15] [16] [17] [18].
Time budget data was collected on all animals for a contiguous period of 65 days (1560 h). The observation window began on 17 February, shortly after trial enrollment was completed, and ended on 23 April, when the grazing season commenced and cows were moved overnight beyond the range of the receiver antennae. After eliminating the data of cows that were removed prematurely from the observation herd due to acute clinical illness, as well as several cows with persistent receiver failure, complete sensor records were available for 179 animals. In order to focus fully on the logistical challenges of encoding and characterizing the complex multivariate dynamics of this system, we have chosen to compress this data over the time axis to consider only the overall time budgets of these cows, and will leave explorations of the longitudinal and cyclical complexity of this dataset for future work.
This series of progressive pairings can be expressed graphically in the form of a dendrogram, which serves as a 2D representation of the data's geometric distribution in its higher dimensional measurement space, and can subsequently be used in data visualizations to highlight the most prominent structural features of a dataset  [19]. The efficacy of any hierarchical clustering scheme, however, is largely contingent on the adequacy of the estimator used to quantitatively express the pairwise dissimilarity between observational units  [10]. The Euclidean distance (L2 norm) is the default estimator used in most applications of this algorithm  [9, 10, 27] , including much of the previous work in precision livestock applications  [13, 14, 18]. The L2 norm is appropriate for many measurement systems where variance is reasonably uniform across a continuous domain of support.
Such estimates would collectively reflect heterogeneity in variance attributed to domain constraints, measurement error, and behavioral plasticity. Such an approach would not, however, be feasible for datasets collected over shorter time intervals with fewer replications, or in applications Sensors 2022, 22, 1 with behavioral responses where there is no clear hierarchy in the temporal structure of the same. We therefore propose that our stochastic simulation model can be extended to also provide a generalizable means to approximate the uncertainty of the underlying behavioral signal. As before, the measurement error was simulated by redrawing samples at the finest temporal granularity provided by the sensor. Prior to compression along the temporal axis, however, a random subsample of observations days was selected across all cows, and only these values were used to calculate the simulated overall time budget.