Illustration of the training and prediction process of the naive Bayes algorithm. Multiple tumor classes ( m classes) with several samples contribute CpG methylation ratios ( p features) for algorithm training. The training involves generating m centroids ( ) based on the provided samples ( ), describing the average methylation probability of each of the n CpGs (features) per tumor class. Additionally, weights ( ) are calculated per CpG and class, reflecting the predictive power of a CpG for a specific tumor class. For tumor class prediction in a given sample, sparse, binary methylation values from individual molecules—for example, obtained through Nanopore sequencing—serve as input for the pre-trained Bernoulli naive Bayes model. The output comprises a ranked list of posterior probabilities of all tumor classes in the model.