Você está na página 1de 11

Data Mining - CPS833

Aplicação do Algoritmo Apriori na Base de dados da Movielens

Índice

1 - Datasets utilizados
1.1Dataset de 100K
1.2 Dataset de 1M
2 - Código Utilizado
3 - Configuração do Experimento
3.1Configuração utilizados para o Dataset de 100k
3.2 Configuração utilizados para o Dataset de 1M
4 – Resultados
4.1Tabela com Resultados do experimento 3.1
4.2Tabela com Resultados do experimento 3.2
5 - Conclusões
1 - Datasets utilizados
1.1 https://grouplens.org/datasets/movielens/100k/
1.2 https://grouplens.org/datasets/movielens/1m/
2 - Código Utilizado
2.1 Script Principal

2.2 Classe que Calcula o Chi-square


3 - Configuração do Experimento
3.3 Configuração utilizados para o Dataset de 100k
Para o experimento com o dataset de 100 mil foi utilizado o suporte minimo de 0.5 e
confiança minima de 0.86
3.4 Configuração utilizados para o Dataset de 1M
Para o experimento com o dataset de 1milhão foi utilizada a mesma configuração do
experimento 3.3

4 - Resultados
4.1Tabela com Resultados do experimento 3.1

Regra conf supp lift(B conv lif(B, Chi²


,C) ~C)
Fargo (1996) -> Star Wars (1977) 0,89 0,64 1,08 1,61 0,62 1,25E-026

Rock, The (1996) -> Star Wars 0,91 0,54 1,11 1,94 0,52 1,90E-026
(1977)

Twelve Monkeys (1995) -> Star 0,91 0,56 1,11 2,03 0,49 2,53E-028
Wars (1977)

Pulp Fiction (1994) -> Star Wars 0,92 0,62 1,12 2,12 0,47 1,68E-031
(1977)

Independence Day (ID4) (1996) -> 0,92 0,62 1,12 2,14 0,47 2,08E-038
Star Wars (1977)

Mission: Impossible (1996) -> 0,92 0,53 1,12 2,26 0,44 1,04E-026
Star Wars (1977)

When Harry Met Sally,,, (1989) -> 0,92 0,52 1,13 2,32 0,43 3,85E-023
Star Wars (1977)

Toy Story (1995) -> Star Wars 0,92 0,61 1,13 2,33 0,43 6,99E-042
(1977)

Silence of the Lambs, The (1991) 0,93 0,62 1,13 2,48 0,4 5,15E-037
-> Star Wars (1977)

Braveheart (1995) -> Star Wars 0,93 0,52 1,13 2,57 0,39 1,33E-028
(1977)

Back to the Future (1985) -> Star 0,93 0,62 1,14 2,71 0,37 2,10E-037
Wars (1977)

Forrest Gump (1994) -> Star Wars 0,93 0,57 1,14 2,71 0,37 2,46E-033
(1977)

Fugitive, The (1993) -> Star Wars 0,93 0,58 1,14 2,73 0,37 1,92E-035
(1977)
Apollo 13 (1995) -> Star Wars 0,93 0,5 1,14 2,74 0,37 3,41E-026
(1977)

Godfather, The (1972) -> Star 0,94 0,57 1,14 2,78 0,36 1,57E-042
Wars (1977)

Star Trek: First Contact (1996) 0,94 0,53 1,14 2,83 0,35 4,10E-035
-> Star Wars (1977)

E,T, the Extra-Terrestrial (1982) 0,94 0,56 1,15 2,97 0,34 1,97E-034
-> Star Wars (1977)

Jaws (1975) -> Star Wars (1977) 0,94 0,52 1,15 2,99 0,33 4,92E-027

Godfather, The (1972) -> Return 0,87 0,53 1,15 1,83 0,55 1,14E-030
of the Jedi (1983)

Monty Python and the Holy Grail 0,94 0,56 1,15 3,08 0,33 1,95E-031
(1974) -> Star Wars (1977)

Raiders of the Lost Ark (1981) -> 0,94 0,69 1,15 3,19 0,31 9,29E-059
Star Wars (1977)

Princess Bride, The (1987) -> 0,94 0,56 1,15 3,21 0,31 7,78E-032
Star Wars (1977)

Rock, The (1996) -> Return of the 0,87 0,51 1,15 1,87 0,53 1,22E-032
Jedi (1983)

Silence of the Lambs, The (1991) 0,87 0,58 1,15 1,87 0,53 5,16E-030
-> Return of the Jedi (1983)

