This is a short introductive tutorial for keras. Keras is a high-level interface for machine learning with neural networks.
In order to introduce and illustrate the principle of neural networks, we will consider the well-known classification problem of iris species.
Iris setosa, Iris versicolor and Iris virginica are closely-related species. They differ by the size of their petal and sepal.
For instance the dataset below list the height and width of the petals of different specimens, and whether these specimens belong to the species setosa.
In [1]:
import pandas as pd
df = pd.read_csv('./data/setosa/train.csv')
df.head(6)
Out[1]:
Neural networks are an extremeley versatile machine learning technique.
They consist in stacking individual units (a.k.a. artificial neurons) that :
tanh function).Training the network consists in finding the right values for the weights $w_i$.
In order to solve the problem of classification for Iris setosa, we will start with the simplest kind of neural network: a single layer network.
For the non-linear function, we will choose the sigmoid function, since its output is between 0 and 1 and can thus easily be interpreted as a probability.
With this model, we have: $ p_{setosa} = f( w_0 + w_1\times height + w_2 \times width )$, and training the model consists in finding $w_1$ and $w_2$.
We will first build a neural network by hand here, before using keras to automate the process.