Maschinelles%20Lernen - PowerPoint PPT Presentation

About This Presentation
Title:

Maschinelles%20Lernen

Description:

Maschinelles Lernen und Neural Computation bung: Grundlagen von Matlab und Netlab Georg Dorffner / Achim Lewandowski – PowerPoint PPT presentation

Number of Views:217
Avg rating:3.0/5.0
Slides: 17
Provided by: Georg391
Category:

less

Transcript and Presenter's Notes

Title: Maschinelles%20Lernen


1
Maschinelles Lernen und Neural Computation
Übung Grundlagen von Matlab und Netlab
  • Georg Dorffner / Achim Lewandowski

2
Matlab Nützliches I
  • Zugriff auf die Daten
  • Per Hand eingeben
  • gtgt a4 Skalar
  • gtgt Vektor3 5 7
  • gtgt bmat2 3 4 5 3 4 5 6 11 1 2 1
  • Aus Ascii-Datei
  • gtgt load beispiel.dat
  • Variable (oder Array) heißt nun beispiel
  • Aus Matlab-Datei (Endung .mat)
  • gtgt load class.mat
  • class.mat kann mehrere Variablen, arrays, auch
    mit anderen Namen enthalten

3
Matlab Nützliches II
  • Welche Daten sind im Arbeitsspeicher?
  • gtgt whos
  • Name Size Bytes
    Class
  • Vektor 3x1 24
    double array
  • a 1x1 8
    double array
  • bmat 3x4 96
    double array
  • Daten abspeichern, alles löschen, neu laden
  • gtgtsave daten Ve bmat legt daten.mat an
  • gtgtclear loescht alles
  • gtgtload daten Vektor und bmat sind wieder geladen

4
Matlab Nützliches III
  • gtgtabmat Multiplikation
  • ans
  • 8 12 16 20
  • 12 16 20 24
  • 44 4 8 4
  • gtgtcbmat' Transponierte
  • c
  • 2 3 11
  • 3 4 1
  • 4 5 2
  • 5 6 1

5
Matlab Nützliches IV
  • gtgtdabmat
  • d
  • 8 12 16 20
  • 12 16 20 24
  • 44 4 8 4
  • gtgtdabmat ruhiger Modus ohne Bildschirmausgabe
  • gtgt help befehl Hilfe zu befehl
  • gtgt czeros(1,3) ergibt c0 0 0 (1x3)
  • gtgt dones(3,1) ergibt d111 (3x1)

6
Matlab Nützliches V
  • Matrizen zusammenfügen
  • gtgta2 3 4
  • gtgtb5 6 7
  • gtgtca b
  • c
  • 2 3 4 5 6 7
  • gtgtcab
  • c
  • 2 3 4
  • 5 6 7

7
Netlab Grundsätzliches
  • http//www.ncrg.aston.ac.uk/netlab/
  • netlab.zip, nethelp.zip und foptions.m (ab Matlab
    7.0) entpackt und dann in den Pfad aufgenommen
  • Menupunkt File SetPath Add with Subfolders
  • Verzeichnisse mit Netlab und den Daten aufnehmen
  • Netlab-Befehle stehen nun zur Verfügung
  • Daten werden gefunden

8
Netlab GLM
  • glm (General Linear Model)
  • Initialisieren netglm(nin,nout,outfunc)
  • Brauche also
  • nin Dimension der Inputs
  • nout Dimension der Outputs
  • outfunc Ausgabefunktion, die eins von den
    folgenden sein kann 'linear', 'logistic' oder
    'softmax'
  • Brauche (noch) nicht die Daten
  • z.B. netglm(5,3, 'linear')

9
Netlab GLM II
  • net
  • type 'glm'
  • nin 5
  • nout 3
  • nwts 18
  • outfn 'linear'
  • w1 5x3 double
  • b1 0.6909 0.2414 -0.2627

10
Netlab GLM III
  • Modell an Daten anpassen
  • netneu, options netopt(net, options, x, t,
    alg)
  • net eben definiert
  • optionsfoptions erzeugt den Optionenvektor
    (1x18)
  • options(1)1 Fehler anzeigen
  • options(14)30 Anzahl der Iterationen
  • Daten bestehen aus n Beobachtungen (jeweils
    Input- und Outputvektor), bspw. n300
  • x 300x5-Matrix, t 300x3-Matrix
  • alg 'scg' (Scaled Conjugate Gradient)
  • netneunetopt(net, options, x, t, scg')
  • netneu
  • type 'glm'
  • nin 5
  • nout 3
  • nwts 18
  • outfn 'linear'
  • w1 5x3 double
  • b1 0.4566 0.3357 0.5434

11
Netlab GLM IV
  • Outputvektor für neue Daten vorhersagen
  • tvor glmfwd(netneu,xneu)
  • netneu eben angepasst
  • bspw. xneu 2x5-Matrix
  • xneu1 1 1 1 1 -1 -1 -1 -1 -1
  • tvor
  • 2.1326 0.2828 1.1488
  • -0.8870 1.4671 -1.7579

12
Netlab MLP I
  • Multilayer-Perceptron
  • 1. Initialisieren netmlp(nin,nhidden,nout,outfu
    nc)
  • z.B. netmlp(1,4,1, 'linear')
  • type 'mlp'
  • nin 1
  • nhidden 4
  • nout 1
  • nwts 13 number of weights
  • outfn 'linear'
  • w1 0.2400 -0.0927 0.3431 0.4234
  • b1 -0.0608 0.2300 -0.2370 -0.2280
  • w2 4x1 double
  • b2 -0.2587

13
Netlab MLP II
  • Multilayer-Perceptron
  • 2. Trainieren mit x Inputmatrix und t
    Targetmatrix
  • bspw. x5rand(100,1)
  • tsin(x)0.1rand(100,1) netneunetopt(net,
    options, x, t,'scg')
  • 3. Vorhersagen auf Trainingsinput
  • tfittedmlpfwd(netneu,x)
  • tfitinitialmlpfwd(net,x) ohne Training
  • plot(x,t tfitted tfitinitial,'.')

14
Netlab GMM I
  • Gausssches Mischmodell
  • 1. Initialisieren mix gmm(dim,
    ncentres,covartype)
  • covartype 'spherical', 'full', 'diag',
  • z.B. mixgmm(3,10,'diag')
  • 2. Vortrainieren (k-means)
  • mix2 gmminit(mix, x,options)
  • 3. Parameter anpassen
  • mix3gmmem(mix2, x,options)

15
Netlab GMM II
  • Gausssches Mischmodell Beispiel
  • x1randn(100,1)
  • x2randn(50,1)24
  • x3randn(50,1)212
  • xx1x2x3
  • 1.Initialisieren mix gmm(1, 3,
    'diag')
  • 2. Vortrainieren (k-means)
  • mix2 gmminit(mix, x,options)
  • 3. Parameter anpassen
  • mix3gmmem(mix2, x,options)

16
Netlab GMM III
  • Gausssches Mischmodell Beispiel
  • angepasste Dichte anzeigen lassen
  • xv-20.115'
  • yvgmmprob(mix3,xv)
  • yv2gmmprob(mix2,xv)
  • plot(xv,yv yv2)
Write a Comment
User Comments (0)
About PowerShow.com