Getting started: 30 seconds to Keras Japanese translation

Purpose

I had a chance to write Keras, so I translated something like Keras's simple tutorial into Japanese. Getting started: 30 seconds to Keras Keras defines the data structure in model. The most commonly used of these is Sequential, and if you want to define a layer with a more complex architecture, use the Keras function API. It is necessary to confirm. Use the Sequential model as follows.

	from keras.model import Sequential
	model = Sequential()

Use .add () to stack layers.

from keras.layers.core import Dense, Activation

model.add(Dense(output_dim=64, input_dim=100))
model.add(Activation("relu"))
model.add(Dense(output_dim=10))
model.add(Activation("softmax"))

After creating the model, use .compile () to set up the model training process.

model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])

If you need to describe the optimizer in more detail, you can. Keras believes in dealing with problems reasonably and simply, but on the other hand, user customization is possible in any part.

from keras.optimizers import SGD
model.compile(loss='categorical_crossentropy', optimizer=SGD(lr=0.01, momentum=0.9, nesterov=True))

After determining the calculation path up to this point, the training data can be turned.

model.fit(X_train, Y_train, nb_epoch=5, batch_size=32)

You can also feed the model you created the batch manually.

model.train_on_batch(X_batch, Y_batch)

You can evaluate the created model in one line.

loss_and_metrics = model.evaluate(X_test, Y_test, batch_size=32)

To make a prediction for new data, do as follows.

classes = model.predict_classes(X_test, batch_size=32)
proba = model.predict_proba(X_test, batch_size=32)

Simple one-way deep learning can be easily described like this. The idea of deep learning is so simple, why should it be painful to implement (no, that's not the case).

For a more detailed tutorial

You can check with. Models such as LSTM are placed on the example page of github.

Getting started with the Keras Sequential model has also been translated into Japanese.

Recommended Posts

Getting started: 30 seconds to Keras Japanese translation
Getting started with Keras Sequential model Japanese translation
[Translation] Getting Started with Rust for Python Programmers
Japanese translation of self-study "A Beginner's Guide to Getting User Input in Python"
sosreport Japanese translation
Materials to read when getting started with Python
Grails getting started
Getting Started with pandas: Basic Knowledge to Remember First
Materials to read when getting started with Apache Beam
man systemd Japanese translation
streamlit explanation Japanese translation
streamlit tutorial Japanese translation
Getting started with Android!
1.1 Getting Started with Python
Getting Started with Golang 2
Getting started with apache2
Getting Started with Golang 1
Getting Started with Python
Getting Started with Django 1
Getting Started with Optimization
man systemd.service Japanese translation
Getting Started with Golang 3
man nftables Japanese translation
Getting Started with Numpy
Getting started with Spark
Dockerfile reference Japanese translation
Getting Started with Python
docker-compose --help Japanese translation
docker help Japanese translation
Getting Started with Pydantic
Getting Started with Golang 4
Program to weaken Japanese
Getting Started with Jython
Getting Started with Django 2
Getting started to develop Kivy apps for smartphones using buildozer
Introduction to Bayesian Modeling Using pymc3 Bayesian-Modeling-in-Python Japanese Translation (Chapter 0-2)