Groundhog Day (1993) -> Star Wars 0,95 0,53 1,16 3,4 0,29 1,95E-028
(1977)

Terminator 2: Judgment Day (1991) 0,95 0,54 1,16 3,41 0,29 3,56E-037
-> Star Wars (1977)

Mission: Impossible (1996) -> 0,88 0,51 1,16 1,98 0,51 2,97E-033
Return of the Jedi (1983)

Terminator, The (1984) -> Star 0,95 0,56 1,16 3,77 0,27 1,84E-039
Wars (1977)

Blade Runner (1982) -> Star Wars 0,95 0,52 1,16 3,83 0,26 7,80E-035
(1977)

Indiana Jones and the Last 0,95 0,59 1,16 3,83 0,26 7,88E-044
Crusade (1989) -> Star Wars
(1977)

Independence Day (ID4) (1996) -> 0,88 0,59 1,16 2 0,5 1,98E-045
Return of the Jedi (1983)

Jurassic Park (1993) -> Star Wars 0,95 0,52 1,16 3,85 0,26 3,29E-033
(1977)

Alien (1979) -> Star Wars (1977) 0,96 0,53 1,17 4,21 0,24 3,25E-036

Forrest Gump (1994) -> Return of 0,88 0,54 1,17 2,07 0,48 1,21E-031
the Jedi (1983)
Aliens (1986) -> Star Wars (1977) 0,96 0,53 1,17 4,32 0,23 8,75E-034

Raiders of the Lost Ark (1981) -> 0,89 0,65 1,18 2,19 0,46 3,37E-052
Return of the Jedi (1983)

Fugitive, The (1993) -> Return of 0,89 0,56 1,18 2,27 0,44 1,60E-034
the Jedi (1983)

Empire Strikes Back, The (1980) 0,97 0,64 1,18 5,97 0,17 8,42E-059
-> Star Wars (1977)

Monty Python and the Holy Grail 0,89 0,53 1,18 2,29 0,44 1,44E-029
(1974) -> Return of the Jedi
(1983)

Star Trek: First Contact (1996) 0,89 0,51 1,19 2,32 0,43 5,39E-042
-> Return of the Jedi (1983)

Back to the Future (1985) -> 0,9 0,59 1,19 2,34 0,43 1,54E-039
Return of the Jedi (1983)

E,T, the Extra-Terrestrial (1982) 0,9 0,53 1,19 2,41 0,41 1,21E-033
-> Return of the Jedi (1983)

Princess Bride, The (1987) -> 0,9 0,53 1,19 2,42 0,41 8,76E-032
Return of the Jedi (1983)

Star Wars (1977) -> Return of the 0,9 0,74 1,19 2,44 0,41 2,14E-110
Jedi (1983)

Return of the Jedi (1983) -> Star 0,98 0,74 1,19 7,98 0,13 2,14E-110
Wars (1977)

Terminator 2: Judgment Day (1991) 0,92 0,52 1,21 2,91 0,34 1,55E-037
-> Return of the Jedi (1983)

Alien (1979) -> Return of the 0,92 0,5 1,21 2,93 0,34 2,61E-033
Jedi (1983)

Terminator, The (1984) -> Return 0,92 0,54 1,22 3,02 0,33 3,74E-040
of the Jedi (1983)

Indiana Jones and the Last 0,92 0,57 1,22 3,14 0,32 2,02E-046
Crusade (1989) -> Return of the
Jedi (1983)

Twelve Monkeys (1995) -> Fargo 0,89 0,54 1,23 2,41 0,42 9,42E-047
(1996)

Jurassic Park (1993) -> Return of 0,93 0,5 1,23 3,49 0,29 6,46E-038
the Jedi (1983)

Empire Strikes Back, The (1980) 0,93 0,62 1,24 3,66 0,27 2,21E-057
-> Return of the Jedi (1983)

Pulp Fiction (1994) -> Raiders of 0,9 0,61 1,24 2,69 0,37 4,31E-075
the Lost Ark (1981)

Silence of the Lambs, The (1991) 0,9 0,61 1,24 2,83 0,35 5,13E-074
-> Raiders of the Lost Ark (1981)

Groundhog Day (1993) -> Raiders 0,92 0,51 1,26 3,27 0,31 6,71E-054
of the Lost Ark (1981)

Fugitive, The (1993) -> Raiders 0,92 0,57 1,26 3,32 0,3 4,17E-077
of the Lost Ark (1981)

When Harry Met Sally,,, (1989) -> 0,92 0,52 1,26 3,33 0,3 2,38E-054
Raiders of the Lost Ark (1981)

