## 2 Materials and Methods
### Classifiers  
This work aims to classify Thai songs from Spotify into four emotion classes: love, happy, sad, and angry. We evaluated five classification algorithms to determine the most suitable task. Random forest was employed to leverage an ensemble of decision trees, each trained on varied subsets of data and features. This approach mitigates overfitting and enhances accuracy, proving effective for the complex and high-dimensional data inherent in music sentiment analysis. XGBoost, an optimized version of gradient boosting, was also utilized. It employs gradient boosting to minimize prediction errors while emphasizing speed and efficiency. Its strong performance in classification tasks, especially with larger datasets, makes it a compelling option. A decision tree classifier was included as well. This simpler algorithm uses a tree-like structure for decision-making, offering ease of interpretation, though it carries a risk of overfitting. Logistic regression, typically used for binary classification, was adapted for this multi-class problem. It utilizes a sigmoid function to predict the probability of each emotion class. Finally, SVM was implemented. SVM identifies the optimal decision boundary to separate data points into different classes and can employ kernel functions to address non-linearly separable data. We sought to determine which of these five algorithms--random forest, XGBoost, decision tree, logistic regression, and SVM--performs best for classifying Thai songs into the four specified emotional categories. We outline the specific parameter values used for each model. Table 1 below shows the key parameters for random forest, XGBoost, decision tree, logistic regression, and SVM. We specify parameters such as max_iter or n_estimators, class_weight, random_state, and other relevant settings for each model. Here are the explanations according to each model's parameters:  
Random forest: We used 300 trees (n_estimators = 300), a max_depth of 50, and min_samples_split and min_samples_leaf of 2. Bootstrap = False ensured that each tree was built using the entire dataset. class_weight = 'balanced' and random_state = 42 were also used. n_jobs = \(-1\) utilized all available processors (n_estimators: the number of trees in the forest; max_depth: the maximum depth of the tree; min_samples_split: the minimum number of samples required to split an internal node; min_samples_leaf: the minimum number of samples required to be at a leaf node; bootstrap: whether bootstrap samples are used when building trees. False means that the whole dataset is used to build each tree; random_state controls the randomness of the algorithm; class_weight: weights associated with classes. 'balanced' mode uses the values of y to automatically adjust the weights inversely proportional to class frequencies in the input data). XGBoost: We set n_estimators to 300, max_depth to 5, and eval_metric to'mlogloss' for multi-class classification. use_label_encoder = False was used due to changes in scikit-learn. random_state = 42 was used for reproducibility (n_estimators: number of boosting rounds; max_depth: maximum tree depth for base learners; use_label_encoder: this parameter has been deprecated in scikit-learn version 1.0 and higher; eval_metric: evaluation metric for validation data. 'mlogloss' is used for multi-class classification; random_state: controls the randomness of the algorithm). Decision tree: We limited the max_depth to 50 and set min_samples_split and min_samples_leaf to 2 to prevent overfitting. class_weight = 'balanced' was applied, and random_state = 42 was used (max_depth: The maximum depth of the tree; min_samples_split: the minimum number of samples required to split an internal node; min_samples_leaf: the minimum number of samples needed to be at a leaf node; class_weight: weights associated with classes. 'balanced' mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data).