#include #include #include "../common/include/colors.h" #include "include/initialisation.h" // glorot (wavier initialisation) linear, tanh, softmax, logistic (1/(fan_in+fan_out/2)) // he initialisation : RELU (2/fan_in) // LeCun initialisation: SELU (1/fan_in) // Explained in https://machinelearningmastery.com/weight-initialization-for-deep-learning-neural-networks/ float randn() { float f1=0.; while (f1 == 0) { f1 = RAND_FLT(); } return sqrt(-2.0*log(f1))*cos(2*M_PI*RAND_FLT()); } void initialisation_1d_matrix(int initialisation, float* matrix, int dim, int n_in, int n_out) { float lower_bound, distance_bounds; if (initialisation == ZERO) { for (int i=0; i