Skip to content

Conversation

YashAstro11
Copy link

🚀 Description

This PR adds the implementation of the Naive Bayes classifier in C++ under the root directory.

  • A machine learning algorithm for classification based on Bayes' theorem.
  • Supports both training and prediction phases.
  • Implements Laplace smoothing for handling unseen feature values.
  • Allows data input via CSV file or interactive input.
  • Time Complexity:
    • fit(): O(n * m) where n is the number of training samples and m is the number of features.
    • predict(): O(t * m * k) where t is the number of test samples, m is the number of features, and k is the number of classes.
  • Space Complexity:
    • fit(): O(k * m) where k is the number of classes and m is the number of features.
    • predict(): O(t) where t is the number of test samples.
    • Data Storage: O(n * m) for training data, O(t * m) for test data.

📂 Files Added

  • naive_bayes_algorithm.cpp

✅ Related Issue

No specific issue linked, but adds the Naive Bayes classifier feature.


Let me know if any changes are required. Glad to contribute! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant