Machine learning com Apache Spark

39
Machine Learning com Apache Spark Sandys Nunes

Transcript of Machine learning com Apache Spark

Page 1: Machine learning com Apache Spark

Machine Learning com Apache Spark

Sandys Nunes

Sandys Nunes
remover
Page 2: Machine learning com Apache Spark

Quem sou eu?

- Campo-grandense

- Estudante de Ciência da Computação

- Desenvolvedor na Tecsinapse

Twitter: @SandysNunes

Page 3: Machine learning com Apache Spark

Agenda

- Visão Geral sobre o Apache Spark

- Algumas ferramentas

- Geração de regras de associação

- Clustering com K-Means

- Classificação com Árvore de Decisão

Page 4: Machine learning com Apache Spark

O que é o Apache Spark?

Engine para processamento de dados em larga escala.

Page 5: Machine learning com Apache Spark

Fácil de usar

● Suporte a várias linguagens

● Shell interativo

● API ricaPython

Scala

Java

Page 6: Machine learning com Apache Spark

Lendo os dados

Page 7: Machine learning com Apache Spark

Exemplo - Frequência de palavras

Page 8: Machine learning com Apache Spark

RDD - Resilient Distributed Datasets

Uma abstração para que os programadores possam executar cálculos/operações em memória em um cluster tolerante à falhas.

Coleções imutáveis

Particionadas e Distribuídas

Armazenadas em memória

Partições são “recomputadas” em caso de falha

Page 9: Machine learning com Apache Spark
Page 10: Machine learning com Apache Spark

RDD - Operações

Page 11: Machine learning com Apache Spark

Spark Cluster

Page 12: Machine learning com Apache Spark

Spark standalone cluster

Page 13: Machine learning com Apache Spark

Vamos aos dados

Page 14: Machine learning com Apache Spark

1 - Apache Zeppelin

João Bosco Monteiro
Daki pra frente, vc vai mostrar algo na sua máquina mesmo ou só nos slides?
Sandys Nunes
Só nos slides. Não vou codificar nada ao vivo.
Page 15: Machine learning com Apache Spark

Exemplo - Vamos Explorar!

Page 16: Machine learning com Apache Spark
Page 17: Machine learning com Apache Spark
Page 18: Machine learning com Apache Spark
Page 19: Machine learning com Apache Spark
Page 20: Machine learning com Apache Spark
Page 21: Machine learning com Apache Spark

Spark+

Jupyter+

Python +

Pandas/Matplotlib

Page 22: Machine learning com Apache Spark

Spark+

Jupyter+

Python +

Seaborn

Page 23: Machine learning com Apache Spark

Regras de Associação

Page 24: Machine learning com Apache Spark

Analisando transações

Ex. suporte: {leite, pão, manteiga} = 20%

Ex. confiança: {leite, pão} => {manteiga} = 50%

Page 25: Machine learning com Apache Spark
Page 26: Machine learning com Apache Spark

K-Means

Page 27: Machine learning com Apache Spark

Clustering: K-Means

Page 28: Machine learning com Apache Spark

Calculando o erro até 10 centróides (Iris Data Set )

Page 29: Machine learning com Apache Spark

Gráfico “Cotovelo”

Page 30: Machine learning com Apache Spark

Árvore de Decisão

Page 31: Machine learning com Apache Spark

KDD Cup 1999 Data

Page 32: Machine learning com Apache Spark

Leitura dos dados

Page 33: Machine learning com Apache Spark
Page 34: Machine learning com Apache Spark

Treinamento e Validação

Page 35: Machine learning com Apache Spark
Page 36: Machine learning com Apache Spark
Page 37: Machine learning com Apache Spark

Para saber mais

Page 38: Machine learning com Apache Spark

Referências

RDD: https://www.cs.berkeley.edu/~matei/papers/2012/nsdi_spark.pdf

Spark: http://spark.apache.org/docs/latest/

Matplotlib: http://matplotlib.org/examples/index.html

Jupyter: http://jupyter.readthedocs.org/en/latest/index.html

KDD Cup 1999: http://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html

Seaborn: http://stanford.edu/~mwaskom/software/seaborn/

Pandas: http://stanford.edu/~mwaskom/software/seaborn/

Page 39: Machine learning com Apache Spark

Obrigado!