Many people said, "I want to study machine learning and artificial intelligence, but I'm stumbling on the environment construction before learning programming **", and I wrote an article ** to never fail in the environment construction. It was decided to do. There is more than one way to build a machine learning environment with Python, and you can try installing it with Homebrew, Anaconda, or any other method. It's nice to have multiple methods because even if you make a mistake, you can try other methods, but ** it can be a cause for beginners to wonder which method to build the environment **.
Therefore, in this article, we are targeting the following people.
Please refer to this article to build an environment that will not fail.
If you find this article helpful, I would be grateful if you could like this article.
I am ** Kikagaku Co., Ltd. ** Representative Director ** Ryosuke Yoshizaki ** My name is. Currently, "** Machine Learning / Artificial Intelligence De-Black Box Seminar **" and "** Machine Learning Online Tutor ** ”is operated.
Affiliation | Department / Department | research content | Punishment |
---|---|---|---|
Maizuru National College of Technology | Department of Electronic Control Engineering | Study image processing (AR) | |
Maizuru National College of Technology | Department of Electrical and Control Systems Engineering | Research on robotics, system control, and optimization | |
Kyoto University Graduate School | Graduate School of Informatics (Kano Lab) | Appliedresearchonmachinelearningforthemanufacturingindustry | ADCHEM2016BestPaperAward,ChemicalEngineeringSocietyTechnologyAward |
SHIFT Inc. | President's office | Research on software test automation by artificial intelligence | CEDEC 2016 stage |
Carat Co., Ltd. | Director and COO | Optimal itinerary proposal app (natural language processing / optimization) | |
Kikagaku Co., Ltd. | PresidentandCEO | Machinelearning/artificialintelligenceseminarOrOnlinetutor |
Providing educational services for machine learning and artificial intelligence
We provide information on machine learning and artificial intelligence from a business perspective and recommended reference books.
President and CEO Ryosuke Yoshizaki Twitter:@yoshizaki_kkgk Facebook:@ryosuke.yoshizaki Blog: Blog of Kikagaku representative
Now that the introduction is long, let's start building the environment!
Depending on the environment, the settings may be successful. Currently, my PC has the latest Mac OS.
· MacOS Sierra 10.12.3
If it doesn't work, please try this.
Introduce a package manager called ** Homebrew . Those who do not program on a daily basis may not be familiar with it, but in the world of programming, the work that humans were doing as " Search on the Web → Download files for installation → Perform installation at hand " is automatically performed. There is a mechanism that can be done with one command. That is " Package Manager **".
With this, 100 people. It will download and install the ** software you need in the programming world with just one command.
On Mac, a package manager called "** Homebrew **" is famous, and there is also "MacPorts", but recent Web information is mostly written in Homebrew, so ** Homebrew is recommended. **is.
First, access the ** Homebrew ** site.
Copy this ** top script **.
We use "** Terminal ", which is commonplace for programmers. That is the " black screen **".
If you are using ** spotlight , search for " terminal **" and the following screen will appear. Press Enter to bring up the terminal.
If you are not sure, open "** Application " from " Move **" on the upper left of the mac Finder.
I think there is "** Terminal " in " Utility **".
When opened, ** Terminal ** started up like this.
Now, let's install Homebrew. To install, just paste the script you copied with Homebrew into the terminal and press Enter **.
What do you think. Isn't it very easy?
On the way, you will see a screen like this.
If you want to continue the process, it says "Return", so press Enter (Return).
Next, you will be asked to enter the password. Enter the ** password set on your Mac . At this time, if you are new to the terminal, it is often mistaken for an error as " Characters are not reflected **", but since the characters have been entered properly, I thought that I was deceived and the characters Try typing and pressing Enter. If there is no problem, I think that I will proceed to the next process.
After waiting for about 5 minutes, the installation will be completed like this.
The commands used in the terminal are basically the same as ** Linux **.
And commands using Homebrew use brew
.
For example, if you want to install something, type the following in the terminal:
Software installation using Homebrew
$brew install software name
What do you think. Isn't it very intuitive?
As long as Homebrew is installed correctly, you can manage the software with commands like the one above. Now, let's check if Homebrew, which is the main subject, is installed correctly.
Check if Homebrew is installed correctly
$ which brew
Only this.
This command which
is a command to find out where the program that is the source of the command to be used is stored, but this will cause blank characters because nothing is saved if it is not installed. It will return, and if it is installed properly, it will return the location where it was saved.
As you can see, it returns that it is saved in the location / usr / local / bin / brew
, so you can see that the installation was successful.
If you don't get anything back, you haven't installed correctly, so repeat the above steps again.
For Mac, Python is installed from the beginning, but ** Python installed from the beginning is a version that is a little troublesome to handle Japanese, which is 2 series **, so this time I will use Python 3 series. I will install it (if you don't know, you don't have to worry about it).
If you already have Python 3 installed, you do not need to follow the steps in this chapter. So let's first check if Python 3 is installed.
Use the which
command you used earlier to verify that Homebrew installed it correctly.
Check if Python 3 is installed
$ which python3
Nothing is returned, so you can confirm that it has not been installed. Now let's install Python3.
If you use Homebrew, the installation is completed with one command below.
Install Python3
$ brew install python3
Now when you press Enter, the installation commands will be executed one after another as shown in the image below.
And finally, the installation is completed when the following screen is displayed.
Let's check if it is installed.
Check if it is installed
$ which python3
As you can see, the location where python3 is saved is returned, so the installation is complete.
Also, when you install python3
via Homebrew, you should also have the command pip3
installed.
Check if pip3 is installed
$ which pip3
This pip3
is a tool for managing a convenient tool called ** library ** used in python.
Both brew
and pip3
are used to install something, but how do you use them properly?
The answer is "** Install software in Mac is HomeBrew " and " Install libraries in Python is pip **".
Homebrew manages software such as python3
and pip3
used on the Mac, and pip3
manages libraries for use with that python3
.
Homebrew
|- python3
|- pip3
|-Library used by python3...
|- etc...
I installed Python3, but the installed version changes from time to time (basically to install the latest version).
Now let's check the version I installed.
Checking the version of python3
$ python3 --version
My version was 3.6.0
.
If the first number starts with 3
, it's basically okay.
Install numpy
(linear algebra), scipy
(computer algebra), matplotlib
(plot), and pandas
(database), which are basically essential libraries for everything. Let's do it.
Install numpy and matplotlib
$ pip3 install numpy #linear algebra
$ pip3 install scipy #Computer algebra
$ pip3 install matplotlib #drawing
$ pip3 install pandas #Data manipulation
Installation will be completed in a few minutes.
scikit-learn
A machine learning package packed with models for classification and prediction. In data analysis with Python, it has a position that can be said to be almost de facto.
scikit-install learn
$ pip3 install scikit-learn
Chainer
It is a domestic library famous for implementing deep learning (neural network). There are plenty of Japanese references, and it is as popular as Google's Tensorflow.
Install Chainer
$ pip3 install chainer
Jupyter notebook
It is an environment where you can easily execute Python. We recommend that beginners use this Jupyter notebook to check the operation of the program.
Install Jupyter Notebook
$ pip3 install jupyter
This completes the environment construction for learning "machine learning".
The necessary software installation is complete, but for a little smoother programming, install the "** Editor " called " Atom ". " Editor **" is basically the same as the familiar Notepad, and is for writing and saving characters. However, editors in recent years have evolved so much that they can be colored to make programming easier to read, or have a terminal built into the editor to run programs smoothly.
Among the editors, the one that the author Yoshizaki recently recommends is "** Atom **". It's made by GitHub, so it's very easy to handle and stable.
To install Atom, download the installation file from the Official Page.
Extract the downloaded file (double-click it to extract it), and if you can extract it, you're done. Make a copy of this file to the application folder described in the terminal first.
This completes the installation of Atom itself.
When you open the Atom application, you will see a screen like this.
Let's simplify the settings inside Atom.
Select "Install a Package" on the right screen immediately after opening.
If you have closed the Welcome Guide, please use the toolbar at the top. "Atom"-> "Preferences"-> "Install" at the bottom left But you can get to the same screen.
Search for "terminal" on this search screen.
Please install "platformio-ide-terminal" from the search results.
Once this is installed, you can launch a terminal within Atom's editor, where you can write and run the program together, which makes development a lot easier. This setting is highly recommended for those who love the word "** productivity **".
Thank you for building the environment on Mac. Were you able to build the environment smoothly?
I used Homebrew to install it in a very clean state, so if you need other libraries in the future, you can use the pip3
command and it will work, so don't worry.
We are very much looking forward to learning machine learning and revolutionizing various industries, and we hope that this article has helped you. If you found this article useful, we would appreciate it if you could like the article.
We provide information on machine learning and artificial intelligence from a business perspective and recommended reference books.
President and CEO Ryosuke Yoshizaki Twitter:@yoshizaki_kkgk Facebook:@ryosuke.yoshizaki Blog: Blog of Kikagaku representative
Until the end Thank you for reading.