Back to the Future (1985) -> 0,92 0,61 1,27 3,4 0,29 3,29E-082
Raiders of the Lost Ark (1981)

Princess Bride, The (1987) -> 0,92 0,54 1,27 3,43 0,29 7,55E-067
Raiders of the Lost Ark (1981)

Forrest Gump (1994) -> Pulp 0,86 0,53 1,27 2,31 0,43 3,17E-056
Fiction (1994)

Braveheart (1995) -> Raiders of 0,92 0,52 1,27 3,5 0,29 8,04E-070
the Lost Ark (1981)

Forrest Gump (1994) -> Raiders of 0,93 0,57 1,28 3,69 0,27 3,08E-077
the Lost Ark (1981)

Fugitive, The (1993) -> Pulp 0,87 0,54 1,28 2,39 0,42 1,22E-065
Fiction (1994)

Monty Python and the Holy Grail 0,93 0,55 1,28 3,72 0,27 2,69E-069
(1974) -> Raiders of the Lost Ark
(1981)

Jaws (1975) -> Raiders of the 0,93 0,51 1,28 3,75 0,27 7,17E-055
Lost Ark (1981)

E,T, the Extra-Terrestrial (1982) 0,93 0,55 1,28 3,99 0,25 1,39E-074
-> Raiders of the Lost Ark (1981)

Apollo 13 (1995) -> Raiders of 0,93 0,5 1,28 4,05 0,25 2,28E-065
the Lost Ark (1981)

Terminator 2: Judgment Day (1991) 0,94 0,54 1,29 4,41 0,23 2,25E-074
-> Raiders of the Lost Ark (1981)

Indiana Jones and the Last 0,94 0,58 1,29 4,41 0,23 1,47E-083
Crusade (1989) -> Raiders of the
Lost Ark (1981)

Rock, The (1996) -> Independence 0,87 0,51 1,3 2,52 0,4 5,80E-064
Day (ID4) (1996)

Forrest Gump (1994) -> Empire 0,86 0,53 1,3 2,44 0,41 8,94E-065
Strikes Back, The (1980)

Fugitive, The (1993) -> Empire 0,86 0,54 1,3 2,46 0,41 1,00E-066
Strikes Back, The (1980)

Forrest Gump (1994) -> Silence of 0,87 0,54 1,3 2,57 0,39 9,09E-066
the Lambs, The (1991)

Terminator, The (1984) -> Pulp 0,88 0,52 1,3 2,76 0,36 1,46E-065
Fiction (1994)

Alien (1979) -> Raiders of the 0,95 0,52 1,3 5,19 0,19 3,17E-070
Lost Ark (1981)

Terminator 2: Judgment Day (1991) 0,89 0,51 1,31 2,82 0,35 1,39E-062
-> Pulp Fiction (1994)

Blade Runner (1982) -> Raiders of 0,95 0,51 1,31 5,28 0,19 6,80E-075
the Lost Ark (1981)

Raiders of the Lost Ark (1981) -> 0,87 0,63 1,31 2,53 0,4 2,07E-106
Empire Strikes Back, The (1980)

Empire Strikes Back, The (1980) 0,95 0,63 1,31 5,31 0,19 2,07E-106
-> Raiders of the Lost Ark (1981)

Jurassic Park (1993) -> Raiders 0,95 0,51 1,31 5,35 0,19 1,10E-071
of the Lost Ark (1981)

Princess Bride, The (1987) -> 0,86 0,51 1,31 2,48 0,4 3,24E-063
Back to the Future (1985)

Terminator, The (1984) -> Raiders 0,95 0,56 1,31 5,42 0,19 1,59E-085
of the Lost Ark (1981)

Monty Python and the Holy Grail 0,87 0,52 1,31 2,56 0,39 4,05E-063
(1974) -> Empire Strikes Back,
The (1980)

Aliens (1986) -> Raiders of the 0,95 0,53 1,31 5,97 0,17 2,69E-071
Lost Ark (1981)

E,T, the Extra-Terrestrial (1982) 0,87 0,52 1,32 2,66 0,38 1,87E-070
-> Empire Strikes Back, The
(1980)

Empire Strikes Back, The (1980) 0,87 0,58 1,32 2,65 0,38 1,25E-082
-> Back to the Future (1985)

Back to the Future (1985) -> 0,88 0,58 1,32 2,73 0,37 1,25E-082
Empire Strikes Back, The (1980)

Forrest Gump (1994) -> Back to 0,87 0,54 1,32 2,65 0,38 9,15E-077
the Future (1985)

