[PYTHON] [For beginners] I want to explain the number of learning times in an easy-to-understand manner.

03745676-D21D-4044-9ACF-4DB2BC922A12.jpeg

Introduction

When I look at articles on artificial intelligence, I often see the word "** learning times **".

Every article is explained in difficult language, so it's hard to understand! I think many people thought that.

This time, I will explain the "number of learning times" in an easy-to-understand manner.

What is written

  1. What is the number of learnings?
  2. What is batch size?
  3. Summary

1. What is the number of learnings?

IMG_0593.jpeg

See the image below. This is the number of learnings.

2A4095C0-D057-4DC1-BCB0-673DBB75AA13.jpeg

I will explain one by one.

For example, you are now trying to create an artificial intelligence (AI) that separates images of dogs and cats. We prepared 3,000 images of dogs and 3,000 images of cats, for a total of 6,000 images.

0719E805-C03B-4F23-AB63-5A6AEBF1213F.jpeg

We will show these 6,000 images to AI to help them remember the characteristics of dogs and cats. However, AI cannot be smart just by "seeing 6,000 sheets once". This is the same as not being able to remember what the teacher said in class at once.

So, I try to remember it by looking at 6,000 sheets over and over again. Simply put, this "how many times you have seen (remembered)" is the number of times you have learned.

4E95A72D-60AA-4AD1-9BE2-0CC2650AFAAF.jpeg

If you see 6,000 images 3 times, you will learn 3 times. (18,000 in total) If you look at 6,000 images 5 times, you will learn 5 times. (Total 30,000 sheets) If you see 6,000 images 100 times, you will learn 100 times. (6,000,000 in total)

The more you learn, the smarter your AI will be. The first time (the first 6,000 images) was "I don't know if it's a dog or a cat ...", but when I showed it twice or three times, "I didn't know it before, but now I know! I will become smarter with the feeling.

35E13DAC-D574-4363-872D-51B683A627F8.jpeg

The basics are like this, but in reality you are learning in a slightly different way. A few years ago, some great man thought of "a more efficient and smarter way". That's how to use "batch size".

2. What is batch size?

67DD7151-5619-4996-B221-F579B260F6E7.jpeg

To remember more efficiently, we use the idea of batch size. For example, if the batch size = 600, it will look like this:

CEDEE59C-F19C-4D4C-8877-71B6ADE0065A.jpeg

Divide 6,000 images into groups of 600 each. At this time, "600" is the ** batch size **. Since 6,000 sheets are divided into 600 sheets, a total of 10 groups can be created. AI will learn for each group.

1E772CFC-8373-4BBA-BC15-FE06D7B3D53A.jpeg

There is a point to note here. The images to be grouped are not selected in order from the first image, but are selected from 6,000 images as "** random **".

7BFE5C78-3B11-494D-8FB6-34A25FD2507C.jpeg

Choose 600 from 6,000 → Group 1 Choose 600 from 6,000 → Group 2 Choose 600 from 6,000 → Group 3

Make 10 groups like this. At this time, it is not necessary to decide how many dogs and how many cats. Make a group of 600 sheets each.

ED033DE0-3286-4F2E-B0CB-C405BEED8393.jpeg

Some of you may have wondered, "If you do that and select randomly, you will get images that are selected 2.3 times or images that are never selected."

That's right. It seems that flexible AI can be created by "selecting appropriately" in this way. (It's okay if you think about it)

30E9CCEF-E0E8-44D9-A833-D6AB18310381.jpeg

Also, if you divide 6,000 sheets by batch size = 600, you can make a group of 10, and this "10" is called "** iteration **".

Iteration means "repeated" in Japanese. It is used in an atmosphere of "iteration 1, iteration 2, iteration 3", such as "1 time, 2 times, 3 times".

In other words, in this example, A 6,000 dataset was trained with batch size = 600 and iteration = 10. It will be like that.

F381744F-40AC-407C-BE26-B20327CD4F8E.jpeg

By the way, programmers call the number of learnings the "epoch number". Epoch 3 for 3 learnings, 10 learning times is epoch 10, Epoch 100 for 100 learnings, It looks like.

