Machine Learning and Data Mining Summer 2015 Exercise Sheet 11

Ähnliche Dokumente
Unit 4. The Extension Principle. Fuzzy Logic I 123

Number of Maximal Partial Clones

Magic Figures. We note that in the example magic square the numbers 1 9 are used. All three rows (columns) have equal sum, called the magic number.

Geometrie und Bedeutung: Kap 5

A Classification of Partial Boolean Clones

Introduction FEM, 1D-Example

Introduction FEM, 1D-Example

Finite Difference Method (FDM)

Übungsstunde: Informatik 1 D-MAVT

Informatik für Mathematiker und Physiker Woche 2. David Sommer

D-BAUG Informatik I. Exercise session: week 1 HS 2018

Algorithms & Datastructures Midterm Test 1

Final Exam. Friday June 4, 2008, 12:30, Magnus-HS

p^db=`oj===pìééçêíáåñçêã~íáçå=

Scheduling. chemistry. math. history. physics. art

Level 1 German, 2014

Mitglied der Leibniz-Gemeinschaft

Josh Engwer (TTU) Line Integrals 11 November / 25

KTdCW Artificial Intelligence 2016/17 Practical Exercises - PART A

Teil 2.2: Lernen formaler Sprachen: Hypothesenräume

Exercise (Part II) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

Mock Exam Behavioral Finance

Allgemeine Mechanik Musterlösung 5.

Rev. Proc Information

Attention: Give your answers to problem 1 and problem 2 directly below the questions in the exam question sheet. ,and C = [ ].

Handbuch der therapeutischen Seelsorge: Die Seelsorge-Praxis / Gesprächsführung in der Seelsorge (German Edition)

Level 2 German, 2016

6. Übungsblatt Aufgaben mit Lösungen

Informatik - Übungsstunde

Unterspezifikation in der Semantik Hole Semantics

Im Fluss der Zeit: Gedanken beim Älterwerden (HERDER spektrum) (German Edition)

VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL USER GUIDE June 2016

Was heißt Denken?: Vorlesung Wintersemester 1951/52. [Was bedeutet das alles?] (Reclams Universal-Bibliothek) (German Edition)

VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL - USER GUIDE June 2016

Die Bedeutung neurowissenschaftlicher Erkenntnisse für die Werbung (German Edition)

Word-CRM-Upload-Button. User manual

COMPUTER: Mission Berlin. November 9, 2006, eleven-five am. You've got 65 minutes to accomplish your mission.

EVANGELISCHES GESANGBUCH: AUSGABE FUR DIE EVANGELISCH-LUTHERISCHE LANDESKIRCHE SACHSEN. BLAU (GERMAN EDITION) FROM EVANGELISCHE VERLAGSAN

FEM Isoparametric Concept

Statistics, Data Analysis, and Simulation SS 2015

Interpolation Functions for the Finite Elements

Musterlösung 3. D-MATH Algebra I HS 2015 Prof. Richard Pink. Faktorielle Ringe, Grösster gemeinsamer Teiler, Ideale, Faktorringe

Wie man heute die Liebe fürs Leben findet

Dexatek's Alexa Smart Home Skills Instruction Guide

Paper Reference. Paper Reference(s) 1231/4H Edexcel GCSE German Paper 4H Writing Higher Tier Tuesday 12 June 2007 Afternoon Time: 1 hour

Informatik für Mathematiker und Physiker Woche 7. David Sommer

Rückblick. Aufteilung in Dokumente anwendungsabhängig. Tokenisierung und Normalisierung sprachabhängig

Seeking for n! Derivatives

Boolean Retrieval 1. September, Vorlage: Folien von M. Schütze zu [1] 1 von 27 Boolean Retrieval

Unterrichtsmaterialien in digitaler und in gedruckter Form. Auszug aus: Vertretungsstunde Englisch 5. Klasse: Grammatik

Causal Analysis in Population Studies

Level 2 German, 2015

Unit 6. Fuzzy Inference. Fuzzy Logic I 159

Registration of residence at Citizens Office (Bürgerbüro)

Übungsblatt 6. Analysis 1, HS14

Wer bin ich - und wenn ja wie viele?: Eine philosophische Reise. Click here if your download doesn"t start automatically

Paper Reference. Paper Reference(s) 4375/01 London Examinations IGCSE German Paper 1: Listening

Malteser Computer Training

Introduction to Python. Introduction. First Steps in Python. pseudo random numbers. May 2016

iid software tools QuickStartGuide iid USB base driver installation

Mathematics (M4) (English version) ORIENTIERUNGSARBEIT (OA 11) Gymnasium. Code-Nr.:

Notice: All mentioned inventors have to sign the Report of Invention (see page 3)!!!

Exercise (Part XI) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

Einführung in die Computerlinguistik

Stochastic Processes SS 2010 Prof. Anton Wakolbinger. Klausur am 16. Juli 2010

Carsten Berkau: Bilanzen Solution to Chapter 13

v+s Output Quelle: Schotter, Microeconomics, , S. 412f

!! Um!in!ADITION!ein!HTML51Werbemittel!anzulegen,!erstellen!Sie!zunächst!ein!neues! Werbemittel!des!Typs!RichMedia.!!!!!!

The projectivity of the moduli space of stable curves. I: Preliminaries on "det"...

NEWSLETTER. FileDirector Version 2.5 Novelties. Filing system designer. Filing system in WinClient

My Reading-Log. Eine Hilfe beim Lesen von englischen Ganzschriften in der Schule. Hinweise zur technischen Umsetzung:

p^db=`oj===pìééçêíáåñçêã~íáçå=

Kybernetik Intelligent Agents- Decision Making

Harry gefangen in der Zeit Begleitmaterialien

Schachaufgabe 05: Ma-Übung Chess Problem 05: Mate training

FACHKUNDE FüR KAUFLEUTE IM GESUNDHEITSWESEN FROM THIEME GEORG VERLAG

Can I use an older device with a new GSD file? It is always the best to use the latest GSD file since this is downward compatible to older versions.

Students intentions to use wikis in higher education

ONLINE LICENCE GENERATOR

Bayesian Networks. Syntax Semantics Parametrized Distributions Inference in Bayesian Networks. Exact Inference. Approximate Inference

Das Thema: Die Olympischen Spiele in

Mercedes OM 636: Handbuch und Ersatzteilkatalog (German Edition)

1. A number has 6 in the tenths place, 4 in the ones place, and 5 in the hundredths place. Write the number.

Automatentheorie und formale Sprachen reguläre Ausdrücke

Walter Buchmayr Ges.m.b.H.

Einführung in die Computerlinguistik Information Retrieval: tf.idf

Relevante(r) Deskriptor(en) Deskriptor 5: Kann einfachen Interviews, Berichten, Hörspielen und Sketches zu vertrauten Themen folgen.

FAHRZEUGENTWICKLUNG IM AUTOMOBILBAU FROM HANSER FACHBUCHVERLAG DOWNLOAD EBOOK : FAHRZEUGENTWICKLUNG IM AUTOMOBILBAU FROM HANSER FACHBUCHVERLAG PDF

Rückblick. Aufteilung in Dokumente anwendungsabhängig. Tokenisierung und Normalisierung sprachabhängig

Ressourcenmanagement in Netzwerken SS06 Vorl. 12,

Exercise (Part VIII) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

econstor Make Your Publication Visible

Data Structures and Algorithm Design

Zariski-Van Kampen Method

Paper Reference. Paper Reference(s) 4375/01 London Examinations IGCSE German Paper 1: Listening

GERMAN: BACKGROUND LANGUAGE. ATAR course examination Recording transcript

PELTIER-HOCHLEISTUNGSMODULE

Web-Apps mit jquery Mobile: Mobile Multiplattform-Entwicklung mit HTML5 und JavaScript (German Edition)

II. Matching. What answers listed below would be logical answers for the following There may be more than one answer for each:

Martin Luther. Click here if your download doesn"t start automatically

Transkript:

Ludwig-Maximilians-Universitaet Muenchen 0.06.205 Institute for Informatics Prof. Dr. Volker Tresp Gregor Jossé Johannes Niedermayer Machine Learning and Data Mining Summer 205 Exercise Sheet Presentation of Solutions to the Exercise Sheet on the 08.07.205 Exercise - Document Distance Consider four documents from a document dataset, which has been mapped onto an lexicon of size M = 00 w.r.t. word frequency x i,j,2,... }. Let A denote the lexicon itself, i.e. j,...,m} : x A,j =. Let B be a document containing only the first word of A (x B, = j 2,...,M} : x B,j = 0). Let C contain the first 50 words of A, and, finally, let D contain the th to 60th word twice. a) Compute the pairwise distance of vectors A, B, C, D, w.r.t. the following distance measures: dist eucl (x, y) = ( M (x j Y j ) 2) /2 dist simple (x, y) = M i= ( I(x j = y j )) i= dist simple00 (x, y) = M F dist cos (x, y) = dist pearson (x, y) = ( I(x j = y j )) i= xt y x y xt ỹ x ỹ where I(condition) is the indicator function which is iff the condition is fulfilled and 0 otherwise, F is the number of components in which both vectors are 0, and x := x mean(x). b) How do the distances change if it is also known that the first fifty words are contained in 750 of the total N = 000 documents in the set, while all other words only appear in 5 documents? Remark: You know the term frequency, which measures the absolute frequency of words in a document. When there is additional information about the global frequency of a term (i.e., is it common or rare among all documents), it should also be taken into account. This is often done using the inverse document frequency: ( ) N idf j = log n j where N is the number of documents and n j is the number of documents in which the word j occurs. The measures tf and idf are often combined by multiplication: tf idf = tf idf. What does this measure reflect? Use this measure for this exercise.

Es handelt sich hier bei den x i,j um Term Frequencies tf (tf i,j : wie oft taucht Wort j in Dokument i auf?) Die Dokument-Vektoren sehen also also folgendermaßen aus: a) Distanzberechnung A = (x,..., x 00 ) = (,..., ) i = B = (x,..., x 00 ), mit x i = i [,50] C = (x,..., x 00 ), mit x i = 2 i [,60] D = (x,..., x 00 ), mit x i = Euklidische Distanz dist eukl (A, B) = A B = (ai b i ) 2 : dist eukl (X, X) = 0 dist eukl (A, B) = A B = (ai b i ) 2 = ( ) 2 + 99 ( 0) 2 = 99 = 9,95 dist eukl (A, C) = 50 ( ) 2 + 50 ( 0) 2 = 50 = 5 2 7,7 dist eukl (A, D) = 50 ( 2) 2 + (0 + 0) ( 0) 2 = 00 = 0 dist eukl (B, C) = ( ) 2 + 9 ( 0) 2 + 50 (0 0) 2 = 9 = 7 dist eukl (B, D) = ( 0) 2 + 9 (0 0) 2 + 50 (2 0) 2 = 20,77 dist eukl (C, D) = 0 ( 0) 2 + 0 (2 ) 2 + 0 (2 0) 2 + 0 (0 0) 2 = 0 = 9,9 2

Indikatorfunktion I(X) = Simple Distanz: dist simple (A, B) = M X = bzw X = true ( I(a j = b j )) j= dist simple (X, X) = ( I(x j = x j )) = 0 dist simple (A, B) = 00 00 j= ( I(a j = b j )) = [( I( = )) + 99 ( I( = 0))] = 00 = 99 [ + 99 ( 0)] = 00 00 =.99 dist simple (A, C) = 50 [50 ( I( = )) + 50 ( I( = 0))] = 00 00 =.5 dist simple (A, D) = 00 [50 ( I( = 0)) + 50 ( I( = 2))] = 00 00 = dist simple (B, C) = 9 [ ( I( = )) + 9 ( I(0 = )) + 50 ( I(0 = 0))] = 00 00 =.9 dist simple (B, D) = 5 [ ( I( = 0)) + 9 ( I(0 = 0)) + 50 ( I(0 = 2))] = 00 00 =.5 dist simple (C, D) = [0 ( I( = 0)) + 0 ( I( = 2)) + 0 ( I(0 = 2)+ 00 +0 ( I(0 = 0))] = 60 00 =.6 Simple 00 Distanz: dist simple00 (A, B) = M F j= ( I(a j = b j )) mit F := Anzahl der Variablen in denen beide Vektoren übereinstimmend gleich 0 sind. dist simple00 (X, X) = ( I(x j = x j )) = 0 dist simple00 (A, B) = 00 0 [( I( = )) + 99 ( I( = 0))] = dist simple(a, B) =.99 gleiches gilt für die anderen dist simple00 (A, X) dist simple00 (B, C) = [ ( I( = )) + 9 ( I( = 0)) + 50 ( I(0 = 0))] = 00 50 = 9 50 =.98 dist simple00 (B, D) = [( I( = 0)) + 9 ( I(0 = 0)) + 50 ( I(0 = 2))] = 00 9 = 5 5 = dist simple00 (C, D) = [0 ( I( = 0)) + 0 ( I( = 2)) + 0 ( I(0 = 2))+ 00 0 +0 ( I(0 = 0))] = 60 60 =

Cosinusdistanz: dist cos (A, B) = cos(a,b) = dist cos (X, X) = XT X X T X 2 = 0 AT B A B. dist cos (A, B) = = /0 =.9 00 2 2 50 dist cos (A, C) = = 5 00 50 2 5 2 = 2 =.29 50 2 dist cos (A, D) = 0 50 2 = 00 2 0 5 2 2 = 2 =.29 und zwar weil: dist cos (ax, by ) = dist cos (X, Y ) für positive Skalare a,b dist cos (B, C) = 2 5 2 = 00 0 5 2 2 = 2.86 dist cos (B, D) = 0 const = 0 2 dist cos (C, D) = 5 2 0 2 = 80 00 =.2 Pearsondistanz: dist pearson (A, B) = dist cos (Ã, B) = dist cos (A mean(a), B mean(b)) = (A mean(a))t (B mean(b)) (A T mean(a)) (B mean(b)). dist pearson (X, X) = dist cos ( X, X) = 0 dist pearson (A, X) = NA, weil à = 0 dist pearson (B, C) = dist pearson (B, D) =.0 dist pearson (C, D) =..95 9.005 + 50.005.99 2 + 99.0 2 50.5 2 + 50.5 =.5 2.99995 5.899 Noch zur Pearson-Distanz: Sind alle Elemente eines Vektors gleich, werden die Elemente des Vektors durch die Mittelwertbereinigung auf 0 gesetzt. Die Lï 2nge des Vektors ( x ) ist damit Null. Der Nenner der Kosinusdistanz wird dann ebenfalls 0 (Division by Zero). Semantisch wï 2re das der Winkel eines Vektors zu einem Punkt (Ursprung). Beispiel: A = (2, 2), x = 2 à = (2 x,...) = (0,0) A = 0 Sinn der ï 2 bung: unterschiedliche Distanzmaï 2e ergeben unterschiedliche Distanzen, welche Distanz die richtige ist, muss ï 2ber Experimente und/oder Spezialwissen entschieden werden.

Zusammenfassung: Euklidische Distanz [0, ] Simple Distanz [0,] A 0.000 9.950 7.07 0.000 A 0.000 0.990 0.500.000 B 9.950 0.000 7.000.77 B 0.990 0.000 0.90 0.50 C 7.07 7.000 0.000 9.87 C 0.500 0.90 0.000 0.600 D 0.000.77 9.87 0.000 D.000 0.50 0.600 0.000 Simple 00 Distanz [0,] Kosinusdistanz [0,2] A 0.000 0.990 0.500.000 B 0.990 0.000 0.980.000 C 0.500 0.980 0.000.000 D.000.000.000 0.000 Pearson Distanz [0, 2] A NaN NaN NaN NaN B NaN 0.000 0.899.0 C NaN 0.899 0.000 0.00 D NaN.0 0.00 0.000 A 0.000 0.900 0.29 0.29 B 0.900 0.000 0.859.000 C 0.29 0.859 0.000 0.200 D 0.29.000 0.200 0.000 b) Wenn Informationen über die globalen Häufigkeiten der einzelnen Wörter bekannt sind, sollten diese mit den Dokumentenvektoren verrechnet werden: üblich ist die inverse document frequency: ( ) idf j = log N. nj N ist die Anzahl aller Dokumente, n j die Anzahl aller Dokumente in denen Wort j vorkommt. Hieraus wird dann die tfidf gebildet: tfidf i,j =tf i,j idf j. In unserem Beispiel haben die ersten 50 Wörter eine idf j von log ( ) ( 000 750 = log ) 0,288, die anderen Wörter (j 5,...,00}) haben eine idf j von log ( ) 000 5 = log(200) 5,298. Wir erhalten also neue Merkmalsvektoren: log ( ) A = (x,..., x 00 ) =, mit x i = i =,...,50} log (200) sonst log ( ) B = (x,..., x 00 ), mit x i = i = log ( ) C = (x,..., x 00 ), mit x i = i [,50] 2 log ( ) i [,50] D = (x,..., x 00 ), mit x i = 2 log (200) i [5,60] Da also alle Merkmalsvektoren insgesamt heruntergewichtet wurden, ist zu erwarten, dass die Distanzen insgesamt abnehmen werden: 5

Distanzen: Euklidische Distanz A 0.000 7.59 7.65 7.520 B 7.59 0.000 2.0.708 C 7.65 2.0 0.000.57 D 7.520.708.57 0.000 Simple 00 Distanz A 0.000 0.990 0.500.000 B 0.990 0.000 0.980.000 C 0.500 0.980 0.000.000 D.000.000.000 0.000 Pearson Distanz A -0.000.0 2.000 0.7 B.0 0.000 0.899.02 C 2.000 0.899 0.000.266 D 0.7.02.266 0.000 Simple Distanz A 0.000 0.990 0.500.000 B 0.990 0.000 0.90 0.50 C 0.500 0.90 0.000 0.600 D.000 0.50 0.600 0.000 Kosinusdistanz A 0.000 0.992 0.96 0.55 B 0.992 0.000 0.859.000 C 0.96 0.859-0.000 0.90 D 0.55.000 0.90-0.000 Unterschiede: Euklidische Distanz: durch die Gewichtung deutliche Unterschiede in der Höhe der Distanzen auch die paarweisen Distanzen haben sich relativ zueinander verschoben. Beispiel AC, CD: ursprünglich ist AC < CD; jetzt umgekehrt. Simple Distanz / -00 Distanz: jeweils kein Einfluss klar, es werden lediglich Indikatorvektoren vergleichen, und da die Gewichtung hier keinen Einfluss auf die Wertidentitäten hatte (muss nicht immer der Fall sein), gibt es keine Änderungen. Kosinusdistanz: Starke Änderungen: da die Gewichtungen sich meist auf den Winkel der Vektoren auswirken nur BC und BD sind nicht betroffen. Pearsondistanz: Keine NaNs mehr, da A jetzt nicht Varianz 0 hat. Durch die Normalisierung hier auch ein Unterschied BD im Vergleich mit der Kosinusdistanz. (BC wird nicht beeinflusst, da die Gewichtungen sich nur auf Terme 0 auswirken.) 6