## 5 Data Processing and Artificial Intelligence Methods
### First-Level Data Processing  
Regression or classification methods are mainly used in the first-level data processing. In classical research tasks, this is solved by involving a larger number of subjects and statistical tests, but boluses for animal husbandry must handle individual cases. Here, the obvious way to handle plausibility is to use machine-learning algorithms and special normalization methods. Relatively few studies mention the use of AI algorithms at this level of data processing. Video-based monitoring systems have a much larger literature compared to rumen boluses, and deep-neural-network-based methods are already widely accepted in image processing [1, 4, 68, 69, 70, 71]. Perhaps unsurprisingly, there are many more AI methodological descriptions here, in the areas of lameness, disease diagnostics, rumination, and activity measurements [1, 4, 65, 69, 6]. Another problem with data processing is the significant variability between individuals, which makes classification difficult in data processing. It is often the case that the difference between two healthy individuals is greater than the difference between healthy and sick states or normal and abnormal activity levels of the same individual. This feature has been described in detail in a paper about lameness detection [5]. Lameness can be statistically determined from the locomotor activity of cattle. Location and lying characteristics were used in the experiment, namely median bout duration, step impulses, lying time, number of lying bouts, minimum bout duration, and maximum bout duration. The mean of each measured value is different for lame and non-lame cattle, but the middle two quartiles cannot be separated in any case [5]. The task is complicated by the fact that certain characteristics do not change in the same direction in the case of lameness. The number of steps may decrease because the animal steps less due to the hool pain, but sometimes, it may take smaller steps, so the number of steps increases. Two important methods were used during preprocessing. The first is that in each case, the sensor learned the normal behavior of the animal during a 14-day learning period, and the actual values of each animal were normalized based on the learned data set during the actual data processing. After that, the measured, preprocessed values of different animals became comparable [5]. The other method is not to examine the measured actual value, but its deviation from the expected value, the latter also on a probabilistic basis. In classical data processing, the interpretation of the measured characteristics is usually solved with thresholding algorithms, and due to the mentioned difficulties they can only be used with poor efficiency; therefore, it is worth using machine-learning algorithms. In a study on rumination activity detection, the support vector machine (SVM) algorithm was successfully used to determine the rumination activity. The whole task of data processing, adapted to the complex movements measured in the rumen, is quite complex. As the first part of the data processing contained classical data-preprocessing steps and basic statistical methods (moving average, variance), the SVM method was used to evaluate the extracted primary properties, and it was suitable for the determination of rumination [7]. Elements of processing:  
1. Peak detector: This is essentially a maximum search method that can detect the 0 value of the derivative function and the change in the sign of the derivative. The peak detector detects all sign changes, even those that belong to a very small peak; thus, a proper selector should be used to select the peaks that are considered appropriate. The peak detector threshold was determined by examining the distribution of the peaks. 2. Intercontraction interval (ICI): The time difference between the peaks marked by peak detectors. 3. Jerk variance baseline (JVB): This is essentially the baseline determination using a rolling median filter in 40 s windows.