## 4 Results and Analysis
### Data Preparation  
The data is prepared before the implementation of the Kmeans algorithm. The set of attributes providing details about the availed and provided services are shown in Table 3.  
Figure 5: Relational database for medical benefit optimization methodology. The queries which are applied on transactional data are provided below. CREATE TABLE facttable_data ( EMP_ID varchar(255), age float, total_visits float, total_amount float, relation_status varchar(255), relation float, gender float, CATEGORY nvarchar(255))  
After creating table named facttable_data, we are going to insert values in this table by executing stored procedure 'prepareDataForKmeans' Appendix A and following queries. As it is already mentioned that FACTTABLE is the main table which contains all transactions of last five years. INSERT INTO facttable_data (EMP_ID, total_visits, total_amount, relation_status) Select EMP_ID, COUNT(EMP_ID) as total_visits, SUM(amount) as total_amount, STRING_AGG(RELATION_,',') as relation_status from FACTTABLE GROUP BY EMP_ID  
In the original data set, relation and gender both are of string data type, but we define them as floats for further processing. This is done by using the following query. UPDATE facttable_data SET facttable_data.age = employee.AGE, facttable_data.CATEGORY = employee.CATEGORY, facttable_data.gender = (Case when employee.gender = 'M' then 1 when employee.gender = 'F' then 0 else 0 end) FROM facttable_data INNER JOIN employee on facttable_data.EMP_ID = employee.EMP_ID  
For relation(status) we used 1 for married and 0 for single. \begin{table}
\begin{tabular}{l l} \hline \hline
**Name** & **Data Type** \\ \hline EMP\_ID & varchar(255) \\ Age & Float \\ Total\_visits & Float \\ Total\_amount & Float \\ Marital\_status & Float \\ Relation & Float \\ Gender & Float \\ Category & nvarchar(255) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Attributes. UPDATE facttable_data SET facttable_data.relation = (Case when facttable_data.relation_status like '%ON%'or facttable_data.relation_status like '%WIFE%'or facttable_data.relation_status like '%DAUGHTER%'or facttable_data.relation_status like '%HUSBAND%' then 1 else 0 end )  
The proposed methodology is implemented in eclipse using JAVA programming language. The screenshots of the computed values are provided in Figures 5-11. Kmeans clustering algorithm is used for performing clustering. For Kmeans we need to enter the number of clusters and number of iterations as an input to the kmeans algorithm. We select the number of clusters by using the Silhouette score method. In Figure 6, it can be seen that peaks are at 2, which identifies the optimum number of cluster for all the categories in the provided data. Based on the Silhouette score, we kept the number of clusters as 2. The number of iterations is decided by observing the change in centroids values. Once the number of clusters and maximum iterations is decided. Then, need-based packages are generated for each category of employees. Let us first analyze the already in use packages for each category and then we discuss in detail the generated need-based packages for each category. From Table 4, it can be seen that there is a single premium amount for each type of category. It seems that while designing such packages insurance companies did not consider the need of employees. The need of any person can be analyzed by different parameters like age, marital status, gender, amount and number of visits, etc. By considering above mentioned parameters, it can be seen that based on any person's need each category can be divided into two groups. The proposed methodology generates packages by dividing each category into further two classes based on the above-mentioned parameters. Figure 6: Determining Number of clusters. Table 5 depicts a need-based package for category A. The methodology further divides category A into two groups. It can be seen that five attributes are considered for defining the need of any employee age, gender, relation status(relationship status), amount, number of visits.