{'fraction_non_alphanumeric': 0.02093385214007782, 'fraction_numerical': 0.005136186770428016, 'mean_word_length': 5.0532265661799345, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Evaluation of river water quality by using hierarchical clustering analysis

Assessment of water pollution is a critical study because it can affect humans directly. Likewise, river water is widely used for various daily needs. It is important to group rivers according to their classes so that further analysis and action can be carried out. This article discusses the clustering of rivers in several areas in the southeast part of Central Java Province consisting of 14 sampling stations based on several water quality parameters. The pollutant parameters include TSS, electrical conductivity, pH, BOD, COD, and DO. The method used is Hierarchical clustering in which the object grouping begins with grouping two objects with the closest distance being combined into one cluster, and then continues until one cluster is formed consisting of all objects. The results show that five clusters are the ideal choice. Except for electrical conductivity, the parameters observed are dominantly the difference between clusters. Through the formation of river clusters based on their water quality, the characteristics of each cluster and cluster members with high similarity can be identified.


Introduction
Water quality is one of the important criteria in measuring environmental management indicators. A generic water quality standard that satisfies all water uses is challenging [1]. The water quality index can be used to assess the quality of water bodies and the suitability of their designation. Monitoring river quality through measuring the water quality index is important because it can be used as a fulfillment of quality standards. In general, rivers in Central Java, Indonesia, are in the medium category. In the analysis of aquatic systems, modeling water quality parameters is very important [2]. The process of water planning and management relies heavily on the use of statistical models. The model is used to help identify and evaluate alternative ways to meet various planning and management objectives [3]. The development of an efficient model needs to be done using both spatial and temporal data. Surface water quality models can be useful tools for simulating and predicting the level, distribution, and risk of chemical pollutants in a given water body. Modeling result is an important component in environmental impact assessments and can provide the basis for technical support for environmental management agencies to make informed decisions [4]. One type of modeling which is useful in monitoring river water quality is clustering. The main aim of clustering methods is to identify groups of objects, or clusters,  [5]. This technique separates objects into groups with high heterogeneity as well as analyzes the similarity between objects in one group.
Various clustering methods have been developed, one of the popular ones is the hierarchical cluster. It is one of the popular clustering techniques in Machine Learning. In hierarchical clustering, the most similar objects will be grouped. Based on the similarity of these clusters, the most similar clusters are combined. This process is repeated until only one cluster remains. For the time needed, k-means and hierarchical clustering take less time to build the model than other methods [6]. However, this method is considered more suitable than k-Means Clustering, where the number of clusters must be decided at the beginning of the algorithm. Ideally, the number of clusters to have is unknown at the beginning of the algorithm. Based on the background, the purpose of this study is to cluster rivers based on water quality based on several pollutant parameters using a hierarchical cluster technique.

Data
The research area includes rivers in Central Java Province where water quality measurements have been carried out in the first monitoring period of 21 January 2020. The data used in this study were collected from fourteen monitoring stations under the river water quality monitoring program by the Department of Environment and Forestry, Central Java Province ( Table 1). The locations of these rivers are in the regencies of Sukoharjo, Sragen, Karanganyar, Boyolali, and Surakarta.

Water quality parameters
The water pollutant parameters used as the basis for clustering include and Total Suspended Solids (TSS) in mg/l, Electrical Conductivity (DHL) in µg/l, pH in Sorensen scale, Biological Oxygen Demand (BOD) in mg/l, Chemical Oxygen Demand (COD) in mg/l, and Dissolved Oxygen (DO) in mg/l. Based on the data received, the measurement of water quality parameters was carried out at the Environmental Testing Center and Laboratory, Department of Environment and Forestry, Central Java Province.

Hierarchical cluster analysis
Clustering is included in multivariate data analysis. This method group objects into clusters by measuring distances and identifying each cluster [7]. Distance metrics that can be used include Euclidean distance and Manhattan distance. The selection of metrics determines the shape of the resulting cluster. This is because clusters that are close together according to one metric can be distant from each other according to another metric. Objects with high similarity will be grouped in one cluster while objects with low similarity will be in different clusters. In other words, the homogeneity within the same cluster is high while the homogeneity between clusters is low. There are various cluster methods such as K-means clustering, hierarchical clustering, K-mode clustering, Fuzzy algorithms, etc.
Each object is treated as a single cluster and then sequentially combined or agglomerated into cluster pairs until all clusters have been combined into a single cluster containing all objects. In other terms, the concept of the hierarchical method begins by combining the two most similar objects, then the combination of these two objects will join again with one or more other most similar objects. This clustering process will eventually agglomerate into one large cluster that includes all objects. Stages of hierarchical clustering can be described as follows [8]: 1. Assign every object into a separate cluster. 2. In each pair of clusters, calculate the pairwise distance. create a matrix whose elements are the calculated distance values. 3. Find the shortest distance from the pair of clusters. 4. Combine the identified pairs by removing both clusters from the distance matrix. 5. Calculate the distances from the new cluster to all other clusters, then update the distance matrix. 6. Repeat these stages up to the matrix is reduced to only a single element.
In hierarchical clustering, it is not necessary to determine the number of clusters at the beginning of the process. This method is also known as the agglomerative method which is presented in a dendrogram [9]. By using a dendrogram, users can consider a visual representation to get the desired clustering. Dendrograms provide a comfortable method for exploring the multiple possibilities of grouping data [10].

Results and discussion
In this research, the clustering analysis was applied to standardized raw data. The use of standardization procedure is to eliminate the influence of different units of measurement. Standardization is required when there is unit variability. In this case, electrical conductivity and pH have different units from other parameters. Standardization tends to increase the effect of characteristics with small variances and reduce the effect of characteristics with large variances. Therefore, the data used for data processing is standardized data. The process of forming clusters at observation stations using the hierarchical method begins with calculating the distance matrix between variables using the Euclidean distance. Table 2 shows the distance matrix between one variable and another. The smaller the Euclidean distance, the more similar the two variables are. Based on the closest distance, the variable with the highest similarity will form a group or cluster. After the distance between variables is calculated by the Euclidean distance, the grouping is carried out in stages. The complete agglomeration process is presented in Table 3. In the first stage, by pay attention to the Coefficients column, one cluster is formed consisting of samples no 3 (MK1) and 8 (JL2) with a distance of 0.078. Because the agglomeration process starts from the two closest objects, then the distance is the closest of all the 14 object distance combinations. Next, attention is directed to the last column, the next stage is number 4. This means that the next clustering is done by looking at stage 4. The same technique is continued until the last stage. The calculation of the coefficients in this agglomeration process is complex, especially involving many objects and continues to grow. The agglomeration process will eventually unite all objects into one cluster. In the process, some clusters are generated with each member, depending on the number of clusters formed.   Table 3. Agglomeration schedule of cluster forming.

Stage
Cluster combined

Coefficients
Stage cluster first appears Dendrogram is useful for showing the existing cluster members according to the number of clusters that should be formed. Figure 1 presents the dendrograms for the average linkage, for the variables TSS, Electrical Conductivity, pH, BOD, COD, and DO whereas, Table 4 lists the clusters formed by this method.  The dendrogram presented in Figure 1 makes it easy to arrange the possible clusters that are formed. To clarify, Table 4 has been compiled with the possible number of clusters that are deemed appropriate from 2 to 6. The two results have led to selecting SM2, GP2, PL2, PM2 stations to be separated into separate clusters. The four always separate themselves if the number of clusters is reduced, with a considerable distance from a group of other stations. Therefore, five is the choice of the number of clusters that are considered sufficient. SM2 station has different characteristics from other clusters in high BOD and COD parameters, while DO parameters tend to be lower. The effect of a lower pH than the others has separated the GP2 station from other clusters while TSS is the parameter that dominantly causes PL2 to be different from the others. BOD and COD also contribute effects, although not as much as TSS. These results are in line with Gonçalves and Alpuim [11], that the variables BOD and COD are strongly related because the cluster structure is very similar. Stations with the worst characteristics in these parameters are assigned to different clusters. Likewise, pH exerts a marked effect and is classified differently because pH classification is more complex and must take into account, for example, the geomorphological characteristics of watersheds. Slightly different at the PM2 station, neither is dominantly different from the others. The causes of the differences are more evenly distributed on almost every parameter.
The results obtained are appropriate with Camara et al. [12] which reported that BOD, COD, DO and pH were parameters that differentiated between clusters of observation objects, in addition to temperature. Similar results were also reported in Alves et al. [13] which presented a moderate association between pH, BOD5, and dissolved oxygen at monitoring water quality of the Sergipe River basin, in both dry and rainy periods. Another study was reported by Liu et al. [14], which clustered river water quality based on different periods. Periods with high river water content give different parameter measurement results. Based on research that the prsecense of rain on dry agricultural land amd residential areas is the largest contributor to the potential for erosian that will cause siltation in the river and reduce the amount of discharge in the river [15].
Considering that the measurement of this parameter was carried out in January, which is the rainy period, it is interesting to investigate whether the clustering results in this study differ in other seasons.

Conclusion
Clustering of rivers based on water quality parameters using hierarchical agglomeration technique has been developed. The recommended optimal number of clusters is five, each of which has specific characteristics. The cluster formed shows high homogeneity among cluster members and has high heterogeneity between clusters. Despite the limited amount of data, the findings obtained have explained the clear class differences of rivers at the observed stations. The study needs to be expanded by adding observation stations throughout the province and complementing other water quality parameters to obtain a more comprehensive condition. Likewise, aspects of the development of clustering methods and computational techniques used need to be expanded by utilizing spatial information.