Suddenly, "Deep Learning from scratch-the theory and implementation of deep learning learned from Python" and "Deep Learning from scratch (" 2) --- Natural Language Processing " I decided to study.
However, I am very worried whether it will continue because I do not have enough time. However, when I finished "Language processing 100 knocks 2015" two or three years ago, [Amateur language processing I continued to post to Qiita as 100 knocks, and thanks to everyone's likes and comments, I was able to finish it, so this time as well I decided to help.
This time, I will make a note of what I stumbled upon in this book, chapter by chapter. If you have any mistakes, I would be grateful if you could point them out in the same way as when 100 knocks on amateur language processing.
(To other chapters of this memo: Chapter 1 / Chapter 2 / Chapter 3 / Chapter 4 / Chapter 5 / [Chapter 6](https: / /qiita.com/segavvy/items/ca4ac4c9ee1a126bff41) / Chapter 7 / Chapter 8 / Summary)
This time we will proceed with macOS Mojave.
The actual operating environment is a virtual machine in the form of Mac on Mac. If the hardware is a Mac, I would normally use it as it is, but considering trial and error when building a development environment, virtual machines are more convenient because they can be branched and returned with snapshots.
Below are the details of the environment.
item | environment |
---|---|
hard | Mac mini(Late 2012) |
Host OS | macOS Mojave version 10.14.6 |
Virtualization infrastructure | Parallels Desktop 15 for Mac Pro Edition Version 15.0.0 (46967) |
Guest OS | macOS Mojave version 10.14.6 |
Building this virtual machine is summarized in Build a macOS Virtual Machine in Parallels Desktop (https://qiita.com/segavvy/items/306bd6574a42c35d860c).
Chapter 1 is an introduction to Python. I was doing 100 knocks on language processing in Python, so this chapter feels like a review of Python. ..
The explanation is that Python is good.
I installed Anaconda according to the book. I didn't have any particular stumbling blocks, but the book only mentions about 3 lines about installation, so I'll briefly summarize the procedure.
First, "Download" from the Anaconda site (https://www.anaconda.com/distribution) listed in the book. Unfortunately it is in English.
You will be asked for the Python version, so "Download" the 3rd series 3.7 according to the book.
Run the downloaded installer to install it. This was in Japanese. I was asked where to install it on the way, so I chose "Install for myself". If you're not sharing your Mac with others, this is fine. After that, you can install it if you proceed normally.
Check the version in the terminal and run the interpreter. It seems that it has been installed correctly. By the way, the Python version was 3.7.4.
If you use macOS Standard TextEdit as your text editor, set the format to standard text. Otherwise, you will not be able to save with the extension .py
.
You can leave the "Standard Text Encoding" as "Unicode (UTF-8)" when saving.
Run cd
to the location you saved in the terminal.
Good vibes! There seems to be no problem in handling Japanese.
TextEdit isn't really good for coding, so I decided to use Visual Studio Code. You can find a lot of installation and usage by google, so here I will summarize only the installation flow.
First, install Visual Studio Code. As I mentioned earlier, in the form of Mac on Mac, when I installed it normally, I got stuck around the display, so Use Visual Studio Code for the time being with the macOS virtual machine of Parallels Desktop / segavvy / items / 802aa24d6893ef3b174c) has been summarized.
Add the "Python extension for Visual Studio Code" distributed by Microsoft for convenient use in Python. @ tkdrecord's I tried to develop Python with Visual Studio Code on Mac is helpful.
Add the "Japanese Language Pack for Visual Studio Code" distributed by Microsoft to use Japanese notation. You can refer to @ ntkgcj's Visual Studio Code [vsCode] Japanese localization.
Add flake8 as a Linter for static analysis of your code. You can refer to @ firedfly's Comfortably follow VS Code coding standards.
Add autopep8 as a Formatter that will format your code. This is also helpful to @ firedfly's Comfortably follow VS Code coding conventions.
Add autoDocstring so that you can easily write docstrings such as function descriptions. This is also helpful to @ firedfly's Comfortably follow VS Code coding conventions.
A message will appear in the lower right corner at startup. When using the integrated terminal in the environment of conda (included in Anaconda), it is better to set it so that it does not inherit the environment settings of Visual Studio Code. Do you want to change the settings? It seems that it means that, so let's say "Yes".
Now you can write your code in Visual Studio Code and easily run it with the green triangle button in the upper right corner. Good vibes!
1.5 NumPy NumPy is included in Anaconda, so you can use it as is.
1.6 Matplotlib
Matplotlib is also included in Anaconda, so you can use it as is.
The image lena.png
used in the book is published on O'Reilly Japan's GitHub repository together with other sources that appear in this book, so take this opportunity to download it all at once ( Let's clone).
First, the GitHub repository for this book (https://github.com/oreilly-japan/deep-learning-from-scratch) ).
Here, select "Clone or download" and "Download ZIP".
There is lena.png
in the dataset
folder in the download, so you can display it by writing the code to point to the path of this file according to the book.
By the way, who is this woman? For those who say, [Lenna (image data)] on Wikipedia (https://ja.wikipedia.org/wiki/%E3%83%AC%E3%83%8A_(%E7%94%BB%E5%83%8F) Please explain% E3% 83% 87% E3% 83% BC% E3% 82% BF)).
As you can see in the book, this chapter is the bare minimum of Python, NumPy, and Matplotlib. I had already touched it with Knock 100 language processing, so it was just right for review, but if you are not satisfied with the book I think it would be good to study with the reference books introduced.
That's all for this chapter. If you have any mistakes, I would be grateful if you could point them out. (To other chapters of this memo: Chapter 1 / Chapter 2 / Chapter 3 / Chapter 4 / Chapter 5 / [Chapter 6](https: / /qiita.com/segavvy/items/ca4ac4c9ee1a126bff41) / Chapter 7 / Chapter 8 / Summary)
Recommended Posts