Using algorithm to identify the car and cherry

Source: Internet
Author: User

Introduction: Naive Bayesian classifier as the basis of the classification algorithm, as early as the basic mathematical period has been used, is now widely used in all walks of life. In recent years, the car in China to sell hot, the face of the car and cherry, many people are difficult to distinguish, then the algorithm can help us differentiate it?
This article is selected from the "Big Data Era algorithm: machine learning, artificial intelligence and its typical example."

650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132709507?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" Picture description "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>
Is the car a cherry? What difference do they have? By collecting in fruit market, some relevant characteristic data about the car and cherry were obtained.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132256926?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" Picture description "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>
By using the data of the existing cars and cherries, it is possible to randomly give a car or cherry to a blend of fruit and cherry, and to identify the possibility of a cherry or a car. In this article we will use Naive Bayes (Naive Beyesian) To solve this problem, but before we begin, we'll take a brief look at some of the relevant knowledge.

Bayes theorem

Naive Bayes is a probabilistic classification model based on Bayesian theorem. Bayesian theorem is a theorem in probability theory, which is related to the conditional probability and the edge probability distribution of machine variables. In some explanations of probability, Bayes ' theorem can tell us how to use new evidence to modify an existing view. This name comes from Thomas Beyes.  
Typically, the probability of event A in event B (occurring) is different from the probability of event B in event A, but the two have a definite relationship, and the Bayes theorem is the expression of the relationship. The Bayesian formula defines that the probability of event a appearing when event B appears is equal to the probability that event B will occur when event a appears, multiplied by the probability of the occurrence of time a, divided by the probability of the occurrence of time B. By contacting event A with event B, you calculate the probability of generating another event from an event, which is traced from the result to the original. Thus, the Bayes theorem formula is as follows:  
650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132800804?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 2" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

650) this.width=650; "Src=" http://img.blog.csdn.net/ 20170123132816992?watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400 /fill/i0jbqkfcma==/dissolve/70/gravity/southeast "alt=" "Figure 3" "title=" "style=" border:0px;vertical-align:middle; Margin:auto; "/>

Therefore, the Bayesian formula can be understood from the point of view of information classification, that is, whether it is a feature category in the case of feature WI, CJ depends on the probability that the feature WI appears and the probability that WI appears in all features in the case of feature classification Mark CJ. The significance of P (W) is that if the feature is present in all information, the lower the probability of using the feature WI to determine whether the classification identifies CJ, the less representative it is.

The solution of the problem of the car-Bali and Cherry

Naive Bayesian is a supervised learning method that can use the Bernoulli model (Bernoulli models) to classify text in a document as a granular size.  
(supervised learning is the essence of supervised classification, the supervised classification refers to the samples provided according to the existing training set, through constant calculation, from the sample to learn the selection of feature parameters, the classifier established discriminant function to classify the identified samples. There are supervised classification methods can effectively use the prior data to verify the posterior data, but the shortcomings are more obvious. First of all, the training data is artificially collected, has certain subjectivity, and the person collects the data also can cause to spend a certain manpower cost; second, in the result of the final classifier classification, the classification results are only the classification types in the training data and do not produce new types. The
assumes that the characteristics of the training set sample satisfy the Gaussian distribution and get the following table  .  
650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132826446?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 4" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

We think that the two categories are equal probabilities, that is, P (=p) (cherry) = 0.5. The probability density function is as follows:  
650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132835603?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 5" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

The validation process first gives a test sample to determine whether it belongs to a car or a cherry, as shown in the table below.  
650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132843509?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 6" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132850994?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 7" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132858463?watermark/2/ Text/ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast "alt=" "Figure 8" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132906885?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 9" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132914242?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 10" "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

650) this.width=650; "Src=" http://img.blog.csdn.net/20170123132922820?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 11" "Title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

This article is selected from the big Data era of algorithms: machine learning, artificial intelligence and its typical example, click this link can be viewed in the blog post point of view of the book.  
650) this.width=650; "Src=" http://img.blog.csdn.net/20170123133126806?watermark/2/text/aHR0 cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" Picture description "title=" "style=" Border:0px;vertical-align:middle;margin:auto; "/>

want to get more wonderful articles in time, search for "blog view" or scan the QR code below and follow.
650) this.width=650; "src=" http://img.blog.csdn.net/20161128135240324 "alt=" Picture description "title=" Picture description " Style= "Border:0px;vertical-align:middle;"/>


This article is from the blog of "Blog View blog", make sure to keep this source http://bvbroadview.blog.51cto.com/3227029/1893854

Using algorithm to identify the car and cherry

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.