3. Summary

C45B39CC-ED7B-41AB-8019-3C57CFE07477.jpeg

The figure below summarizes the epoch, batch size, and iteration.

3FECD7E4-3EFE-4748-A5F9-A363FFCCA91B.jpeg

If you can understand this figure, you should be able to understand it even when the word "learning count" appears when you look at articles and papers on artificial intelligence!

Learn more about artificial intelligence / AI / machine learning

Youtube宣伝画像.jpeg

** "AI for cat allergies" ** https://t.co/4ltE8gzBVv?amp=1 We publish about machine learning on YouTube. If you have time, please take a look.

created by NekoAllergy

Recommended Posts

[For beginners] I want to explain the number of learning times in an easy-to-understand manner.
[Deep Learning from scratch] I tried to explain the gradient confirmation in an easy-to-understand manner.
I tried to understand supervised learning of machine learning in an easy-to-understand manner even for server engineers 1
[Python] I tried to explain words that are difficult for beginners to understand in an easy-to-understand manner.
I tried to understand supervised learning of machine learning in an easy-to-understand manner even for server engineers 2
I will explain how to use Pandas in an easy-to-understand manner.
[Python] I tried to summarize the set type (set) in an easy-to-understand manner.
I want to explain the abstract class (ABCmeta) of Python in detail.
I want to leave an arbitrary command in the command history of Shell
[For beginners] I want to get the index of an element that satisfies a certain conditional expression
I want to store the result of% time, %% time, etc. in an object (variable)
I tried to explain how to get the article content with MediaWiki API in an easy-to-understand manner with examples (Python 3)
I want to know the population of each country in the world.
Since I touched Tensorflow for 2 months, I explained the convolutional neural network in an easy-to-understand manner with 95.04% of "handwritten hiragana" identification.
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_3
I want to batch convert the result of "string" .split () in Python
I want to sort a list in the order of other lists
I tried to summarize Cpaw Level1 & Level2 Write Up in an easy-to-understand manner
I want to color a part of an Excel string in Python
I tried to summarize Cpaw Level 3 Write Up in an easy-to-understand manner
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_1
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_2
I want to customize the appearance of zabbix
I want to display the progress in Python!
[For beginners] Introduction to vectorization in machine learning
I made an appdo command to execute a command in the context of the app
I want to set a life cycle in the task definition of ECS
I want to add silence to the beginning of a wav file for 1 second
I want to see a list of WebDAV files in the Requests module
I tried to predict the change in snowfall for 2 years by machine learning
I want to get the file name, line number, and function name in Python 3.4
I'm an amateur on the 14th day of python, but I want to try machine learning with scikit-learn
python beginners tried to predict the number of criminals
How to get the number of digits in Python
I want to grep the execution result of strace
Count the number of parameters in the deep learning model
I want to fully understand the basics of Bokeh
I want to write in Python! (3) Utilize the mock
I want to use the R dataset in python
I want to increase the security of ssh connections
The first step of machine learning ~ For those who want to implement with python ~
I just want to find the 95% confidence interval for the difference in population ratios in Python
Find a guideline for the number of processes / threads to set in the application server
The first step for those who are amateurs of statistics but want to implement machine learning models in Python
[TensorFlow] I want to master the indexing for Ragged Tensor
I want to move selenium for the time being [for mac]
I want to use only the normalization process of SudachiPy
I want to get the operation information of yahoo route
[Python] Programming to find the number of a in a character string that repeats a specified number of times.
How to specify an infinite number of tolerances in the numeric argument validation check of argparse
How to increase the number of machine learning dataset images
I want to judge the authenticity of the elements of numpy array
Get the number of occurrences for each element in the list
[Machine learning] I tried to summarize the theory of Adaboost
I want to know the features of Python and pip
I want to make the Dictionary type in the List unique
I want to map the EDINET code and securities number
Keras I want to get the output of any layer !!
I want to align the significant figures in the Numpy array
I want to know the legend of the IT technology world
That's why I calculate the number of seats for the proportional representation in the lower house election