JUSIKOM PRIMA (Journal of Information Systems and Computer Science Prim. Vol. 6 No. February 2023 E-ISSN: 2580 - 2879 IMPLEMENTATION OF SUPPORT VECTOR MACHINE ALGORITHM WITH HYPER-TUNING RANDOMIZED SEARCH IN STROKE PREDICTION Yennimar1. Alvin Rasid2. Sun Kenedy3 Universitas Prima Indonesia Jl. Sampul No. Sei Putih Bar. Kec. Medan Petisah. Medan City. North Sumatra 20118 E-mail:yennimar@unprimdn. ABSTRACT- Stroke is a severe health problem and can significantly impact a person's quality of life. Therefore, it is crucial to predict stroke early so that preventive measures can be taken before it is too late. This study demonstrates the importance of hyper tuning and hyperparameters in a stroke prediction model. Literature studies show that many studies on stroke prediction need to explain this, even though this is very important for developing the performance of stroke prediction models. In this study, we use the Support Vector Machine (SVM) algorithm to predict stroke and evaluate the algorithm's performance without hyper tuning and with hyper tuning Randomized Search CV. We also divide the data into training and test data by 75% and 25%. The results of this study indicate that hyper-tuning can improve the accuracy of the stroke prediction algorithm. The algorithm's accuracy is 77% without hyper-tuning, whereas, with hyper-tuning, the accuracy increases to 96%. Hypertuning with the Randomized Search CV method can improve the performance of the stroke prediction algorithm and is very important to do in developing predictive models. Keywords: Stroke Prediction. Binary Classification. Support Vector Machines. Randomized Search CV INTRODUCTION Stroke is a disease caused by impaired blood flow to the brain and is the second most common cause of death and disability worldwide. Therefore, early diagnosis is crucial to prevent further damage. Machine Learning technologies, such as the Random Forest algorithm. Support Vector Machine (SVM). , . Artificial Neural Networks (ANN). , and Decision Trees. , can be used to predict stroke. For example, a study by Wang et al. found that SVM performs better than other algorithms. However, several related studies do not describe Hyper Parameters and Hypertuning, which can help improve accuracy performance. Three Hypertuning techniques are widely used for similar prediction problems, namely Randomized Search. Ae. GridSearch . Ae. , and the Tree Base Pipeline Optimization Tool. , . , . Previous research found that the Randomized Search technique produces the best performance compared to other courses on medical datasets such as Cleveland heart disease and ZAlizadeh Sani. On the other hand, the Stroke Dataset from the Medical Clinic of Bangladesh (MCB) has been extensively studied with the SVM algorithm and the SMOTE method to address the Data Imbalance problem. Still, the benefits of Randomized Search have yet to be explored. , . Ae . Therefore, this study will examine the application of the SVM algorithm with and without hyper tuning Randomized Search CV. Method Stroke Prediction Stroke Prediction aims to classify stroke in patients. The design flow of the stroke prediction model using the Machine Learning Support Vector Machine (SVM) algorithm includes: Enter training data input in the form of patient data with stroke patient data and those without The SVM algorithm will carry out the model training process and produce a trained SVM model to predict stroke Enter patient testing data input into the trained SVM model The SVM model produces predictive output whether the patient has a stroke or not Support Vector Machine (SVM) Support Vector Machine (SVM) is a Machine Learning algorithm that works by mapping data into highdimensional feature spaces to categorize data points. Even though data cannot be separated linearly, separators or separators between categories can be found, as shown in the following figure. Figure 1. Illustration of a Support Vector Machine Then the data is transformed so that the separator can become a hyperplane. Then, the characteristics of the new JUSIKOM PRIMA (Journal of Information Systems and Computer Science Prim. Vol. 6 No. February 2023 E-ISSN: 2580 - 2879 data can be used to predict which groups should have new records . Randomized Search Randomized Search (RS) is a technique in which a random combination of Important Parameters and Unimportant Parameters is used to find the best solution for the model being built . As shown in the image above, this method is similar to Grid Search (GS), except that the way the GS method searches resembles a grid pattern and is not random. Research procedure The procedure for this research follows the general Machine Learning procedure as shown in the following Datasets The material to be used in this study is the Stroke dataset from the Medical Clinic of Bangladesh (MCB). 1which has been investigated in various previous studies . Ae. with the following specifications: Table 1. Dataset Specifications Specification Information Number of data (N) 5110 data Independent variable . Represents personal and medical dependent variable . Stroke or No Stroke Number of negative data Figure 2. Research Flow The stages, as shown in the image above, include: Number of positive data . Patient Data Input. This process enters data in Comma Separated Values (CSV) format, including personal data, medical records, etc. Data Preprocessing. This process processes and transforms data to be processed correctly by SVM algorithms, including Label Encoding and the Synthetic Minority Over-Sampling Technique (SMOTE) Method to handle data imbalances. Split Data. This process divides the data into Data Train and Data Test. Training Model Without Hypertuning. This process trains the SVM model to predict stroke with Data Train. Model Training With Hypertuning (RS). The difference with Hypertuning is that it uses the Randomized Search (RS) method to improve model Testing Models. This process tests the SVM model trained to predict stroke with the Data Test. Evaluation. The last process is to evaluate the performance of the model by calculating the accuracy of the Machine Learning model by knowing the four possible results that occur, namely True Negative (TN). True Positive (TP). False Negative (FN), and False Positive (FP). The JUSIKOM PRIMA (Journal of Information Systems and Computer Science Prim. Vol. 6 No. February 2023 E-ISSN: 2580 - 2879 four results are also called the Confusion Matrix. Then the calculation of the accuracy value can be done like the following formula: ("#$"%) Accuracy =("#$'%$"%$'#) stroke patients and those who did not have strokes, so the total data became 9466, as shown in the following figure. Results Data inpatient Figure 3. Dataset of Medical Clinic of Bangladesh (MCB) in CSV form Patient data is initially received in CSV (Comma Separated Value. format, which is the format often used to store datasets. However, this format is not suitable for data analysis. Therefore, we migrated the patient data from CSV to Jupyter Notebook Dataframe format. Dataframe is a table data representation in matrix form, which makes it easier for researchers to visualize and analyze data. Using data frames, researchers can perform various operations such as filtering, data preprocessing, etc. In addition, the patient data input process helps researchers prepare data for further analysis. Data Preprocessing Data preprocessing is a crucial stage in research, where the data collected must be processed and prepared for analysis. The researcher performs the label encoding process on the patient data in this case. Label encoding converts categorical data . uch as gender, blood type, etc. into numbers to facilitate data analysis. For example, the gender "Female" can be coded as number 1, and the gender "Male" can be coded as number 0. This allows the Machine Learning analysis algorithm used in this research to understand better and process the data. Thus, the label encoding process assists researchers in preparing patient data for further analysis and produces a ready-to-process Dataframe, as shown in the following Figure 4. Dataset of Medical Clinic of Bangladesh (MCB) in CSV form In addition, other problems need to be addressed, namely Imbalanced data. This happened because the data on stroke patients amounted to only 248, while there were fewer than 4733. In this study, we used the SMOTE method to overcome this problem resulting in 4733 data on Figure 5. Correcting Imbalanced Data Split Data In this study, patient data were processed through data input and preprocessing processes, divided into two major parts. In the first part, 75% is used as training data or is called Data Train, while in the second part, 25% is used as test data or is called Data Test. This aims to ensure the algorithm can work well on new data that has never been seen before. Model TrainingNo Hypertuning Hypertuning is the process of optimizing the parameters in a model so that the model performance However, in this study, the model for determining the results of a diagnosis using the SVM (Support Vector Machin. algorithm will be distinguished between those using the hyper tuning and those not using hyper tuning. Data Train, previously divided into 75% parts, is used to train the SVM model. This model is implemented by entering training data and conducting training using the algorithm. After training, the model will be ready to predict stroke with Test data. Figure 6. Evaluation of Training Performance Without Hypertuning Model TrainingWith Randomized Search Hypertuning As previously explained, parameters must be presented in research reports to ensure research results can be reused and shared findings with other researchers. addition, the code used is also attached on the last page of this research report. Next, we will describe the first parameter, namely the Randomized Search Hypertuning parameter used as follows: Table 2. Randomized Search Parameters Parameter Type Randomized Parameter Value Search param_distributions 'C' : . , 4, 6, . 'gamma' : . 1, 0. 3, 0. 5, 0. n_iter n_jobs JUSIKOM PRIMA (Journal of Information Systems and Computer Science Prim. Vol. 6 No. February 2023 E-ISSN: 2580 - 2879 random_state from sklearn. metrics \import make_scorer, roc_auc_score make_score. oc_auc_scor. After doing Hypertuning, the best hyperparameter results that the SVM model can use to predict stroke in this study are as follows: Figure 7. Best Hyperparameter Results Then, evaluating the performance of the training process with hyper-tuning can be seen in the following Figure 8. Evaluation of Training Performance with Hypertuning It can be seen that the results of training with hypertuning reach a perfect score, but this does not mean that the model is feasible for testing and needs to be proven again with the following process, namely testing. Testing Models Figure 9. Evaluation of Testing Performance Using Hypertuning This study tested the model with and without hypertuning, as shown in the following figure. The model's results without hyper tuning show good results with an accuracy of 77%. Precision and recall for class 0 . o strok. and class 1 . 81 and 0. 74 and 0. 84, respectively. However, after hyper tuning the model, the results obtained improved with an accuracy of Precision and recall for class 0 and class 1 were 0. 97 and 0. 97 and 0. 96, respectively. This shows that by hyper tuning the model, the results obtained are better and more accurate. Conclusion Some of the conclusions from this study are as Based on the latest literature study, this study found that stroke prediction algorithms can be helpful for technological developments in the medical world. However, many studies need to share information on hyperparameters and hyper-tuning, which are used to improve the accuracy of stroke prediction. Therefore, this study also provides examples of information related to hyperparameters and hyper tuning used. This study shows that the Support Vector Machine (SVM) algorithm can be used to predict stroke risk in patients. The results of the training model without hyper-tuning show an accuracy of 77%, whereas, with Randomized Search Hypertuning, it offers an increase in accuracy to 96%. This indicates that hyper-tuning plays an essential role in increasing model accuracy. Based on the results of this study, we suggest the First, conduct further research by adding new variables and comparing other algorithms. Conduct clinical studies to test the validity of developed models on natural populations or other Because this study did not use Cross Validation, further research can use the Cross Validation method to validate the model results further. BIBLIOGRAPHY