[PYTHON] Notes on neural networks

Note what I learned from "Deep Learning from scratch"

Loss function

Indicator of poor neural network performance In neural network learning, parameters are updated using the gradient as a clue.

Mean squared error

$ y_k $ is the number of neural network outputs, $ t_k $ is the teacher data, and $ k $ is the number of dimensions of the data. The output of the neural network can be interpreted as a probability. $ (0 \ leq y_k \ leq1) $ Also, $ t_k $ is a one-hot expression.

E = \frac{1}{2}\sum_{k}(y_k-t_k)^2

Cross entropy error

$ \ Log $ has a base of $ e $. $ y_k $ and $ t_k $ are the same as the sum of squares error. The closer the output $ y_k $ is to 1, the smaller the error entropy.

E = -\sum_{k}t_k\log y_k

Mini batch learning

A certain number of chunks selected from training data = mini-batch Learning is performed for each mini-batch.

Gradient method

Find the minimum value of the loss function using the gradient. Decrease the value of the function by repeating the process of traveling a certain distance in the gradient direction from the current location. To be precise, it is called the gradient descent method.

x = x - \eta \frac{\partial f}{\partial x_0}

$ \ eta $ is the amount of updates and is called the learning rate. Such parameters adjusted by human hands are called hyperparameters.

Stochastic Gradient Descent

Gradient descent for randomly selected data as a mini-batch.

Learning procedure

0. Premise

There are adaptive weights and biases. Applying this weight and bias to training data is "learning"

1. Mini batch

Part of the data is randomly extracted from the training data. Decrease the value of the loss function of the mini-batch.

2. Gradient calculation

To find the loss function of the mini-batch, find the gradient of each weight parameter.

3. Parameter update

Update the weight parameter in the gradient direction.

4. Repeat

Repeat steps 1 to 3.

Next time, we will implement a two-layer neural network.

Recommended Posts

Notes on neural networks
Notes on Flask
Celery notes on Django
Notes on installing PycURL
[PyTorch Tutorial ③] NEURAL NETWORKS
Notes on using Alembic
Notes on SciPy.linalg functions
Notes on tf.function and Tracing
Notes on installing dlib on mac
Notes on python's sqlite3 module
Notes on * args and ** kargs
Notes on defining PySide slots (2)
[Django] Notes on using django-debug-toolbar
Notes on pyenv and Atom
Notes on defining PySide slots
[Python] Notes on data analysis
Notes on optimization using Pytorch
Notes on installing Python on Mac
Notes on studying multidimensional scaling
Notes on installing pipenv on Mac
Notes on installing Anaconda 3 on Windows
Notes on imshow () in OpenCV
Notes on installing Python on CentOS
Notes on Python and dictionary types
Notes on package management with conda
Notes on using MeCab from Python
[Golang] Notes on frequently used functions
Notes on how to use pywinauto
Notes on using post-receive and post-merge
Notes on how to use featuretools
Notes on installing Python using PyEnv
Notes on using rstrip with python.
Notes on accessing dashDB from python
Notes on how to use doctest
Notes on using matplotlib on the server
Notes on how to write requirements.txt
Notes on installing Ubuntu 18.04 on the XPS 15 7590
(Beginner) Notes on using pyenv on Mac
Effects of image rotation, enlargement, color, etc. on convolutional neural networks (CNN)
Notes for using OpenCV on Windows10 Python 3.8.3.
Notes on running M5Stick V with uPyLoader
Notes on nfc.ContactlessFrontend () for nfcpy in python
Notes for installing Sublime Text on Ubuntu
Notes on creating static files in Django
Notes on standard input / output of Go
Notes on running Azure Machine Learning locally
Notes on doing Japanese OCR with Python
Imaging of neural networks that recognize MNIST
Notes on building Python and pyenv on Mac
Notes on implementing APNs tests using Pytest
Recurrent Neural Networks: An Introduction to RNN
Notes on using OpenCL on Linux on the RX6800
Notes on KL divergence between Poisson distributions
Notes for setting up pydicom on macOS
Implemented in Python PRML Chapter 5 Neural Networks
[PyTorch] Tutorial (Japanese version) ③ ~ NEURAL NETWORKS (Neural Network) ~
Do Neural Networks Dream of Electric Rats?
Notes on using code formatter in Python