[PYTHON] Chainer Machine Learning Introductory Tutorial Memorandum

Trigger

A memo that I thought was important

Basics

fundemental.py


#Type confirmation
type()
#When using a formula, put spaces before and after the operator.
1 + 1
#This whitespace is also recommended by the Python coding convention PEP8.

#On the other hand, as a division operator that returns the quotient (integer part),//Symbols are available./Repeat the symbol twice, without any gaps. Division that returns the quotient as the calculation result is rounded down.(floor division)Is called.

##When using a cumulative assignment statement
count = 0
count += 1
count

##Format syntax
name1 = 'Chainer'
name2 = 'tutorial'

'{} {}welcome to'.format(name1, name2)

#Composite data type
list(list)
Tuple(tuple)
dictionary(dictionary)

#list

#Slice, an operation that retrieves multiple elements from a list at once(slice) 

#There is an addition of the value to the list. Append for list type()Is defined, which allows you to add a new value to the end of the list.
array.append(2.5)

#Tuple
#Feature
##Tuple(tuple)Is a type that combines multiple elements like a list, but unlike a list, it has the property that the elements inside cannot be changed after it is defined.

#Dictionary type(Dict type)
##Associative array. Consists of keys and elements.
#Sometimes you want to find out what keys exist in a dictionary defined by someone else. There are several useful methods in the dictionary that you can use in such cases.
keys():Get a list of keys. dict_Returns a type similar in nature to the list called keys
values():Get a list of values. dict_Returns a type similar in nature to the list values
items():Of each element(key, value)Get a list of tuples. dict_Returns a type similar in nature to the list items

#Control syntax
##Enumerate that can be used in For statements()function
If you specify the list as an iterable object, you cannot get the element number, but in some situations you may want to use the element number. In such cases, enumerate()Use the built-in function called. If you pass an iterable object to it,(Element number,element)It is an iterable object that returns the tuples one by one.

#function
#Function double()Definition of
def double(x):
    print(2 * x)

#When using multiple arguments
#Function definition
def add(a, b):
    print(a + b)

#About global variables and scope
a = 1

def change():
    global a  #Declaration that a is a global variable
    a = 2       #Assignment to a global variable

#Function execution
change()

#Check the result<-The value of a has been overwritten
a

#As you can see from the above example, change the line global a()If you add it before using the variable a in the function, the assignment to the variable a will also be made to the global variable a defined outside the function after that line.

#About Class and inheritance
See below for the easiest to understand
"https://tutorials.chainer.org/ja/src/02_Basics_of_Python_ja.html#%E3%82%AF%E3%83%A9%E3%82%B9"

useful.py


for i in range(3):
    print('{}Mr.'.format(names[i]))

#zip()function
names = ['Python', 'Chainer']
versions = ['3.7', '5.3.0']
suffixes = ['!!', '!!', '?']

for name, version, suffix in zip(names, versions, suffixes):
    print('{} {} {}'.format(name, version, suffix))
#Because it reflects the number of columns with the shortest length, the suffix'?'Is not used.

#How to write a while statement that you haven't used much (while is a way to continue infinitely, write an if statement in it, and end it with break.)
count = 0

while True:
    print(count)
    count += 1
    
    if count == 3:
        break

#How to loop using not in a While statement.
count = 0

while not count == 3:
    print(count)
    count += 1



Strengths of python

  1. Often used for data analysis and machine learning
  2. It is often used in web application development, etc.
  3. Languages that beginners can easily start

Impressions

I studied five or six years ago, but compared to the dawn of the past, the content is much more organized and easy to understand. This is good. Especially the description of the class. Cusso is easy to understand. Although it has nothing to do with what I learned this time, there was a moment in my mind where logical thinking and emotional thinking, which had been the number one task so far, were in harmony.

Recommended Posts

Chainer Machine Learning Introductory Tutorial Memorandum
Machine learning tutorial summary
Machine learning
2020 Recommended 20 selections of introductory machine learning books
[Memo] Machine learning
Machine learning classification
Machine Learning sample
Machine learning starting with Python Personal memorandum Part2
Machine learning starting with Python Personal memorandum Part1
[Translation] scikit-learn 0.18 Tutorial Introduction of machine learning by scikit-learn
About machine learning overfitting
Machine learning ⑤ AdaBoost Summary
Machine learning logistic regression
Python learning memo for machine learning by Chainer from Chapter 2
Python learning memo for machine learning by Chainer Chapters 1 and 2
Machine learning support vector machine
Studying Machine Learning ~ matplotlib ~
Machine learning linear regression
Machine learning course memo
Machine learning library dlib
Machine learning (TensorFlow) + Lotto 6
Somehow learn machine learning
Machine learning library Shogun
Machine learning rabbit challenge
Reinforcement learning 1 introductory edition
Introduction to machine learning
Machine Learning: k-Nearest Neighbors
What is machine learning?
Python learning memo for machine learning by Chainer Chapter 7 Regression analysis
Machine learning model considering maintainability
Effective Python Learning Memorandum Day 15 [15/100]
Machine learning learned with Pokemon
Data set for machine learning
[Learning memorandum] Introduction to vim
Japanese preprocessing for machine learning
Machine learning in Delemas (practice)
An introduction to machine learning
Machine learning / classification related techniques
Basics of Machine Learning (Notes)
Effective Python Learning Memorandum Day 12 [12/100]
Effective Python Learning Memorandum Day 9 [9/100]
Machine learning beginners tried RBM
Effective Python Learning Memorandum Day 8 [8/100]
Reinforcement learning 6 First Chainer RL
Machine learning with Python! Preparation
Learning memorandum for me w
Machine Learning Study Resource Notepad
Machine learning ② Naive Bayes Summary
Understand machine learning ~ ridge regression ~.
Machine learning article summary (self-authored)
About machine learning mixed matrices
Machine Learning: Supervised --Random Forest
Effective Python Learning Memorandum Day 14 [14/100]
Practical machine learning system memo
Effective Python Learning Memorandum Day 1 [1/100]
Machine learning Minesweeper with PyTorch
Machine learning environment construction macbook 2021
Build a machine learning environment
Chainer, RNN and machine translation
Python Machine Learning Programming> Keywords
Machine learning algorithm (simple perceptron)