Current location - Education and Training Encyclopedia - Graduation thesis - Step by step or keep improving? Enlightenment from online Bayes
Step by step or keep improving? Enlightenment from online Bayes
We mentioned online Bayesian estimation in the last article. In this chapter, we will discuss the important idea embodied in online Bayesian estimation: we should strive for perfection, not step by step.

In the last chapter, we mentioned the concept of online Bayesian estimation for the first time: when the evidence keeps coming, Bayesian estimation does not wait until all the evidence comes before calculating the posterior probability according to all the collected observations. Instead, we start to calculate a probability based on a small amount of evidence, and then use this observation to adjust the previous estimate every time we get a new observation.

Take taking water from a boiling room as an example. You go into the boiling water room and turn on the water. You want to know if the water is boiling. In this process, you actually get the evidence step by step and use it to update your previous guess:

In this case, the observation is endless. Online Bayesian estimation allows us to estimate the final posterior probability without waiting for all possible observations, but it can

The core of Bayesian online estimation algorithm is the same as many online algorithms. The core steps of online algorithm include the following:

The opposite of online algorithm is called offline algorithm. Offline algorithm is also called batch algorithm. Offline algorithms always add new data to previous data to recalculate the results. For example, at the beginning, you have 100 data, and you use this data to get a result. When you have 65,438+000 new data, you need to merge 65,438+000 data with the original 65,438+000 data and recalculate the result with 200 data. This is an offline algorithm.

The biggest difference between online algorithm and offline algorithm is that it does not need to be recalculated, but it is adjusted on the previous calculation result: before the new 100 data is obtained, the previous calculation result is updated with 100 data, and the updated result is the same as that recalculated with 200 data. So the biggest difference between online algorithm and offline algorithm is not whether the data come one by one, but whether it needs to be recalculated or updated on the original basis.

Example of Online Algorithm: Averaging

We use an example to illustrate the difference between online algorithm and offline algorithm. If you are given 100 numbers, from x 1, x2, ..., x 100, it is easy to find their average values:

This method is to get all 100 x together. This is an offline algorithm.

And how is the online algorithm calculated?

This average is calculated based on all current data (only one x 1).

That is to say, from the initial estimate,

Set out,

This is an online algorithm for averaging.

Compared with offline algorithm, online algorithm has three advantages:

Not only that, online Bayesian, even all online algorithms embody a kind of idea of Excellence: at first, we don't seek perfection, we get a result first; On the basis of this result, we constantly accept new information to improve the original result in order to achieve the optimal goal we are pursuing.

This idea of Excellence is embodied in many fields. Give a few examples.

Example 1: numerical solution of function extreme value

When we were in high school, we learned to find the maximum or minimum value of a function. I remember that the most commonly used method is derivative. We take the derivative of the function expression and make it 0 to establish the equation. The solution of the equation is the extreme value of this function.

For example, for functions

Generally speaking, the derivative of this function is

Let the derivative be 0, that is

The antonym of analytical solution is numerical solution. The core idea of numerical solution is to strive for perfection. Let's use the picture below to explain. The blue curve in the figure is the expression of this function y, and we need to find the position of X (at the red dot) corresponding to the maximum value of this function.

The numerical solution has the following steps:

We can find that the idea of finding the numerical solution is not to try to find the position of the optimal value of the function at one time, but to approach the optimal value step by step. This is the idea of Excellence.

And our analytical solution just now is strictly deduced according to the formula. This method is best described by the idiom step by step. Compared with striving for perfection, step by step has two disadvantages: (1) You never know the answer until you know the last step, even a rough answer; (2) Once any step goes wrong, the final result will be wrong.

From this point of view, the last few big questions in junior high school and senior high school come step by step: you don't know whether your proof is right or wrong before putting forward the final result, and once any step in the middle is wrong, you can't get the correct result.

Example 2: Agile Model in Project Management

Anyone familiar with project management knows that there are two different modes of project management. The first model is a waterfall model. Waterfall model divides the development of the system into several stages, including requirements analysis, design, implementation and release. Each stage has corresponding management and control, so the quality of the system can be effectively guaranteed. The waterfall model is shown in the upper part of the figure below. We can see that each stage in the waterfall model has a fixed interconnected order, just like a waterfall flowing water, falling step by step.

However, using waterfall model to manage projects has two important disadvantages:

