Implementation of naive Bayes classifier (php)

Source: Internet
Author: User
Implementation of naive Bayes classifier (php) this article uses php to implement a naive Bayes classifier, which classifies records of discrete variables with discrete attribute values .? After learning the data in the sample.csvfile, the classification model is used to predict the class indexes of the data in predict.csv. Calculate the probability of each class for each predicted data, and then implement the naive Bayes classifier with the highest probability (php)

This article uses php to implement a naive Bayes classifier that classifies records with discrete variables whose attribute values are.

?

After learning the data in the sample.csvfile, the classification model is used to predict the class indexes of the data in predict.csv.

Calculate the probability of each predicted data Class, and the class with the highest probability is the predicted class of the data.

?

The attachment contains the program file bys. php, sample file sample.csv, and predict.csv.

?

?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.