This study focuses on optimizing the K-Nearest Neighbors (KNN) algorithm for Javanese script classification using the Cosine Similarity metric. Through a grid search in cross-validation, the optimal combination of hyperparameters, including the number of neighbors, weighting functions, and distance metrics, was identified. The results demonstrate that the Cosine Similarity metric with a distance weighting scheme achieved the best accuracy of 99.99%. Furthermore, evaluation based on precision, recall, and f1-score revealed highly stable performance across various classes, with most achieving perfect scores. Compared to previous methods, such as LBP, CNN, and DCNN, this approach shows a significant accuracy improvement. These findings indicate that optimizing KNN with the Cosine Similarity metric is highly reliable for developing classification models for complex patterns.
                        
                        
                        
                        
                            
                                Copyrights © 2024