1 Porównywanie klasyfikatorów Michał Bereta www.michalbereta.pl
Transkrypt
1 Porównywanie klasyfikatorów Michał Bereta www.michalbereta.pl
Porównywanie klasyfikatorów Michał Bereta www.michalbereta.pl 1. Testowanie statystycznej istotności różnic między jakością klasyfikatorów Wiemy, że możemy porównywad klasyfikatory np. za pomocą kroswalidacji. Czasami jednak obserwowane różnice są dośd małe – pytanie zatem czy są istotne? Do odpowiedzi na to pytanie mogą służyd różne testy statystyczne. W RM dostępne są w tym celu operatory „T-Test” oraz „ANOVA”. Procedura (w dużym uproszczeniu) składa się następujących kroków (T-Test): a. Załóż (hipoteza zerowa), że nie ma żadnej różnicy między średnim wynikiem działania dwóch klasyfikatorów, a obserwowane różnice (np. w PerformanceVectors) są wynikiem losowych fluktuacji. b. Zakładając pewien model statystyczny, który, jak przyjmujemy, odpowiada za te fluktuacje, obliczamy prawdopodobieostwo, że możemy natrafid na właśnie takie wartości. c. Jeśli to prawdopodobieostwo jest odpowiednio małe (np. <5%) to na takim poziomie istotności odrzucamy hipotezę o braku różnicy między klasyfikatorami, tzn. uznajemy, że lepsza jakośd jednego z nich jest statystycznie istotna (nie jest przypadkiem). W powyższym narażamy się na błąd tzw. pierwszego rodzaju, czy odrzucenie hipotezy zerowej, kiedy jest ona prawdziwa. W tym przypadku znaczy to, że rzeczywiście nie ma istotnych różnic między klasyfikatorami. Aby porównad więcej niż dwa klasyfikatory, można parami wielokrotnie wykonad T-Test. Wtedy jednak więcej razy mamy szansę na popełnienie błędu pierwszego rodzaju. Lepiej wykorzystad test ANOVA, który w jednym teście uwzględnid może wiele klasyfikatorów. Porównaj z dokumentacją RM: T-Test (RapidMiner Core) Synopsis This operator is used for comparison of performance vectors. This operator performs a t-test to determine the probability for the null hypothesis i.e. 'the actual means are the same'. 1 Description The T-Test operator determines if the null hypothesis (i.e. all actual mean values are the same) holds for the given performance vectors. This operator uses a simple paired t-test to determine the probability that the null hypothesis is wrong. Since a t-test can only be applied on two performance vectors this test will be applied to all possible pairs. The result is a significance matrix. Paired t-test is a test of the null hypothesis that the difference between two responses measured on the same statistical unit has a mean value of zero. For example, suppose we measure the size of a cancer patient's tumor before and after a treatment. If the treatment is effective, we expect the tumor size for many of the patients to be smaller following the treatment. This is often referred to as the 'paired' or 'repeated measures' t-test. In case of this operator the dependent samples (or 'paired') t-tests consist of a pair of performance vectors. Doing multiple paired t-tests would result in an increased chance of committing a type I error. 'False positive' or Type I error is defined as the probability that a decision to reject the null hypothesis will be made when it is in fact true and should not have been rejected. It is recommended to apply an additional ANOVA test to determine if the null hypothesis is wrong at all. Please use the ANOVA operator for performing the ANOVA test. ANOVA (RapidMiner Core) Synopsis This operator is used for comparison of performance vectors. It performs an analysis of variance (ANOVA) test to determine the probability for the null hypothesis i.e. 'the actual means are the same'. Description ANalysis Of VAriance (ANOVA) is a statistical model in which the observed variance in a particular variable is partitioned into components attributable to different sources of variation. In its simplest form, ANOVA provides a statistical test of whether or not the means of several groups are all equal, and therefore generalizes t-test to more than two groups. Doing multiple two-sample t-tests would result in an increased chance of committing a type I error. For this reason, ANOVA is useful in comparing two, three, or more means. 'False positive' or Type I error is defined as the probability that a decision to reject the null hypothesis will be made when it is in fact true and should not have been rejected. RapidMiner provides the T-Test operator for performing the t-test. Paired t-test is a test of the null hypothesis that the difference between two responses measured on the same statistical unit has a mean value of zero. Doing multiple two-sample t-tests would result in an increased chance of committing a type I error. For this reason, ANOVA is useful in comparing two, three, or more means. 2 Przykład: Czy jest statystycznie istotna różnica między drzewem decyzyjnym i perceptronem przy klasyfikacji danych pima/ionosphere? Dla kroswalidacji drzewa: Dla kroswalidacji perceptronu: 3 Poziom istotności T-Testu ustawiamy na: Oznacza to, że jeśli prawdopodobieostwo wystąpienia danej sytuacji jako całkowicie losowej będzie ocenione poniżej alpha, to hipoteza zerowa zostanie odrzucona i klasyfikatory zostaną uznane za statystycznie różne na danym poziomie istotności (5%). Wyniki: Perceptron Drzewo 4 T-Test Wartośd 0.009 jest mniejsza niż 0.05 więc odrzucamy hipotezę o braku istotnych różnic między tymi klasyfikatorami. Dla Pima: Dla perceptronu 5 Dla drzewa T-Test Tutaj jak widad, nie ma wystarczających przesłanek (zgodnie z przyjętym modelem) aby odrzucid hipotezę zerową o braku istotnych różnic. Wypróbuj również test ANOVA: 6 Dla ionosphere: 7 Różnica między operatorami T-Test i ANOVA jest wyraźna, kiedy porównujemy więcej niż dwa klasyfikatory. Wtedy T-Test jest uruchamiany wielokrotnie dla każdej pary, lecz ANOVA to jeden test uruchamiany raz dla wszystkich porównywanych klasyfikatorów (hipoteza zerowa to założenie, że nie ma między nimi wszystkimi istotnej równicy). Zadanie: Dodaj do przykładu klasyfikator NaiveBayes. Perceptron: Tree: 8 Bayes: T-Test sugeruje, że nie można założyd braku różnicy między drzewem i perceptronem. ANOVA pozwala wnioskowad, że nie można założyd braku istotnych różnic między trzema analizowanymi klasyfikatorami. 9