Python machine learning without the need for a development environment. In Azure notebook (jupyter notebook on Azure), "Let's learn by programming with Ayaka Ikezawa! I took a mathematics course for machine learning [Bayes' theorem]

Azure Notebook is a jupyter notebook environment available for Microsoft accounts. It seemed convenient, so I tried it.

Click here for the theme Learn by programming with Ayaka Ikezawa! Mathematics Course for Machine Learning [Bayes' Theorem] https://codeiq.jp/magazine/2017/03/49158/

Recommended for those who are not good at math, cannot step into the contents of machine learning, and have hurdles in building a python environment. You can run python code with just an MS account. It takes about 5 minutes.


Create a new Notebook in Azure Notebook

If you access https://notebooks.azure.com/ and register the necessary information (Get Start), this screen will appear. image Create a new Notebook with + new. I chose Python 3.5 as the language and bayes the file name. image

When you select the created file, a screen like this will appear. image

Let's use it immediately! !!

Try running the first python program. image Paste it in the text box that says in: image You can do it with the button. The result is as follows. image Since print is not required in jupyter (* 1), I removed the print statement and executed it. image

Other places where I got caught

It will be done like this, so let's try it. Other than print, the last application in the tutorial is as follows. 1.from janome.tokenizer import Tokenizer → The missing library could be installed with the following.  !pip install janome

In jupyter, you can execute commands by prefixing with!. For example, you can get a list of files by typing! Ls -l.

2. Create folders and files

The last application needs to create files and folders before it works. I executed the following command.

!mkdir train_data
!mkdir train_data/baseball
!mkdir train_data/soccer
!echo baseball > train_data/baseball/baseball.txt
!echo soccer> train_data/soccer/soccer.txt
!echo baseball > test.txt

Click here for the one that was executed to the end (print is removed) image


The error in the print statement is due to Python3, not Python2.
This is because the print statement is a function in the Python3 series.

If you modify print to Python3 type description, the result will be as follows. image Since jupyter notebook is a specification that outputs the result as out when only the variable value is described, For convenience, we often do not use print.


Have a good jupyter life! !!

Recommended Posts

Python machine learning without the need for a development environment. In Azure notebook (jupyter notebook on Azure), "Let's learn by programming with Ayaka Ikezawa! I took a mathematics course for machine learning [Bayes' theorem]
Introducing the book "Creating a profitable AI with Python" that allows you to learn machine learning in the shortest course
Build a machine learning application development environment with Python
Machine learning with Jupyter Notebook in OCI Always Free environment (2019/12/17)
How to quickly create a machine learning environment using Jupyter Notebook on macOS Sierra with anaconda
How about Anaconda for building a machine learning environment in Python?
Building a Windows 7 environment for getting started with machine learning with Python
Learn machine learning anytime, anywhere in an on-demand Jupyter Notebook environment
Creating a development environment for machine learning
I installed Pygame with Python 3.5.1 in the environment of pyenv on OS X
I tried to predict the change in snowfall for 2 years by machine learning
Learn Naive Bayes implemented in Python 3.3 on a web page obtained with the Bing API. Let the sentences be classified