Princess Bride, The (1987) -> 0,88 0,52 1,33 2,85 0,35 1,53E-068
Empire Strikes Back, The (1980)

Terminator, The (1984) -> Back to 0,88 0,52 1,33 2,8 0,36 2,67E-068
the Future (1985)

E,T, the Extra-Terrestrial (1982) 0,89 0,53 1,35 3,04 0,33 8,65E-077
-> Back to the Future (1985)

Indiana Jones and the Last 0,89 0,55 1,35 3,12 0,32 1,40E-086
Crusade (1989) -> Back to the
Future (1985)

Terminator, The (1984) -> Empire 0,9 0,53 1,36 3,39 0,3 1,41E-082
Strikes Back, The (1980)

Terminator 2: Judgment Day (1991) 0,91 0,52 1,36 3,55 0,28 6,88E-078
-> Empire Strikes Back, The
(1980)

Monty Python and the Holy Grail 0,9 0,54 1,37 3,42 0,29 1,04E-086
(1974) -> Back to the Future
(1985)

Indiana Jones and the Last 0,91 0,56 1,37 3,59 0,28 2,22E-092
Crusade (1989) -> Empire Strikes
Back, The (1980)

Mission: Impossible (1996) -> 0,93 0,54 1,39 4,93 0,2 6,08E-101
Independence Day (ID4) (1996)

E,T, the Extra-Terrestrial (1982) 0,86 0,51 1,4 2,81 0,36 5,73E-085
-> Forrest Gump (1994)

Terminator, The (1984) -> 0,87 0,51 1,52 3,18 0,32 7,38E-105
Terminator 2: Judgment Day (1991)

Terminator 2: Judgment Day (1991) 0,89 0,51 1,52 3,76 0,27 7,38E-105
-> Terminator, The (1984)

4.1 Tabela com Resultados do experimento 3.1


Regra conf supp lift(B,C) conv lif(B,~C) Chi²
Matrix, The (1999) -> Star 0,86 0,59 1,16 1,87 0,53 7,030104137339
Wars: Episode V - The Empire 189e-241 ok
Strikes Back (1980)

Fugitive, The (1993) -> Star 0,86 0,51 1,16 1,88 0,53 5,654510785047
Wars: Episode V - The Empire 039e-144 ok
Strikes Back (1980)

Terminator 2: Judgment Day 0,87 0,59 1,17 1,94 0,52 5,305459702216


(1991) -> Star Wars: Episode V 838e-212 ok
- The Empire Strikes Back(1980)

Godfather, The (1972) -> Star 0,87 0,5 1,17 1,95 0,51 3,014891772654
Wars: Episode V - The Empire 0143e-130 ok
Strikes Back (1980)

Back to the Future (1985) -> 0,88 0,6 1,18 2,1 0,48 1,795124807749
Star Wars: Episode V - The 8348e-232 ok
Empire Strikes Back (1980)

Princess Bride, The (1987) -> 0,88 0,55 1,18 2,14 0,47 1,634692562034
Star Wars: Episode V - The 5972e-198 ok
Empire Strikes Back (1980)

Total Recall (1990) -> Star 0,89 0,52 1,19 2,25 0,45 6,425985234678
Wars: Episode V - The Empire 3e-208 ok
Strikes Back (1980)

Star Wars: Episode I - The 0,89 0,52 1,19 2,26 0,44 3,747196437836
Phantom Menace (1999) -> Star 419e-167 ok
Wars: Episode V - The Empire
Strikes Back (1980)

Total Recall (1990) -> Star 0,87 0,51 1,2 2,1 0,48 3,878727256151
Wars: Episode IV - A New Hope 46e-196 ok
(1977)

E,T, the Extra-Terrestrial 0,9 0,56 1,2 2,46 0,41 3,643245373098


(1982) -> Star Wars: Episode V 271e-245 ok
- The Empire Strikes Back
(1980)

E,T, the Extra-Terrestrial 0,87 0,55 1,21 2,14 0,47 1,066226854652


(1982) -> Star Wars: Episode IV 7396e-215 ok
- A New Hope (1977)

Star Wars: Episode VI - Return 0,88 0,61 1,22 2,25 0,45 9,712745033625
of the Jedi (1983) -> Star 984e-273 ok
Wars: Episode IV - A New Hope
(1977)

Star Wars: Episode I - The 0,88 0,51 1,22 2,26 0,44 1,553684067369
Phantom Menace (1999) -> Star 7817e-197 ok
Wars: Episode IV - A New Hope
(1977)

