Python study day 1

[Let's build a neural network with PYTHON without using a library](http://blog.moji.ai/2015/12/ Neural net without using a library with python /) in your own environment The first day I tried it.

I read up to the neural network area with [PRML](https://www.amazon.co.jp/Pattern recognition and machine learning-above-CM-Bishop / dp / 4621061224? Ie = UTF8 & redirect = true & tag = prog4ml-22) So I will try it as a practice.

Environmental setting

I wrote that I do not use the library, but it seems that I need a python library, so I will prepare it. Some things you don't need this time, but after this series [Python Machine Learning Programming](https://www.amazon.co.jp/Python Machine Learning Programming-Theory and Practice by Expert Data Scientists-impress-top- gear / dp / 4844380605) I think I'll do it, so I put it in.

pip install --upgrade pip
pip install NumPy
pip install SciPy
pip install scikit-learn
pip install pandas
pip install matplotlib
pip install ipython

I succeeded in installing matplotlib, but when I tried to use it, I got an error (interactively). The symptom was the same as here RuntimeError when trying to use matplitlib and pylab in Python 3.3, so create the configuration file matplotlibrc and change the backend settings. did.

It looks like this in my environment

python --version
Python 3.5.0
pip list
appnope (0.1.0)
cycler (0.10.0)
decorator (4.0.10)
gnureadline (6.3.3)
ipython (4.2.1)
ipython-genutils (0.1.0)
matplotlib (1.5.1)
networkx (1.11)
numpy (1.11.1)
pandas (0.18.1)
pexpect (4.1.0)
pickleshare (0.7.2)
pip (8.1.2)
ptyprocess (0.5.1)
pyparsing (2.1.5)
python-dateutil (2.5.3)
pytz (2016.4)
scikit-learn (0.17.1)
scipy (0.17.1)
setuptools (24.0.2)
simplegeneric (0.8.1)
six (1.10.0)
traitlets (4.2.2)

Data generation

I used Scikit-learn as it is written in the data generation. The data generated by make_moon is 200 data points,

Have the information of. It is two semicircular two-dimensional data, and is sample data with linear identification added.

ipython --pylab
Python 3.5.0 (default, Oct 17 2015, 16:12:04) 
Type "copyright", "credits" or "license" for more information.

IPython 4.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
Using matplotlib backend: TkAgg

In [1]: import numpy as np

In [2]: import matplotlib.pyplot as plt

In [3]: from sklearn.datasets import make_moons

In [4]: np.random.seed(0)

In [5]: X, y = make_moons(200, noise=0.20)

In [6]: plt.scatter(X[:,0], X[:,1], s=40, c=y, cmap=plt.cm.Spectral)
Out[6]: <matplotlib.collections.PathCollection at 0x119813ef0> 

The data points output for the implementation are as follows. figure_1.png

That's all for today.

Recommended Posts

Python study day 1
Python day 1
Python study note_002
Python study notes _000
Python study notes_006
Python study note_004
Python learning day 4
Python study note_003
Python study notes _005
Study Minutes: Day 1
Python study notes_001
[1day1lang AdventCalender] day4 Python
Effective Python Learning Memorandum Day 15 [15/100]
Umemura style Python expedition Day 0
Python
Effective Python Learning Memorandum Day 6 [6/100]
Effective Python Learning Memorandum Day 12 [12/100]
Study Python with Google Colaboratory
Study from Python Hour4: Object-oriented ②
Study from Python Hour3: Functions
Sparta Camp Python 2019 Day2 Challenge
Effective Python Learning Memorandum Day 14 [14/100]
[WIP] Fluent Python Study Note
Effective Python Learning Memorandum Day 13 [13/100]
Study from Python Hour4: Object-oriented ①
Effective Python Learning Memorandum Day 3 [3/100]
Effective Python Learning Memorandum Day 5 [5/100]
Effective Python Learning Memorandum Day 4 [4/100]
Umemura style Python expedition day 1
Effective Python Learning Memorandum Day 7 [7/100]
[Introduction to Python3 Day 1] Programming and Python
[Introduction to Python3 Day 13] Chapter 7 Strings (7.1-7.1.1.1)
[Introduction to Python3 Day 14] Chapter 7 Strings (7.1.1.1 to 7.1.1.4)
Study from Python Hour2: Control statements
Study on Tokyo Rent Using Python (3-2)
[Introduction to Python3 Day 15] Chapter 7 Strings (7.1.2-7.1.2.2)
Study on Tokyo Rent Using Python (3-3)
Study, number guessing game in Python
Thoroughly study Deep Learning [DW Day 0]
Basic study of OpenCV with Python
[Introduction to Python3 Day 21] Chapter 10 System (10.1 to 10.5)
kafka python
Python basics ⑤
python + lottery 6
Built-in python
Python comprehension
Python technique
Studying python
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
python function ①
Python basics
Python memo
ufo-> python (3)
[Introduction to Python3, Day 17] Chapter 8 Data Destinations (8.1-8.2.5)
Python comprehension
install python
Python Singleton
Python basics ④