The opposite of waterfall model is agile model. The agile model is shown in the lower part of the figure above. We can see that when developing a project using agile model, the whole development work is organized as a series of short-term rapid iterations. Each iteration includes requirements analysis, design, implementation and testing, and continuous improvement through customer feedback until the final requirements are met.

Compared with waterfall model, the outstanding advantages of agile model development are as follows

The waterfall model and agile model mentioned here are similar to the analytical solution and numerical solution of the function extreme value we just mentioned! Both waterfall model and analytical solution adopt the idea of' step by step', while agile model and numerical solution correspond to the idea of' Excellence'.

Example 3: The simplest and feasible product

Many years ago, my colleagues and I went to talk about project cooperation with the boss of a private enterprise. This company is the best company in China to do automatic inspection of high-voltage wires. To put it simply, they made a device that can stick a long pole on the high-voltage power line and then detect whether the transmission line works normally in real time. One night at dinner, the CEO talked to me about their development ideas, and he said this:

For a small company like ours, it is impossible to develop products in one step, especially high-tech products. At first, we had to make an imperfect but usable product. So we can have a bottom in our hearts. Then take it to the scene for use. After deployment, engineers will tell us many unexpected problems at the beginning of design, and users will provide us with more demands. We will gradually improve on these bases. Although the function of our product looks so beautiful now, there were many problems when the first generation product first came out.

After so many years, I still remember clearly that what he said was an imperfect but usable product concept. Later, I learned that this is what you call the minimum feasible product (MVP). Strictly speaking, MVP refers to some products whose function is only to let designers express their core design concepts. Designers can learn through verification, learn more usage according to user feedback, and continue to develop this product.

I saw the following example on the website of Beard Institute of Technology in Hong Kong (/mvp/).

The market reaction is often unpredictable. Especially start-ups. Imagine that when you invest a lot of resources, money and time and invite a team to develop an APP// platform, it is absolutely uncomfortable to find that no one uses it after it is launched.

The best way to solve this' no one uses it after it is launched' is MVP. Instead of spending a lot of resources to develop a perfect product that they think will succeed, entrepreneurs might as well use the fastest method and use the least basic functions to create a' semi-finished product'. First put this' semi-finished product' on the market and see how the market reacts.

There are many very successful start-ups that follow the spirit of MVP. Groupon, a company with a market value of hundreds of millions of dollars, is a good example of MVP.

Founder Andrew Mei Sen set up a simple WordPress blog in the early days of Groupon, instead of spending resources to build a' perfect group buying system'. This blog regularly publishes some articles about store discounts, and discounts are just emailed to participants one by one by hand! Later, he found this blog which published articles about store discounts very popular, so Andrew decided that this idea had a market, and then he began to organize a team to develop this group buying system.

The agile model in the last example is actually trying to start an MVP first. After the introduction of MVP, developers can further understand the usage situation according to users or users' feedback, and continue to improve according to the actual situation on the basis of the previous version.

MVP and the agile mode just mentioned are actually exactly the same as the basic practice of launching products in the Internet industry recently, that is, running in small steps and iterating quickly.

Run fast in small steps and iterate quickly, that is, don't think about making a good product at once, but update it through rapid iteration to ensure that every small step runs very fast. Product development supported by the concept of rapid iteration is an online-feedback-modification-online process. Imperfection should be allowed at first, but it will gradually approach perfection through rapid iteration. One or two small problems can be found and corrected every day, and the product will be polished in less than one year.

On the other hand, if you always try to make a comprehensive layout from the beginning and try to be perfect at every step, otherwise you will not be able to go on. The problem is that once a problem is not considered at the beginning or a certain point is not considered, the cost and time cost of starting over are too expensive.

Kevin? Kelly in his best-selling book "Out of Control", had such a passage:

EXAMPLE 4: Writing a paper with excellent methods

During my stay at the Hong Kong Polytechnic University, I heard a teacher I admired very much come to the group to share with students how to write academic papers.

He told us that there are two schemes for writing a paper. The first scheme is to delay writing, wait until the idea is thought out and the simulation is done, and then start writing after the experiment is completed and the materials are obtained. In the process of writing, polish chapter by chapter in the natural order, finish one chapter, and then write the next chapter.

The second option is to start writing with a little idea, even if the idea doesn't need to be very good. In the process of writing, don't polish grammar, and write the first draft as soon as possible. After the first draft is written, show it to people around you and let them express their opinions. Then I will know what loopholes exist in the thinking of this article, how to improve it and so on. Then, the article was revised many times in a' fast iteration' way. Every time you revise, you will improve your thinking, simulate, experiment and revise your grammar, so that you can finally polish the article.