Star Wars: Episode V - The 0,88 0,65 1,22 2,27 0,44 0,0 ok
Empire Strikes Back (1980) ->
Star Wars: Episode IV - A New
Hope (1977)

Star Wars: Episode IV - A New 0,91 0,65 1,22 2,72 0,37 0,0 ok
Hope (1977) -> Star Wars:
Episode V - The Empire Strikes
Back (1980)

Raiders of the Lost Ark (1981) 0,91 0,59 1,22 2,73 0,37 0,0 ok
-> Star Wars: Episode V - The
Empire Strikes Back (1980)

Alien (1979) -> Star Wars: 0,91 0,52 1,22 2,83 0,35 2,463608303535
Episode V - The Empire Strikes 6813e-253 ok
Back (1980)

Star Wars: Episode VI - Return 0,92 0,64 1,23 3,03 0,33 0,0 ok
of the Jedi (1983) -> Star
Wars: Episode V - The Empire
Strikes Back (1980)

Raiders of the Lost Ark (1981) 0,89 0,58 1,24 2,55 0,39 0,0 ok
-> Star Wars: Episode IV - A
New Hope (1977)

Terminator, The (1984) -> Star 0,93 0,56 1,25 3,58 0,28 0,0 ok
Wars: Episode V - The Empire
Strikes Back (1980)

Terminator, The (1984) -> Star 0,9 0,54 1,25 2,82 0,35 0,0 ok
Wars: Episode IV - A New Hope
(1977)

Jurassic Park (1993) -> Men in 0,86 0,58 1,26 2,27 0,44 0,0 ok
Black (1997)

Aliens (1986)->Star Wars: 0,94 0,52 1,26 4,3 0,23 0,0 ok


Episode V - The Empire Strikes
Back (1980)

Fugitive, The (1993) -> Matrix, 0,86 0,51 1,27 2,3 0,43 0,0 ok
The (1999)

Terminator, The (1984) -> Star 0,88 0,53 1,27 2,54 0,39 2,094085864915
Wars: Episode VI - Return of 1855e-284 ok
the Jedi (1983)

Alien (1979) -> Star Wars: 0,92 0,52 1,28 3,45 0,29 0,0 ok
Episode IV - A New Hope (1977)

Fugitive, The (1993) -> 0,86 0,51 1,28 2,35 0,43 6,898545901899
Terminator 2: Judgment Day 98e-294 ok
(1991)

Total Recall (1990) ->Men in 0,89 0,52 1,3 2,82 0,35 0,0 ok
Black (1997)

Total Recall (1990) -> Jurassic 0,88 0,52 1,3 2,75 0,36 0,0 ok
Park (1993)

Total Recall (1990) -> Matrix, 0,89 0,52 1,3 2,79 0,36 0,0 ok
The (1999)

Pulp Fiction (1994) -> Fargo 0,87 0,53 1,32 2,58 0,39 0,0 ok
(1996)

Terminator, The (1984) -> 0,89 0,54 1,32 3,06 0,33 0,0 ok
Terminator 2: Judgment Day
(1991)

Total Recall (1990) -> 0,91 0,54 1,34 3,48 0,29 0,0 ok
Terminator 2: Judgment Day
(1991)

5 – Conclusões
Após rodar os experimentos 3.1 e 3.2, foi observado que para o conjunto de 1
milhão de registros os valores de confiança e suporte utilizados com base nos
resultados obtidos do conjunto de 100 mil registros, gerou um conjunto de regras
significantemente menor que o teste antecessor. Para atingir um conjunto de regras
com uma ordem similar a de 3.1 seria necessário diminuir o Suporte utilizado, para
que nãos eja necessário mexer nos valores de confiança mínima e para que o
Lift(B,C) retorne bons valores.
As regras encontradas no experimento 3.1 foram ordenadas baseado no seu lift
de forma crescente. As melhores regras, com maior Lift e confiança encontram-se
no fim da tabela. Para estas regras também foi calculado o Chi² que determina se as
variáveis da regra são correlacionadas, contudo este valor não diz se as variáveis
estão positivamente ou negativamente relacionadas, necessitando assim do Lift(B,C)
para determinar o sentido de correlação dos elementos. Foi feito também o
Lift(B,~C) que determinaria a probabilidade dos elemento B e ~C estarem
correlacionados(“Regras Nulas”), e não foi obtida nenhuma regra que tivesse essa
relação satisfeita. Logo, os resultados obtidos tem uma confiabilidade interessante
para a utilização.

Você também pode gostar