Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
efinf:blcks2017:bigdatab:start [2018/03/06 12:18] Simon Knaus [L7] |
efinf:blcks2017:bigdatab:start [2018/03/08 07:54] (current) Simon Knaus |
||
---|---|---|---|
Line 593: | Line 593: | ||
=== Ziele === | === Ziele === | ||
+ | * Jeder kann die zentralen Begriffen erklären / beschreiben (-> | ||
* kNN mit Python und Scikit durchführen | * kNN mit Python und Scikit durchführen | ||
- | * Jeder kann die zentralen Begriffen erklären / beschreiben (-> | + | * Eigene Ziffer als GIF klassifizieren oder Random Forests durchführen |
+ | === Aufträge === | ||
+ | * Bei installiertem Python 2.7. die notwendigen Module installieren (siehe [[# | ||
+ | * kNN in Python durchführen, | ||
+ | * Wer soweit durch: | ||
+ | * Eigene Ziffer als GIF klassifizieren mit der Funktion '' | ||
+ | * Random Forests durchführen und Klassifikationsgüte mit kNN vergleichen | ||
+ | * kNN für verschiedene '' | ||
Line 613: | Line 621: | ||
</ | </ | ||
- | Ein wichtiges Konstrukt sind sogenannte numpy-Arrays: | + | Ein wichtiges Konstrukt sind sogenannte numpy-Arrays: |
<code python> | <code python> | ||
Line 625: | Line 633: | ||
trainingsdata[0,: | trainingsdata[0,: | ||
</ | </ | ||
+ | === kNN in Python === | ||
Nachher kann relativ einfach mit Python kNN implementiert werden: | Nachher kann relativ einfach mit Python kNN implementiert werden: | ||
<code python knn_scikit.py> | <code python knn_scikit.py> | ||
Line 631: | Line 639: | ||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||
from sklearn.neighbors import KNeighborsClassifier | from sklearn.neighbors import KNeighborsClassifier | ||
+ | from sklearn.metrics import confusion_matrix | ||
from numpy import genfromtxt, | from numpy import genfromtxt, | ||
from imageio import imread | from imageio import imread | ||
Line 670: | Line 679: | ||
print sum(predicted_class - test_digits_class == 0) / float(len(predicted_class)) | print sum(predicted_class - test_digits_class == 0) / float(len(predicted_class)) | ||
+ | |||
+ | ## Konfusionsmatrix berechnen | ||
+ | mat_knn = confusion_matrix(test_digits_class, | ||
+ | print(mat_knn) | ||
# Aquivalent der Funktion getPixelListFromFilePath | # Aquivalent der Funktion getPixelListFromFilePath | ||
Line 944: | Line 957: | ||
print "Guete rf:", guete_rf | print "Guete rf:", guete_rf | ||
</ | </ | ||
- | <!-- | + | |
==== L8 ==== | ==== L8 ==== | ||
Prüfung und ANN | Prüfung und ANN | ||
Line 950: | Line 963: | ||
=== Evaluation === | === Evaluation === | ||
- | * {{efinf: | + | * {{efinf: |
* [[https:// | * [[https:// | ||
Line 960: | Line 973: | ||
=== Feedback === | === Feedback === | ||
https:// | https:// | ||
- | --> | + |