# Research on Grain Moisture Model Based on Improved SSA-SVR Algorithm
## 2 Data Sources and Processing
### Data Preprocessing  
Initially, data obtained from the grain moisture meter were cleaned. The initial dataset included voltage readings converted from the resistance of long-grain rice at 30 \({}^{\circ}\)C from over 100 different moisture groups and their corresponding moisture values. All incomplete records, i.e., those containing one or more missing values, were removed. The main reason for missing values is human recording errors that occurred during the recording process. In the processing, there were seven instances of data loss, which have been deleted. Removing incomplete records can improve the overall quality of the dataset. Since the training model dataset is relatively small, ensuring high-quality data input is crucial for establishing accurate and reliable models. Machine learning algorithms cannot directly handle missing values, so deleting records containing missing values provides a quick and simple solution, although it may not be the optimal one. Following this, outliers were identified and eliminated based on the boxplot [19] and the 3\(\sigma\) principle, as these may represent misreadings from the moisture meter or data entry errors. Some data also contain duplicate values, and the reason for the occurrence of these three duplicated data points is human errors during the recording process. Due to the voltage range in the homemade grain moisture meter being between 0 and 2.5 V, the small voltage span between moisture levels leads to the generation of duplicate values. Therefore, the samples are re-prepared to increase the voltage difference, aiming to minimize the occurrence of duplicate data points. Figure 1 displays a boxplot.  
By utilizing box plots, a visually intuitive and concise statistical summary is provided for the data. The central line in the box plot represents the median of the data, which is the value located in the middle position after sorting all the data. The interquartile range can be used to assess the dispersion of the data, where a wider box indicates greater data dispersion. By placing multiple box plots side by side, it becomes convenient to compare the distribution of different datasets.  
Subsequently, for handling missing values, the remaining missing values were also addressed by re-preparing the samples, conducting tests, and filling in the missing parts. Since the missing portions in this small dataset were not considerable, no multiple imputation methods [20] were employed. Following this, outlier treatment was performed by calculating the Z-score for each variable and removing outliers with Z-scores exceeding 3 in absolute value. The dataset comprises two feature columns, namely voltage values and resistance values, with a total of 125 data records, and the target feature for prediction is moisture content. In the above data processing steps, missing values and outliers are applied to both input features and target features. Finally, the Min-Max normalization method was applied to scale all feature values to the \([0,1]\) range to address issues related to different scales and magnitudes. A portion of the data are shown in Table 1, where the actual voltage values correspond to the voltage values used in the modeling set, while the measured voltage values are obtained from the self-made moisture meter.