Construction of Music Teaching Evaluation Model Based on Weighted Naïve Bayes
Algorithm 1
Step of weighted Naïve Bayes classification.
Input: test case to be classified
Step 1: scan all the training sample data and count the class label C. At the same time, the statistical attribute a, the number of samples whose value is AE, and the number of samples whose value is not a, are recorded in the count table.
Step 2: based on the information in the count table, for all attributes values, the correlation probability, and noncorrelation probability are calculated using equations (7) and (8), and the results are saved in the RP table.
Step 3: acquire the weight parameter. Using the information in the RP table, the weights of all attributes for various class labels are calculated using formula (9), and the weights are saved in the weight table.
Step 4: learn a priori probability. Using the number of classes in the count table, equation (4) is used to calculate the a priori probability of all class labels and save it to the correlation probability (CP) table. Meanwhile, equation (5) is used in the calculation of conditional probability for all attributes, and the results are saved in the conditional probability table (CPT) table.
Step 5: implement classification. When predicting the category of a test case, the CP table and the CPT table are called first, and then the corresponding value in the weight table is called using the specific value of each attribute. Finally, the posterior probability of the case belonging to each category is calculated using equation (10), and the maximum posterior probability is found out, and the class label is assigned.