Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function of the covariance of machine learning

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is the role of the covariance of machine learning". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "what is the role of machine learning covariance"?

The covariance covariance blog nMel 1 matlab is counted according to the column. The principal diagonal in the covariance matrix is the value of variance / (nMul 1). The symmetrical description of the relationship between different dimensions around the principal diagonal on both sides of the main diagonal. no, no, no.

The most basic concepts in statistics are the mean, variance and standard deviation of samples. First, we give a set of n samples, and the following formula descriptions of these concepts are given:

Mean:

Standard deviation:

Variance:

The mean describes the middle point of the sample set, and the information it tells us is limited, while the standard deviation describes the average distance from each sample point to the mean of the sample set.

Take these two sets as an example, [0, 8, 12, 20] and [8, 9, 11, 12], the average value of both sets is 10, but obviously the difference between the two sets is very big, the standard deviation of the former is 8.3 and the latter is 1.8, obviously the latter is more concentrated, so the standard deviation is smaller, and the standard deviation describes this kind of "dispersion". The reason why we divide by nmur1 instead of n is that it enables us to better approach the standard deviation of the population with a smaller sample set, that is, the so-called "unbiased estimation". The variance is only the square of the standard deviation.

Second, why covariance is needed

Standard deviation and variance are generally used to describe one-dimensional data, but in real life we often encounter datasets containing multi-dimensional data. The simplest thing is that we inevitably have to count the test scores of multiple subjects when we go to school. In the face of such data sets, we can of course calculate the variance independently of each dimension, but usually we want to know more, for example, whether there is some relationship between a boy's lewdness and his popularity with girls. Covariance is such a statistic used to measure the relationship between two random variables. We can emulate the definition of variance:

To measure the extent to which each dimension deviates from its mean, covariance can be defined as follows:

What is the significance of the result of covariance? If the result is positive, it means that the two are positively correlated (the definition of "correlation coefficient" can be derived from the covariance), which means that the more obscene a person is, the more popular he or she is with girls. If the result is negative, it means that the two are negatively correlated, and the more obscene girls are, the more annoying they are. If it is 0, there is no relationship between the two, and there is no relationship between wretchedness and whether girls like it or not, which is statistically called "mutual independence".

We can also see some obvious properties from the definition of covariance, such as:

III. Covariance matrix

The obscene and popular problem mentioned earlier is a typical two-dimensional problem, and covariance can only deal with two-dimensional problems, so more dimensions naturally need to calculate multiple covariances, for example, n-dimensional data sets need to calculate a covariance. It's natural for us to think of using matrices to organize these data. The definition of covariance matrix is given.

This definition is easy to understand. We can take a three-dimensional example, assuming that the dataset has three dimensions, then the covariance matrix is:

It can be seen that the covariance matrix is a symmetric matrix, and the diagonal is the variance of each dimension.

IV. Actual combat of Matlab covariance

It must be clear that the covariance matrix calculates the covariance between different dimensions, not between different samples. The following demonstration uses Matlab. In order to illustrate the principle of calculation, the cov function of Matlab is not called directly:

First of all, a 10-dimensional integer matrix is randomly generated as the sample set, with 10 as the number of samples and 3 as the dimension of the samples.

According to the formula, it is necessary to calculate the mean value to calculate the covariance. It was emphasized earlier that the covariance matrix is to calculate the covariance between different dimensions, which should be kept in mind at all times. Each row of the sample matrix is a sample and each column is a dimension, so we have to calculate the mean by column. For ease of description, let's first assign the data of the three dimensions separately:

Calculate the covariance of dim1 and dim2,dim1 and dim3,dim2 and dim3:

The elements on the diagonal of the covariance matrix are the variances of each dimension. Let's calculate these variances in turn:

In this way, we have all the data needed to calculate the covariance matrix, and we can call the cov function of Matlab to get the covariance matrix directly:

The result of the calculation is exactly the same as that of the previous data filled into the matrix.

Thank you for your reading. the above is the content of "what is the role of the covariance of machine learning". After the study of this article, I believe you have a deeper understanding of the role of the covariance of machine learning. the specific use also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report