[PYTHON] Precautions when using Chainer

When using Chainer, the objective variable starts at 0

After trying various things, in sklearn, the objective variable can be set to [-1,0,1] etc., but in Chainer it is better to set it to [0,1,2]. Perhaps something is wrong with the calculation of the loss function.

Attention of predict

It is often written in samples as shown below.

class ChainerClassifier(BaseChainerEstimator, base.ClassifierMixin):
    def predict(self, x_data):
        return BaseChainerEstimator.predict(self, x_data).argmax(1) #argmax returns the largest index in the rows of the matrix. So the class is 0 to 1,Must be 2

Note that the argmax function returns an index as mentioned in the comments, so it would be strange if the objective variable started with -1.

Difference in polling size specification between max_pooling_2d and average_pooling_2d

With max pooling, pooling may stick out. In other words, there is no problem even if the pooling size is even for an odd number of columns or rows. And vice versa.

However, in average pooling, the number of columns and rows must be a multiple of the pooling size.

Maybe max can be calculated at least, but average cannot be calculated.

In addition, max pooling is slower.

Recommended Posts

Precautions when using Chainer
Precautions when using pit in Python
Precautions when using TextBlob trait analysis
Precautions when using codecs and pandas
Precautions when using the urllib.parse.quote function
Precautions when using phantomjs from python
Precautions when using six with Python 2.5
Precautions when using for statements in pandas
Precautions when using OpenCV from Power Automate Desktop
Summary when using Fabric
Precautions when handling Luigi
Precautions when using google-cloud library with GAE / py
Precautions when installing fbprophet
Precautions when using sqlite3 on macOS Sierra (10.12) with multiprocessing
(Personal) points when using ctypes
Environment variables when using Tkinter
Precautions when upgrading TensorFlow (to 1.3)
DEBUG settings when using Django
When using if and when using while
Use configparser when using API
Small speedup when using pytorch
A memorandum when using beautiful soup
Simple neural network implementation using Chainer
Proxy measures when using WEB API
Precautions when inheriting the DatasetMixin class
Precautions when installing tensorflow with anaconda
[Python] Be careful when using print
Precautions when creating a Python generator
ResourceWarning when using requests: unclosed workaround
When using MeCab with virtualenv python
[VS Code] ~ Tips when using python ~
When using regular expressions in Python
Precautions and error handling when calling .NET DLL from python using pythonnet
When I try to go back using chainer, it fits a little
CD when using Golang's os / exec package
Knowledge when making a bot using discord.py
Periodic execution processing when using tkinter [Python3]
What I got into when using Tensorflow-gpu
Precautions when pickling a function in python
Usual processing notes when using Google Colaboratory
Implementation of dialogue system using Chainer [seq2seq]
Precautions when solving DP problems with Python
What Rubyist should know when using pyenv
Favicon placement (when using Python, Flask, Heroku)
[python, multiprocessing] Behavior for exceptions when using multiprocessing
DB settings when using Django + SQLAlchemy + Alembic
Implementation of "blurred" neural network using Chainer
Error, warning when using TensorFlow on Mac
Precautions when adding items using DateField to an existing model later in Django
Error that occurred in OpenCV3 and its solution Precautions when using OpenCV3 on Mac