Current location - Training Enrollment Network - Mathematics courses - Mathematical analysis of diaosi chasing goddess
Mathematical analysis of diaosi chasing goddess
Foreword:

Thanks to the help of Daniel and Yizhen in the WeChat group, I was able to finish this article. At the beginning of this article, my friends around me always go away after talking to many girls. Although the process is different, the starting point and the ending point are roughly the same, which is related to the cannon fodder mode I saw before (the first half is cannon fodder mode), so I don't know if I can use some statistical methods to summarize this phenomenon and find out the law, so that the majority of male diaosi can find their suitable other half.

As we all know, things involving feelings in life are so complicated that it is almost impossible to consider all possible factors. To this end, let's simplify the reality, make some reasonable assumptions and consider a relatively simple situation.

In order to simplify practical and complicated problems, we make the following reasonable assumptions:

1. Suppose a girl is willing to start a love relationship with a boy for a period of time, during which there are n boys pursuing this girl. N boys confess to girls in different orders, that is, there is no situation that two or more boys confess to girls at any moment, and any order is completely equal in probability.

2. In the face of boys after confession, girls can only make two choices: acceptance and rejection, and there is no ambiguity or other choices.

3. At any moment, a girl can only fall in love with one boy at most, and there is no such thing as pedaling more than one boat.

The rejected boy will not pursue this girl again.

Based on the above assumptions, we want to find such a strategy to maximize the probability of girls choosing to accept it for the first time.

That boy is n.

Consider the simplest strategy first. If a boy confesses to a girl, the girl will choose to accept it. Under this strategy, it is obvious that the probability of girls finding their Mr. Right is 1/n, and when n is large, this probability is very small. Obviously, this strategy is not optimal.

Based on the above assumptions and models, we put forward such a strategy: for the m-th person to express his feelings, no matter how the girls feel, they choose to refuse; After a boy confesses to a girl, as long as the number of this boy is greater than the previous m boys, that is, this boy is more suitable for girls than the previous m boys, then this girl chooses to accept, otherwise she chooses to refuse.

Let's take N=3 as an example:

There are six arrangements for three boys to pursue girls:

1 2 3

1 3 2

2 1 3

2 3 1

3 1 2

3 2 1

If girls adopt the simplest strategy mentioned above, then only the latter two arrangements will choose Mr. Right, with a probability of 2/3! = 1/3。

If girls adopt the strategy we proposed above, here we take M= 1, that is, regardless of whether the first person is excellent or not, girls choose to refuse. Then for the follow-up suitor, as long as he is more suitable for girls than the first boy, he will choose to accept, otherwise he will refuse. Based on this strategy, girls will encounter "3" when they make an accepted choice for the first time under the three arrangement orders of "1 3 2", "2 1 3" and "2 3 1", so we will increase this probability to 3/3! = 1/2。

Now our question boils down to, for a general n, what kind of m will maximize this probability? In this model, the top m boys are called "cannon fodder", and no matter how good they are, they will be rejected.

Model building:

In this part, according to the above model assumptions, we first find out for the given m and N( 1.

1 numbers to n are arranged in * * *! A possibility. When the number n appears in the p position (m

1, n is in the p position.

2. The number from m+1to P- 1 is less than the maximum number of the first m bits.

Using the knowledge of permutation and combination in mathematics, it is not difficult to know that there are permutations that meet the above two conditions.

In this way, for given m and n, p can be changed from M+ 1 to n, and the given m and N*** are obtained after summation and simplification.

This order meets the requirements.

The conclusion is that the probability of meeting Mr. Right when a girl chooses to accept it is

Model solution: (If you are not interested, you can skip this part of the derivation directly)

In this part, we solve the value of m when this expression is maximized.

memory function

When the independent variable is m, the function gets the maximum value.

Therefore:

So m should satisfy

We know that when x>0, in (1+x) <; x;

When x-> 0, in (1+x) ~ x 。

So the inequality on the left

So:

When n is relatively large, M≈N/e can be obtained from the right inequality in the same way, and the above e is a natural logarithm.

If [x] is the largest integer not greater than x, we can guess that when m takes [N/e] or [N/e]+ 1, the expression gets the maximum value.

Using MATLAB simulation, the above conclusion is correct.

Result analysis:

From the above analysis, we can draw the following conclusions: In order for a girl to meet Mr Right with the greatest probability when she chooses to accept a boy for the first time, she should adopt the following strategies:

Before rejection, M=[N/e] or [N/e]+ 1 suitor. When the latter suitors are more suitable than the first m suitors, accept them, otherwise refuse them.

Now talk about marriage:

Now the problem for us is that if boyfriend and girlfriend and a boy want a girl to propose, the boy's four characteristics are unattractive, bad personality, short height and low progress. Would you please judge whether this girl will get married?

This is a typical classification problem. Becoming a math problem is to compare the probabilities of P (not handsome, bad personality, short stature and poor progress) and P (not married | (not handsome, bad personality, short stature and poor progress). Whoever has a high probability, I can give the answer whether to marry or not!

We need to ask for P (not handsome, bad personality, short stature, not self-motivated), which we don't know, but can be transformed into three requirements by naive Bayes formula.

P (not handsome, bad personality, short height, not self-motivated | married), p (not handsome, bad personality, short height, not self-motivated), p (married) (as to why you can ask, we will talk about it later, then it would be great to convert the amount you want to ask into other available values, which is equivalent to solving our problem! )

So how are these three quantities obtained?

Based on the statistics of known training data, the solution process of this example is given in detail below.

Recall that the formula we asked for is as follows:

Then all I have to do is get P (not handsome, bad personality, short height, no ambition | to get married), P (not handsome, bad personality, short height, no ambition) and P (to get married). Ok, let me get these probabilities separately, and then I will get the final result.

P (not handsome, bad personality, short height, not self-motivated | to get married) = p (not handsome | to get married) *p (short height | to get married) *p (not self-motivated | to get married), then I will count the last few probabilities separately and get the probability on the left!

Wait, why is this happening? Students who have studied probability theory may have a feeling that the conditions for the establishment of this equation need to be independent of each other!

But why do you need to assume that features are independent of each other?

1, let's think of it this way. Without this assumption, our estimation of these probabilities on the right is actually impossible. In this way, our example has four characteristics, among which handsome includes {handsome, not handsome}, personality includes {bad, good, explosive}, height includes {tall, short, medium}, and progress includes {not making progress}.

36. Computer scanning statistics is possible, but there are often many features in real life, and the value of each feature is also very large, so it is almost impossible to estimate the value of the late probability through statistics, which is why it is necessary to assume that the features are independent.

2. If we don't assume that the features are independent of each other, then we need to look in the whole feature space when doing statistics, such as statistical P (not handsome, bad personality, short height, not motivated | married).

Under the condition of marriage, we need to find the number of people who meet four characteristics at the same time, that is, unattractive, bad personality, short height and low progress. In this case, due to the sparsity of data, it is easy to count to 0. This is inappropriate.

Well, above, I explained why it can be divided into open form and continuous form. Then let's start solving it!

We arrange the above formula as follows:

I will make statistical calculations one by one (

When the amount of data is large, according to the central limit theorem, frequency equals probability. This is just an example. I'll do the statistics.

)。

P (marriage) =?

First of all, let's sort out the training data. The number of marriage samples is as follows:

P (marriage) = 6/ 12 (total number of samples) = 1/2.

P (not handsome | married) =? The number of satisfactory samples is as follows:

So how many people are not handsome when P (not handsome | married) = 3/6 = 1/2 is married?

P (bad personality | marriage) =? The number of satisfactory samples is as follows:

P (bad personality | marriage) = 1/6.

P (short | married) =? The number of satisfactory samples is as follows:

P (short | married) = 1/6.

P (no progress | getting married) =? The number of satisfactory samples is as follows:

Then p (no progress | getting married) = 1/6.

We began to find the denominator, P (not handsome), P (bad personality), P (short), P (not motivated).

The statistical samples are as follows:

As shown in red above, there are four unattractive statistics, so p (unattractive) = 4/ 12 = 1/3.

The statistics of bad personality are shown in red in the above figure, accounting for 4, so P (bad personality) = 4/ 12 = 1/3.

The statistics of height and height are shown in red, accounting for 7, so P (height and height) = 7/ 12.

As shown in red above, there are four people who are not motivated, so P = 4/ 12 = 1/3.

Here, P (not handsome, bad personality, short height, no ambition | marriage) has been found out, and I can bring it here.

Let's ask for P in the same way (unmarried | not handsome, bad personality, short stature, not self-motivated), exactly the same way. In order to facilitate understanding, I will also come here to help understand. First, the formula is as follows:

Next, I will also make statistical calculations one by one, where the denominator is the same as in the above formula, so our denominator does not need to be statistically calculated!

P (not married) =? According to the statistical calculation, it is as follows (red is the condition):

P (unmarried) =6/ 12 = 1/2.

P (not handsome | not married) =? Statistically qualified samples are as follows (red is the condition):

P (not handsome | not married) = 1/6.

P (bad personality | not married) =? According to statistics, the calculation is as follows (red is the condition):

P (bad personality | unmarried) =3/6 = 1/2.

P (short | unmarried) =? According to statistics, the calculation is as follows (red is the condition):

P (short | unmarried) = 6/6 = 1.

P (no progress | not married) =? According to statistics, the calculation is as follows (red is the condition):

Then p (no progress | no marriage) = 3/6 = 1/2.

Then according to the formula:

P (unmarried | not handsome, bad personality, short stature, not self-motivated) = ((1/6 *1/2 *1/2) *1/2)/(12)

Obviously (1/6 *1/2 *1*/2) > (1/2 *1/6 *1.

So there is P (unmarried | not handsome, poor personality, short height, not self-motivated) > P (married | not handsome, poor personality, short height, not self-motivated)

So we can give this girl the answer according to Bayesian algorithm, that is, don't marry! ! ! !

After reading it, I briefly thought about it. In the cannon fodder mode, the top M boys become the role of cannon fodder, and no matter how excellent they are, they will be rejected.

Suppose a woman's cleverest youth is 18-28 years old, during which she will meet almost all suitors in her life (ignored before and after), and the suitors are evenly distributed, then a woman will accept the pursuit from18+10/e = 21.7, that is, 20.

In the article, only N boys' confession order is completely random, and the time interval between two adjacent times is not considered. If the time factor is also taken into account, in a relatively short period of time, it can be approximately assumed to be a homogeneous Poisson process, which can not only draw the conclusion that girls should choose the M-th boy above, but also find the best time for boys to express their love at t = t/e, for example, the time period is four years in college, then T/E = 1.4438+05. In other words, the best time for boys to express their love during the four years of college is at the end of the third semester or during the winter vacation.

If this period of time is long, it is difficult for boys to estimate the parameters of each segment when modeling a non-homogeneous Poisson process or a piecewise homogeneous Poisson process, and everyone's future experience will be different, so it is impossible to find a unified parameter set.

Friend, if your pursuit of a girl is rejected, after reading this article, you will suddenly find that maybe it's not your fault, maybe you are really excellent, but unfortunately, you have become "cannon fodder".

I hope these seemingly complicated derivations and models can inspire you. Don't be sad and lost because of one refusal, cheer up.