Skip to content

Added Naive Bayes classifier implementation in C++ #6833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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