The teacher said that we must use the second method to write articles.

Now it seems that it should be. If you write an article according to the first scheme, you may never write a paper. The reason is that (1) only when you have finished writing can others give you advice. Once you find that an idea can be adopted, you may need to do experiments again, do simulations and start over, which will take too long. (2) In the process of writing an article, if you carefully polish chapter by chapter, you may find that when writing later, many parts in front need to be rewritten because of the need to modify ideas or simulation, and these carefully polished parts are wasted.

In fact, it's not just about writing scientific papers. I think this method can be used to write any article. Tian Yuandong, the head of the intelligent Go project of the Facebook Institute of Artificial Intelligence and a famous online scientific chess player, wrote the following passage in an article published in his Zhihu column, "How to read and write in a fragmented era":

This method is actually to write an MVP as soon as possible and then iteratively improve it. In this sense, it is much more important to complete an MVP quickly at the beginning than to complete a product perfectly for a long time, which also confirms this adage:

Completion is better than perfection.

In the previous example, we talked about the benefits of developing products and writing articles with excellent ideas. You should understand that the advantage of using the idea of Excellence is that the back-end users (or developers themselves) can get feedback quickly and complete the iterative upgrade quickly.

In fact, regardless of whether the developer can complete the project, there are two advantages to doing the project with the idea of Excellence.

The first benefit is peace of mind! In the previous' Example 3: the simplest and most feasible product', this can be reflected in a paragraph that the CEO said to me: At first, we must make an imperfect but usable product. So we can have a bottom in our hearts.

I have a bottom in my heart, which is peace of mind. At least in terms of scheme, this scheme is feasible. What developers need to do is to improve this feasible scheme. Even if any improvement is unsuccessful, just return the original version, at least this version can work! On the contrary, it is very stressful to do the project step by step and not know whether this product can be used until the last step! Once you can't work, you may need to start over. This is the advantage over step by step.

The second advantage is more immediate feedback. Developers improve MVP in a way of Excellence, and every time they improve successfully, they can actually get a sense of accomplishment when they finish. Once this sense of accomplishment is achieved, developers can't wait to devote themselves to the next small goal and further improve the current version.

I asked the students a question in class. Why do you insist on taking a break when you study less than 1 hour, but you can play games all night?

The reason is that the feedback chain of learning is very long, and you can get instant feedback by playing games.

The book "Games Change the World" reveals the deep mechanism that human beings will be attracted by games: instant feedback. Game developers know this well. Anything you do in the game will be immediately displayed in the form of vision and numbers.

Don't underestimate the number that flies out of the monster's head every time, don't underestimate the sound effect of the move, don't underestimate the scarlet letter that hurts blood and the blue word that enchants. They all provide the most intuitive and immediate feedback for players.

You clearly know that if you kill the monster this time, you will definitely gain experience value and get some treasures. In fact, timely feedback lets you know clearly that every operation is rewarding, and the reward is when the operation is completed! This is why we can play games all night.

Compared with learning in real life, it is the opposite. Today, you have worked hard to memorize 50 words, and you can hardly see the immediate effect: you still can't understand the old English books, and you still can't understand the English radio stations you didn't understand before. Only by persisting for many years will you suddenly find that your English level has improved. But this feedback chain is too long.

Many subjects, including English, and even many skills have a long feedback chain. Such as violin and erhu. Until you practice for a long time and get bored, the sound you play won't make people want to kick you out at once. Their efforts can't get immediate feedback, which is the main reason why many people can't settle down to study.

I can't help thinking of the song "Hand in Homework" sung by Zuo Xiaozuzhou.

God, this feedback chain is so long and the return is full of so many uncertainties. No wonder there is no motivation to hand in homework. . . .

How to break it? In fact, the core lies in how to shorten this feedback chain. For example, when memorizing words, you can introduce a reward mechanism or a self-achievement mechanism, such as giving yourself a reward for each 50-word task, or putting a heavy tick on your list of tasks!

On the other hand, we need to train our ability to delay gratification. Delayed gratification is an ability to overcome current difficulties and gain long-term benefits. In layman's terms, it is gravel. Perseverance and endurance are extremely important to a person.

Our harvest today is: