Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:17:54+00:00 2026-06-14T09:17:54+00:00

I am trying to implement Naive bayes algorithm on some real time data.I am

  • 0

I am trying to implement Naive bayes algorithm on some real time data.I am aware of the rules of bayes but I am not sure how to implement on my data.My data looks like as below.There are total 2 labels in my data which are ok,fraud and testing data labelled as unkn.I need to classify all the unkn records as either ok or fraud by applying Naive Bayes Algorithm.How do I achieve this? Please some one help me.

1,v1,p1,182,1665,unkn
2,v2,p1,3072,8780,ok
3,v3,p1,20393,76990,ok
4,v4,p1,112,1100,fraud
5,v3,p1,6164,20260,unkn
6,v5,p2,104,1155,ok
7,v6,p2,350,5680,unkn
8,v7,p2,200,4010,ok
9,v8,p2,233,2855,unkn
10,v9,p2,118,1175,unkn

Bayes Rules:-

Posterior Probability of unkn being ok = Prior Probability of ok * Likelihood of unkn given ok.

Posterior Probability of unkn being fraud = Prior Probability of fraud * Likelihood of unkn given fraud.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:17:56+00:00Added an answer on June 14, 2026 at 9:17 am

    I am assuming the row 1,v1,p1,182,1665,unkn is interpreted as:

    • 1, v1 = some identifiers
    • p1,182,1665 = features of your data point
    • unkn = label, in this case unknown

    With that notation in mind, your training data consists of all lines that have label ok or fraud, and your testing data is the rest. You have to calculate a priors and conditional likelihoods:

    1. Prior probability of ok is the proportion of ok examples in the training data. The same applies for fraud
    2. For each feature f, such as v1 or p1, its likelihood given ok is the proportion of ok examples in the training data which contain the feature. For instance, p1 is contained in 2 out of 4 ok examples, giving you a probability of 0.5.

    For each example multiply together the probabilities you calculated for all of its features in step 2. Multiply the result by the probability in step 1 to obtain the (joint) probability of your example belonging to a particular class.

    Caveats:

    • Multiplying probabilities together will eventually result in underflow. You might want to add the logs of those probabilities instead.
    • The algorithm I described works for discrete-valued features only. The continuous-valued features you appear to have above (e.g. 182) need to be converted to discrete (e.g. by binning) or you need to come up with some other way of estimating the conditional probability in step 2. Google for continuous-valued Naive Bayes
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement Gaussian Naive Bayes in C# for classification of points. I
Trying to implement 3-layer (not: tier, I just want to separate my project logically,
I trying to implement some relatively simple 2D sprite batching in OpenGL ES 2.0
I am trying to implement a reoccurring timer function asp.net. I am not able
I am trying to implement a if exists, update, otherwise, insert data access method
I'm trying to implement the XHR streaming Comet technique in jQuery, but am having
Hey, I'm trying to implement two tabs. Each one calls a specifig activity. But
im trying to implement a native library into my application. But i keep getting
I'm trying to run real time java code using the Websphere Realtime Java VM
I am trying to implement paging in hibernate and i am seeing some weird

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.