An introduction to Python Programming

A memorandum for doing the program

table of contents

1.First of all 2. Operating environment 3. Body

1.First of all

Since this article forgets what I learned, the aim is to improve my ability to explain my own things while establishing what I have learned by writing it as a memorandum in this article. I want to do various things that Python can do, so I haven't decided on any tags other than Python.

2. Operating environment

--windows 10 (laptop)

3. Body

--Read Deep Learning from scratch

Sites that I referred to when reading [github][https://github.com/oreilly-japan/deep-learning-from-scratch]

Chapter 1 Introduction to Python Here, from the installation of python, the basic operation of python and the explanation of libraries such as Numpy and Matplotlib are written.

Chapter 2 Perceptron The perceptron receives a plurality of signals and outputs one signal according to the contents. The output signal y is the input signal x1, x2, the weight w1, w2, and the threshold value θ.

f(x) = \left\{
\begin{array}{ll}
1 & (w1x1+w2x2\geq θ) \\
0 & (w1x1+w2x2 \lt θ)
\end{array}
\right.

Can be expressed as. In addition, AND gates, NAND gates, and OR gates are mounted using perceptrons.

def AND(x1,x2):
    w1,w2,theta=0.5,0.5,0.7
    tmp=x1*w1+x2*w2
    if tmp>theta:
        return 1
    else:
        return 

Using a matrix, it becomes as follows.

import numpy as np
def AND(x1,x2):
    w=np.array([0.5,0.5])
    x=np.array([x1,x2])
    b=-0.7
    tmp=np.sum(w*x)+b
    if tmp>0:
        return 1
    else:
        return 0

If you enter appropriate values (x1, x2) = (0,0), (0,1), (1,1), (1,0) for x1, x2

a=AND(0,0)
b=AND(0,1)
c=AND(1,1)
d=AND(1,0)
print(a,b,c,d)

>> 0 0 1 0

It can be seen that it is operating correctly. Editing in the future

Recommended Posts

An introduction to Python Programming
[Introduction to Python3 Day 1] Programming and Python
An introduction to Python for non-engineers
[Python Tutorial] An Easy Introduction to Python
Introduction to Python language
Introduction to OpenCV (python)-(2)
An introduction to Python for machine learning
An introduction to Python for C programmers
[What is an algorithm? Introduction to Search Algorithm] ~ Python ~
Introduction to Python "Re" 1 Building an execution environment
Introduction to Programming (Python) TA Tendency for beginners
AOJ Introduction to Programming Topic # 1, Topic # 2, Topic # 3, Topic # 4
An introduction to private TensorFlow
An introduction to machine learning
AOJ Introduction to Programming Topic # 7, Topic # 8
Introduction to serial communication [Python]
[Introduction to Python] <list> [edit: 2020/02/22]
An introduction to Bayesian optimization
Introduction to Python For, While
An introduction to Python distributed parallel processing with Ray
Reading Note: An Introduction to Data Analysis with Python
[Introduction to Udemy Python 3 + Application] 58. Lambda
[Introduction to Udemy Python 3 + Application] 31. Comments
Introduction to Python Numerical Library NumPy
An introduction to Mercurial for non-engineers
Practice! !! Introduction to Python (Type Hints)
[Introduction to Python] <numpy ndarray> [edit: 2020/02/22]
[Introduction to Udemy Python 3 + Application] 57. Decorator
Introduction to Python Hands On Part 1
[Introduction to Python3 Day 13] Chapter 7 Strings (7.1-7.1.1.1)
[Introduction to Python] How to parse JSON
[Introduction to Udemy Python 3 + Application] 56. Closure
[Introduction to Python3 Day 14] Chapter 7 Strings (7.1.1.1 to 7.1.1.4)
Introduction to Protobuf-c (C language ⇔ Python)
[Introduction to Udemy Python3 + Application] 59. Generator
[Introduction to Python3 Day 15] Chapter 7 Strings (7.1.2-7.1.2.2)
[Introduction to Python] Let's use pandas
[Introduction to Python] Let's use pandas
[Introduction to Udemy Python 3 + Application] Summary
Introduction to image analysis opencv python
[Introduction to Python] Let's use pandas
Introduction to Python Django (2) Mac Edition
An alternative to `pause` in Python
[AWS SAM] Introduction to Python version
[Introduction to Python3 Day 21] Chapter 10 System (10.1 to 10.5)
An introduction to Python that even monkeys can understand (Part 3)
An introduction to functional programming to improve debugging efficiency in 1 minute
An introduction to Python that even monkeys can understand (Part 1)
An introduction to Python that even monkeys can understand (Part 2)
Introduction to MQTT (Introduction)
Introduction to Scrapy (1)
[Introduction to Udemy Python3 + Application] 18. List methods
[Introduction to Udemy Python3 + Application] 63. Generator comprehension
Introduction to Scrapy (3)
Updated to Python 2.7.9
[Introduction to Udemy Python3 + Application] 28. Collective type
[Introduction to Python] How to use class in Python?
Introduction to Supervisor
Python programming note
Introduction of Python
IPynb scoring system made with TA of Introduction to Programming (Python)