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."


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.

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 (which occurs) is different from the probability of event B under the condition of event A; However, there is a definite relationship between the two, 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:

On the basis of understanding Bayesian theorem, the classification model based on naive Bayes can be well understood. Information classification is the most basic module in information processing, and each piece is composed of several features, whether long or short, so that all features can be treated as a vector set w= (w1,w2,w3,...,wn), where WI is the first feature. The classification of information can also be regarded as a collection of categorical markers c={c1,c2,c3,...,cm}. Prior to feature learning, the relationship between feature WI and the classification tag CJ is not a deterministic value, so it is necessary to calculate the P in advance (c| W), that is, in the case of feature WI, information belongs to the probability of classification mark C, according to Bayesian calculation, the formula is as follows:

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 documents as granular.
(Supervised learning is the essence of supervised classification, and 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. )
Assuming that the characteristics of the training set sample satisfy the Gaussian distribution, the following table is obtained.

We think that the two categories are equal probabilities, that is, P (=p) (cherry) = 0.5. The probability density function is as follows:

The verification process first gives a test sample to determine whether it belongs to a car or a cherry, as shown in the table below.

The criteria for verification are: the obtained sample belongs to the cherry or the posterior probability of the promoter of the car.

The above formula is used to calculate the posterior probability of a vehicle,

The posterior probability of the cherry is obtained by using the above formula. Evidence factor evidence (usually constant) is used to normalized the sum of the posterior probabilities of various types.

The evidence factor is a constant (usually a constant in the Gaussian distribution), so it can be neglected by simply calculating the molecules in the posterior probability formula. The sample's eigenvalues are then judged to determine the category to which the sample belongs.

Among them, μ=0.8,α=0.018257419, both are the Gaussian distribution parameters of the training set sample. Note that the probability density is calculated instead of the probability.

It can be seen from the above calculation that the posterior probability molecule of the vehicle is larger, so it is possible to predict that the sample belongs to the sub-vehicle.
This article is selected from the "Big Data Era algorithm: machine learning, artificial intelligence and its typical example", click this link can be viewed on the website of the blog post View the book.
                     

Want to get more good articles in time, you can search "blog point of View" or scan the QR code below and follow.
                       

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.