| ... | ... | @@ -26,28 +26,31 @@ $`y_n = \sum_i w_{i,n} x_{i,n}`$ |
|
|
|
Le problème c'est que une combination lineaire avec poids est une fonction lineaire, dont on ne peut pas apprendre a approximer fonctions plus complexes avec ça; on deverait avoir un élement de non-linearité. On fait ça en faisant la multiplication du output du neuron fois une "fonction de activation" $`f_{act}`$; le neuron est activé (i.e. donne un output different de zero) seulement si le valeur de $`f_{act}(y_n)`$ est different de zero.
|
|
|
|
Si la fonction de activation est une fonction non-lineaire, nous avons obtenu ce que nous voulous; un neuron que fait la combination des inputs de manière non-lineaire. Vous aurais utiliser deux fonctions de activation: la [ReLU](https://en.wikipedia.org/wiki/Rectifier_(neural_networks)) et la [sigmoid](https://en.wikipedia.org/wiki/Sigmoid_function) pour ce travail.
|
|
|
|
|
|
|
|
Vous pouvez voir une representation graphique
|
|
|
|
 (figure p )
|
|
|
|
Une representation graphique de perceptron est (par https://towardsdatascience.com):
|
|
|
|

|
|
|
|
|
|
|
|
Now that you have a simple model of neuron, you can connect it to other neurons; while the brain has very complex connections and feedbacks, the simplest way of connecting neurons is to connect them in layers:
|
|
|
|
$figure layered network$.
|
|
|
|
Maintenant il faut connecter des neurons; la manière la plus simple est de les connecter en couches; a partir des inputs, on aura une couche de neurons; chaque neuron prends les inputs, les combine, et donne un valeur de output. Le conjoint des outputs de la couche serà le input de la couche suivante. Par example (figure par wikipedia):
|
|
|
|
|
|
|
|
You have now a network; how does it learn? You will train the network to tell us (example houses for example) ("classification").
|
|
|
|
Supervised learning is a process in which you take some data whose category is known;
|
|
|
|
The untrained network will have random weights.
|
|
|
|
You will feed the network the quantities described by your dataset (example features); this will give you an output,
|
|
|
|
$y = ...$ that you can compare with the true category. You can "measure" the difference between the output and the true categorization, and that will be a measure of how bad is your network performing so far.
|
|
|
|
Now you need to tell the network that it needs to adapt its internal weights in a direction that makes the output closer to the true categorization: in other words, you need to "backpropagate" the gradient of the discrepancy between output and true categorization, to minimize it.
|
|
|
|

|
|
|
|
|
|
|
|
This process constitutes an "epoch". After this, you feed again some data to the network, and repeat the process. If you do this over and over, your network will learn how to predict the true categorization to a higher degree of accuracy.
|
|
|
|
On a un reseau de neurons characterisé par un conjoint de poids et une structure pour les connecter; essentialement, ça c'est une fonction mathematique avec plusieurs des paramètres (les poids) qui prends les inputs et donne un valeur unique comme output.
|
|
|
|
|
|
|
|
The code will have the following characteristics:
|
|
|
|
On va a entrâiner le reseau par classifier les vins bons des vins mauvais. Les inputs sont des characteristiques chimiques des vins, et le output c'est un numero entre 0 (mauvais) et 10 (bon). L'algorithme pour apprendre est simple:
|
|
|
|
|
|
|
|
- a neuron class, that can take as an input an activation function
|
|
|
|
- a network class (and eventually a layer class), which stores the network structure and its weights. It will need a "train" method, a loss function method, a gradient method, and a backpropagation method
|
|
|
|
- le reseau initiel aura poids initializé de manière casuelle (random uniform)
|
|
|
|
- on calcule le output du reseau $`Y = f(inputs)`$
|
|
|
|
- on calcule la difference entre $`Y`$ (notre classification du vin) et la classification que on connait ($`Y_{true}`$); ça c'est une manière de déterminer si vôtre classification est bonne ou non.
|
|
|
|
- on fait la propagation du gradient entre $`Y`$ et $`Y_{true}`$ à chaque couche et neuron qui vient avant du neuron output, et on modifie le poid de chaque neuron dans la direction du gradient (ça deverait ameliorer la prochième prediction)
|
|
|
|
- on recommence le procès.
|
|
|
|
|
|
|
|
Ce procès est appelé *epoque*.
|
|
|
|
|
|
|
|
The simplest network will have 5 inputs, one internal layer of an arbitrary number of neurons, and one output neuron
|
|
|
|
$figure structure network$
|
|
|
|
Pendand le procès, on doit sauveguarder le valeur de $`Y-Y_{true}`$, qui est notre *loss function*, i.e. la fonction qui nous dit si notre reseau a appris bien ou non. L'idée c'est que on va a continuer executer boucoup de epoques jusq'u a quand la loss function est estabilizée (le reseau ne peut pas apprendre meilleur que ça).
|
|
|
|
|
|
|
|
Bonus points is you build a code which can take arbitrary amount of input features and a user-specified amount of layers and neurons. |
|
|
\ No newline at end of file |
|
|
|
Le modèle le plus simple de reseau que vous pouvez utiliser est
|
|
|
|
|
|
|
|
- 11 inputs (les qualitées chimiques du vin)
|
|
|
|
- une couche moyenne de 15 ou 20 neurons
|
|
|
|
- 1 output (la qualité du saveur du vin)
|
|
|
|
|
|
|
|
Bonus points si votre classe **NeuralNetwork** peut prendre un numero de inputs arbitrarire, et un numero de couches et neurons arbitraire (specifié par l'utilisateur). |
|
|
\ No newline at end of file |