1. Read Data:

    Read the input data points from the CSV file.

  2. Preprocess Data:

    Parse and preprocess the input data to create dictionaries for training and testing.

  3. Calculate Class Probabilities:

    Calculate the total values for each class and prior class probabilities with Laplacian smoothing.

  4. Calculate Attribute Probabilities:

    Calculate the probabilities for each attribute per class.

  5. Add Probabilities:

    Add the logarithms of attribute probabilities to obtain combined probabilities.

  6. Multiply by Prior Class Probabilities:

    Multiply the combined probabilities by prior class probabilities to obtain final probabilities.

  7. Predict Class Label:

    Select the class label with the highest probability as the predicted class.

Code