AS 2014-2015

Transparents de cours

Sur la page de Patrick Gallinari

TP 1 : Introduction à l’apprentissage et à IPython (Numpy/Pandas/Matplotlib et POO)

Pour télécharger:

wget [lien du fichier]

Pour changer le nom d’un fichier:

mv [ancien nom] [nouveau nom]

Pour dé-zipper:

gzip -d [nom machin.gz]

Pour lancer IPython:

ipython notebook --pylab=inline

 TP 2 : Programmation du  Perceptron et du Kernel Perceptron

Mise à jour Kernel Trick

def kernel(x):
    n = x.shape[0]
    return np.hstack((x, np.ones((n, 1))))

trainset = createGaussianDataset([0, 0], [[100, 0], [0, 100]],
                                 [100, 100], [[100, 0], [0, 100]],
                                 400)
trainset.x = kernel(trainset.x)
perceptron = Perceptron(0.0001, 10)
perceptron.train(trainset)

def  plot_frontiere2(x, f, kernel, step=20):
    mmax = x.max(0)
    mmin = x.min(0)
    x1grid , x2grid = np.meshgrid(np.linspace(mmin[0], mmax[0], step),
                                  np.linspace(mmin[1], mmax[1], step))
    grid = np.hstack((x1grid.reshape(x1grid.size, 1),
                      x2grid.reshape(x2grid.size, 1)))
    # calcul de la prediction pour chaque point de la grille
    res = np.array([f(kernel(np.array([grid[i,:]]))[0])[0] for i in range(len(grid))])
    res = res.reshape(x1grid.shape)
    # tracer des frontieres
    plt.contourf(x1grid, x2grid, res,
                 colors=["orange","gray"], levels=[-1000, 0, 1000], linewidth=2)


plot_frontiere2(trainset.x, perceptron.predict, kernel)
plot2DSet(trainset)

TP 3 : Deep Learning

  • Structure de code pour l’implémentation du deep learning: AS-2014-TP3
  • Implémentation d’un auto-encodeur AS_MNIST.ipynb

Rendu Deep Learning

Description du Rendu: projet_deep_learning

 

TP : Embeddings – application à la recommendation et à la représentation de mots