zenika matinale spark-zeppelin_ml
TRANSCRIPT
![Page 1: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/1.jpg)
Matinale Big Data
Spark et Machine Learning
Zenika Lyon, le 25/05/16
![Page 2: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/2.jpg)
Hervé RIVIERE
Développeur Big Data / NoSQLFormateur Couchbase
Fabrice SZNAJDERMAN
Développeur Java / Scala / WebFormateur Java / ScalaCo-organisateur du ScalaIO 2016 (Lyon le 27 – 28 octobre)
![Page 3: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/3.jpg)
Big Data : Spark + Machine LearningSommaire
Big Data : Panorama 2016 (15 ’)1
2 Présentation d’Apache Spark et
Apache Zeppelin (45’)
4 Démystifions le Machine Learning (45’)
3 Pause (30’)
![Page 4: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/4.jpg)
Panorama
2016 du Big Data
![Page 5: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/5.jpg)
Big Data ?
![Page 6: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/6.jpg)
De 2014 à 2017….
2014
• POC / expérimentation
• Usage analytique
• Hadoop Map-Reduce / HDFS / Pig / Hive / HBase / Storm ….
2015
• Industrialisation Data-Lake / Création Plateforme Big Data analytique
• POC streaming / Plateforme Big Data opérationnelle
• Spark / Cassandra / HDFS /Kafka / Storm / Samza / Mesos
2016
• Industrialisation Streaming / Plateforme Big Data opérationnelle
• Expérimentation/ POC Big Data Prédictif / Machine Learning
• Kafka / Spark / Flink / HDFS / Notebook web / Cassandra / Mesos….
2017• Industrialisation Big Data Prédictif / Machine Learning ? Internet of Things ?
• Kafka stream ? / Kudu ? /Spark 2.0 ? / Flink ? ….
![Page 7: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/7.jpg)
Le Big Data pour quoi faire ?
• Informatique décisionnelle : Statistiques descriptives sur des données à forte densité en informationExemple : Données CRM dans une BDD
• Big Data : Données à faible densité d’informations mais dont l’important volume permet d’en déduire des lois / règles Statistiques inférentiellesExemple : Données issues de capteurs dans un Data Lake
• Fast Data : Transformer en temps réel la données à la place de traitements quotidiens / hebdomadaires / mensuelsExemple : Données issues d’un site web dans des topic Kafka
![Page 8: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/8.jpg)
Exemple de projets
• Vision clients 360° (Banque / Distribution / Service…)o Réagir lors de certains évènements cross-canaux o Recommandation o Analyse ad-hoc spécifique métier (marketing, fraude…)
• Analyse de données logs/capteurs (Industrie, Services, IT…)• Automatiser une surveillance humaine• Analyser puis optimiser
• Soulager des outils décisionnels par des technologies Big Data• Pour la scalabilité• Pour de nouvelles possibilités (temps réel, schéma plus
flexible, vitesse ….)
![Page 9: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/9.jpg)
Nos interventions
Architecture Big Data Industrialisations
développements
POC Java / Scala
Dataviz
Formations
Industrialisation algorithmes
machine learning
NoSQL
Expertise technique
Ateliers innovations
![Page 10: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/10.jpg)
Outils
et
architectures
![Page 11: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/11.jpg)
Streaming
Query/SQL
ETL
Machine Learning
Search Engine
Scheduler
Service Discovery
Resource Manager
Kafka NiFi Flink StormZookeeper Spark Yarn
Mesos
File System
OLAP
Columns
Document
Key-Value
Graph
In-memory/Cache
Time-Series
CassandraMongoDBNeo4j
Titan Couchbase Druid InfluxDB
Hazelcast
Redis
Aerospike Kylin
SolRElasticSearch
MahoutTez, Slider
Oozie
Hive,
Impala, Hawq
Drill
Pig
MR
Fram
ewo
rks
Sto
rage
/ N
oSQ
L
HbaseHDFS
![Page 12: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/12.jpg)
Architectures Big Data
Couche temps réel / Opérationnelle
Couche batch / analytique
Requêtes
Requêtes
Données
Données
Données
Données
![Page 13: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/13.jpg)
Analytique
De 3 à 300 nœuds ! Stocker / traiter un (très) important volume de données (Tera octets…) à intervalle régulier Système analytique et non opérationnel !
StockageOutil couramment utilisé
En complément ou alternative
Exécution Outil couramment utilisé
En complément ou alternative
Scheduler
• NiFi• Oozie
Notebook web
• Zeppelin• Jupyter
data-minning / Machine learning
• R / Python • Mahout / H2O• Dataiku
I/O
• Sqoop- Kafka
Ressource negociator
• YARN• Mesos
![Page 14: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/14.jpg)
Opérationnelle
De 3 à 300 nœuds ! Traiter un important volume de données en temps réelSystème opérationnel et non analytique !
StockageOutil couramment utilisé
En complément ou alternative
ExécutionOutil couramment utilisé
En complément ou alternative
Schema registry
• Avro
API I/O
• Akka• Spring• Play…
Ressource negociator
• Yarn• Mesos
SMACK
![Page 15: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/15.jpg)
Nos
partenaires
![Page 16: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/16.jpg)
Nos partenaires conseil et formation
NoSQL
Langages & Ecosystème Big Data
Intégration &continuous delivery
![Page 17: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/17.jpg)
![Page 18: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/18.jpg)
Spark & Zeppelin
Matinale Spark et ML
25/05/16Fabrice Sznajderman
![Page 19: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/19.jpg)
Agenda
●Apache Spark●Apache Zeppelin
Introduction
![Page 20: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/20.jpg)
SparkIntroduction
![Page 21: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/21.jpg)
Big pictureSpark introduction
![Page 22: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/22.jpg)
What is it about?
●A cluster computing framework ●Open source●Written in Scala
![Page 23: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/23.jpg)
History
2009 : Project start at MIT research lab
2010 : Project open-sourced
2013 : Become a Apache project and creation of the Databricks company
2014 : Become a top level Apache project and the most active project in the Apache fundation (500+ contributors)
2014 : Release of Spark 1.0, 1.1 and 1.2
2015 : Release of Spark 1.3, 1.4, 1.5 and 1.6
2015 : IBM, SAP… investment in Spark
2015 : 2000 registration in Spark Summit SF, 1000 in Spark Summit Amsterdam
2016 : new Spark Summit in San Francisco in June 2016
![Page 24: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/24.jpg)
Where spark is used?
Source : http://cdn2.hubspot.net/hubfs/438089/DataBricks_Surveys_-_Content/Spark-Survey-2015-Infographic.pdf?t=1443057549926
The results reflect the answers and opinions of over 1,417 respondents representing over 842
organizations.
![Page 25: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/25.jpg)
Which kind of using?
Source : http://cdn2.hubspot.net/hubfs/438089/DataBricks_Surveys_-_Content/Spark-Survey-2015-Infographic.pdf?t=1443057549926
![Page 26: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/26.jpg)
Multi-languages
Source : http://cdn2.hubspot.net/hubfs/438089/DataBricks_Surveys_-_Content/Spark-Survey-2015-Infographic.pdf?t=1443057549926
![Page 27: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/27.jpg)
Spark Shell
●REPL●Learn API●Interactive Analysis
![Page 28: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/28.jpg)
RDDCore concept
![Page 29: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/29.jpg)
Definition
●Resilient ●Distributed ●Datasets
![Page 30: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/30.jpg)
Properties
●Immutable ●Serializable●Can be persist in RAM and / or
disk●Simple or complexe type
![Page 31: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/31.jpg)
Use as a collection
●DSL●Monadic type●Several operators
–map, filter, count, distinct, flatmap, ...– join, groupBy, union, ...
![Page 32: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/32.jpg)
●A collection (List, Set)●Various formats of file
– json, text, Hadoop SequenceFile, ...
●Various database –JDBC, Cassandra, ...
●Others RDD
Created from
Sources must be natively distributed (hdfs, cassandra,..), if not network become bottleneck
![Page 33: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/33.jpg)
Sample
val conf = new SparkConf()
.setAppName("sample")
.setMaster("local")
val sc = new SparkContext(conf)
val rdd = sc.textFile("data.csv")
val nb = rdd.map(s => s.length).filter(i => i> 10).count()
![Page 34: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/34.jpg)
Lazy-evaluation
●Intermediate operators –map, filter, distinct, flatmap, …
●final operators–count, mean, fold, first, ...
val nb = rdd.map(s => s.length).filter(i => i> 10).count()
![Page 35: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/35.jpg)
Caching
●Reused an intermediate result●Cache operator●Avoid re-computing
val r = rdd.map(s => s.length).cache()
val nb = r.filter(i => i> 10).count()
val sum = r.filter(i => i> 10).sum()
![Page 36: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/36.jpg)
DistributedArchitecture
Core concept
![Page 37: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/37.jpg)
Run locally
val master = "local"
val master = "local[*]"
val master = "local[4]"
val conf = new SparkConf().setAppName("sample")
.setMaster(master)
val sc = new SparkContext(conf)
![Page 38: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/38.jpg)
Run on cluster
val master = "spark://..."
val conf = new SparkConf().setAppName("sample")
.setMaster(master)
val sc = new SparkContext(conf)
![Page 39: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/39.jpg)
Cluster
Spark
Master
Spark
Slave
Spark
Slave
Spark
Slave
E
EE
E
E
E
Spark
client
Spark
client
Spark
client
![Page 40: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/40.jpg)
ModulesCore concept
![Page 41: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/41.jpg)
Composed by
Spark Core
Spark
StreamingMLlib GraphX
Spark
SQL
ML PipelineDataFrames
Several data sources
![Page 42: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/42.jpg)
Statistics of using
![Page 43: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/43.jpg)
Several data sources
http://prog3.com/article/2015-06-18/2824958
![Page 44: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/44.jpg)
Spark SQL
![Page 45: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/45.jpg)
Spark SQL
●Structured data processing
●SQL Language
●DataFrame
![Page 46: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/46.jpg)
DataFrame 1/3
●A distributed collection of rows
organized into named columns
●An abstraction for selecting,
filtering, aggregating and
plotting structured data
●Provide a schema
●Not a RDD replacement
What?
![Page 47: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/47.jpg)
DataFrame 1/3
●RDD more efficient than before
(Hadoop)
●But RDD is still too complicated
for common tasks
●DataFrame is more simple and
faster
Why?
![Page 48: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/48.jpg)
DataFrame 2/3
Optimized
![Page 49: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/49.jpg)
DataFrame 3/3
●From Spark 1.3
● DataFrame API is just an interface
– Implementation is done one time in Spark engine
–All languages take benefits of optimization with out rewriting anything
How ?
![Page 50: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/50.jpg)
Spark Streaming
![Page 51: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/51.jpg)
Spark Streaming
●Framework over RDD and Dataframe API
●Real-time data processing●RDD is DStream here●Same as before but dataset is
not static
![Page 52: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/52.jpg)
Spark StreamingInternal flow
http://spark.apache.org/docs/latest/img/streaming-flow.png
![Page 53: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/53.jpg)
Spark StreamingInputs / Ouputs
http://spark.apache.org/docs/latest/img/streaming-arch.png
![Page 54: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/54.jpg)
Spark MLlib
![Page 55: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/55.jpg)
Spark MLlib
●Make pratical machine learning scalable and easy
●Provide commons learning algorithms & utilities
![Page 56: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/56.jpg)
Spark MLlib
●Divides into 2 packages
– spark.mllib– spark.ml
![Page 57: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/57.jpg)
Spark MLlib
●Original API based on RDD●Each model has its own
interface
spark.mllib
![Page 58: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/58.jpg)
Spark MLlib
●Provides uniform set of high-level APIs
●Based on top of Dataframe●Pipeline concepts
–Transformer–Estimator–Pipeline
spark.ml
![Page 59: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/59.jpg)
Spark MLlibspark.ml
●Transformer : transform(DF)–map a dataFrame by adding new
column–predict the label and adding result in
new column
●Estimator : fit(DF)– learning algorithm–produces a model from dataFrame
![Page 60: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/60.jpg)
Spark MLlibspark.ml
●Pipeline –sequence of stages (transformer or
estimator)–specific order
![Page 61: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/61.jpg)
Spark 2.0
![Page 62: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/62.jpg)
Spark 2.0
●Easier ●Faster●Smarter
3 axis
![Page 63: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/63.jpg)
Spark 2.0
●Unifying DataFrames and Datasets in Scala/Java
●SparkSession (replace SQLContext & HiveContext)
●Simpler, more performant Accumulator API
●spark.ml package emerges as the primary ML API
Easier
![Page 64: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/64.jpg)
Spark 2.0
According to our 2015 Spark Survey, 91%of users consider performance as the most important aspect of Spark.
l
Faster
![Page 65: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/65.jpg)
Spark 2.0Faster
●The second generation of Tungsten engine
●Builds upon ideas from– Modern compilers
– Massively Parallel Processing Database (MPP)
●Spark SQL’s Catalyst Optimizer improvement
![Page 66: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/66.jpg)
Spark 2.0Faster
![Page 67: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/67.jpg)
Spark 2.0
●Structured Streaming API
●Based on Catalyst optimizer
●Unifying DataFrames and Datasets
Smarter
![Page 68: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/68.jpg)
Spark 2.0
This technical preview version is now available on Databricks :
https://databricks.com/try-databricks
Try it
![Page 69: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/69.jpg)
ZeppelinIntroduction
![Page 70: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/70.jpg)
Big pictureZeppelin introduction
![Page 71: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/71.jpg)
What it is about?
●“A web-based notebook that enables interactive data analytics”
●100% opensource●Undergoing Incubation but …
![Page 72: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/72.jpg)
Top level project at ASF!
![Page 73: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/73.jpg)
Multi-purpose
●Data Ingestion
●Data Discovery
●Data Analytics
●Data Visualization & Collaboration
![Page 74: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/74.jpg)
Multiple Language backend
●Scala
●shell
●python
●markdown
●your language by creation your own interpreter
![Page 75: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/75.jpg)
Data visualizationEasy way to build graph from data
![Page 76: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/76.jpg)
Demo
![Page 77: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/77.jpg)
Thank you
![Page 78: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/78.jpg)
![Page 79: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/79.jpg)
Démystifions le Machine
LearningMatinale Spark et ML
25/05/16Hervé RIVIERE
![Page 80: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/80.jpg)
Démystifions le Machine LearningSommaire
Machine Learning ? 1
2
4
Fondamentaux
Algorithmes
3 Préparation des données
5 Outils
6 Mettre en place un projet ML
![Page 81: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/81.jpg)
Machine
Learning ?
![Page 82: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/82.jpg)
Machine learning : ”Field of study that gives computers the ability to learn without being explicitly programmed.” Arthur Samuel
Solves tasks that people are good at, but traditional computation is bad at.
Programmes qui ecrivent de nouveaux programmes
![Page 83: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/83.jpg)
![Page 84: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/84.jpg)
Orange : « Sauvons les livebox »Prévenir le foudroiement Demande client de débrancher son équipement
Fnac : Ciblage marketing / envoi d’email de recommandationPasser d’une solution avec des RG statiques à des algorithmes de machine learningOptimiser ROI
![Page 85: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/85.jpg)
Remplacer des règles de gestion métier statiques par un algorithme auto-apprenant.
1- Mesure du risque (exemple : taux de prêt en fonction du dossier)
2- Recommandation (exemple : recommandation de films, pub)
3- Prédiction de revenu
4- Prédiction d’un comportement client (désabonnement, appel hotline…)
![Page 86: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/86.jpg)
Etre capable de détecter et réagir à des signaux faibles
1- Prévision et / ou détection d’une panne
2- Diagnostic médical
3- Asservissement machine – optimiser consommation électrique
![Page 87: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/87.jpg)
Mieux comprendre un jeu de données via les corrélations faites par les algorithmes ML
1 – Détecter / identifier des signaux faibles (ex : fraude, marketing…)
2 – Segmentation en différente catégories (exemple : campagne de publicité)
![Page 88: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/88.jpg)
Machine Learning RegressionDeep Learning ClusteringData Science Features engineering
(….)
![Page 89: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/89.jpg)
![Page 90: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/90.jpg)
Fondamentaux
![Page 91: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/91.jpg)
Variable cible
numérique
Type Surface (m²) Nb de pièces Date de construction
Prix (€)
Appartement 120 4 2005 200 000
Maison 200 7 1964 250 000
Maison 450 15 1878 700 000
Appartement 300 8 1986 ?????
Variables prédictives = Features
Prédire une valeur numérique : Algorithme de régression
![Page 92: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/92.jpg)
Variable cible textuelle
= classe
Type Surface (m²) Nb de pièces Date de construction
Prix (€)
Appartement 120 4 2005 200 000
Maison 200 7 1964 250 000
Maison 450 15 1878 700 000
???? 300 8 1986 600 000
Variables prédictives = Features
Prédire une valeur textuelle : Algorithme de classification
![Page 93: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/93.jpg)
0
100
200
300
400
500
600
0 5 10 15 20 25
Pri
x (
K€
)
Observations
Revenu réel
Fonction prédictive
Bruit aléatoire
Prix réel = f(X) + a
a
a
a
f(X)
Modèle ML
Ecart imprévisible
Prédiction jamais exacte !
![Page 94: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/94.jpg)
Si « a » trop important…
Modèle ML
Ecart imprévisible
Prédiction jamais exacte !
Prix réel = f(X) + a
Données non prédictible !
0
10
20
30
40
50
60
0 5 10 15 20 25
Pri
x (
K€
)
Observations
Revenu réel
Fonction prédictive
Bruit
![Page 95: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/95.jpg)
DWH
Open Data
Web
crawling
Dataset d’entrainement
avec variables
prédictives et cible
Modèle
PrédictionVariable cible
HypothèsesVariables
prédictives
….
Préparation Construction du
modèle :
Générer un
programme (ie. le
modèle)
Production :
Utiliser le
programme généré
![Page 96: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/96.jpg)
Voitures
?????
![Page 97: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/97.jpg)
• Prédiction de l’avenir proche en fonction du
passé
• Approximation d’un pattern à partir d’exemple
• Copie d’un comportement en « boite noire »
(juste input et output)
• Algorithmes qui s’adaptent
![Page 98: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/98.jpg)
Préparation des
données
![Page 99: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/99.jpg)
DWH
Open Data
Web
crawling
Modèle
Prédiction
Hypothèses
Préparation
Dataset d’entrainement
avec variables
prédictives et cible
….
![Page 100: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/100.jpg)
- Complétude: champs manquant ?
- Echelle: Revenues par pays et nombre d’achats par
région !
- Exactitude : données réelles ?
- Fraicheur : Données du 19e siècle ?
![Page 101: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/101.jpg)
- Format : CSV, images, JSON, BDD JSON
- Agréger
- Enrichir
A B C D E F G H
10 3 2 5 7 43 2 4
1 24 34 5 876 7 6 52
43 24 1 558 23 4 5 6
Algorithmes ML
![Page 102: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/102.jpg)
Moyenne des X : 9Moyenne des Y : 7.5
![Page 103: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/103.jpg)
• Une tache potentiellement (très…) longue
• Ingrat ?
• Influence directement le modèle
• Une bonne préparation des données est
meilleure que des bon algorithmes !
![Page 104: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/104.jpg)
Algorithmes
![Page 105: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/105.jpg)
DWH
Open Data
Web crawling
Dataset d’entrainement
Modèle
Prédiction
Hypothèses
![Page 106: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/106.jpg)
AlgorithmesRégression
![Page 107: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/107.jpg)
Variable cible
numérique
Type Surface (m²) Nb de pièces Date de construction
Prix (€)
Appartement 120 4 2005 200 000
Maison 200 7 1964 250 000
Maison 450 15 1878 700 000
Appartement 300 8 1986 ?????
Variables prédictives = Features
Prédire une valeur numérique : Algorithme de régression
![Page 108: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/108.jpg)
Illustration en 2D, majorité des modèles avec 5..10..1000 dimensions
0
10
20
30
40
50
0 5 10 15 20 25
Pri
x (
K€
)
Observations
Revenu réel
Fonction prédictive
Linéaire : f(X)=aX+b (avec « a » et « b » découverts automatiquement)
0
2000
4000
6000
8000
10000
0 5 10 15 20 25
Pri
x (
K€
)
Observations
Revenu réel
Fonction prédictive
Polynomiale : f(X)=aXy+bXz… (avec « a » et « b », « x », « y » découverts automatiquement)
![Page 109: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/109.jpg)
Programme généré par l’algorithme après entrainement :Une formule mathématiques
Prix maison = 2*nbPieces + 3*surface
![Page 110: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/110.jpg)
Essai successifs de l’algorithme pour trouver la courbe qui minimise l’erreur
Simple à visualiser / comprendre
Algorithme supervisé (nécessite un entrainement préalable)
Peut être utilisé à des fin prédictive ou descriptive
Très sensible à la préparation initiale (valeurs aberrantes…)
Suppose que les données peuvent être modélisées sous formes
d’équations
![Page 111: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/111.jpg)
Prix d’une maison : Si 10 + pièces…
Type
Pièce >10 Surface > 300
Etage <= 3 Ville = Paris
MaisonAppartement
Oui Non
Oui Oui NonNon
Oui Non
300 000€ 200 000€900 000€700 000€
400 000€600 000€
![Page 112: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/112.jpg)
Programme généré par l’algorithme après l’entrainement :Conditions
If(surface>10 && piece=3)if(type==maison) 250 000else if (type==appartement) 150 000
Else 145 000
![Page 113: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/113.jpg)
Algorithme supervisé (nécessite un entrainement préalable)
Moins sensible à la qualité de préparation de données
Paramètre à définir : nombre d’arbres / profondeurs etc…
Plusieurs arbres entrainés avec des subsets variés peuvent être
combinés Random Forest
Le random forest est un des algorithmes actuellement le plus performant
![Page 114: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/114.jpg)
AlgorithmesClassification
![Page 115: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/115.jpg)
Variable cible textuelle
= classe
Type Surface (m²) Nb de pièces Date de construction
Prix (€)
Appartement 120 4 2005 200 000
Maison 200 7 1964 250 000
Maison 450 15 1878 700 000
???? 300 8 1986 600 000
Variables prédictives = Features
Prédire une valeur textuelle : Algorithme de classification
![Page 116: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/116.jpg)
Malade / Sain
Recommandation de film
Transformer un problème de régression (ex : prix d’une maison) en
classification :
« Cette maison va-t-elle se vendre plus cher que le prix moyen de
la ville » Oui / Non
Minimiser l’erreur
![Page 117: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/117.jpg)
![Page 118: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/118.jpg)
Ne fonctionne qu’avec 2 catégories uniquement !
![Page 119: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/119.jpg)
Boisson = alcool
Prix > 30€ Steak haché
Boisson=vin
NonOui
Oui Non
Oui
Adulte
Non
Oui Non
AdolescentEnfant
Senior Adulte
![Page 120: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/120.jpg)
![Page 121: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/121.jpg)
Midi Soir
![Page 122: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/122.jpg)
Algorithme non supervisé (pas d’entrainement)
Utilisé pour des algorithmes de recommandation (Netflix)
Le nombre de catégorie est définis par l’utilisateur ou dynamique
Le nom / description des catégorie est à définir par l’utilisateur
![Page 123: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/123.jpg)
![Page 124: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/124.jpg)
Quels outils ?
![Page 125: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/125.jpg)
Mathématiques !
![Page 126: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/126.jpg)
Connaissances métier !
![Page 127: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/127.jpg)
PrototypageVoir grand, commencer petit
Prototypage : tester rapidement et de façon autonome les
hypothèses
• R
• SAS
• Scikit-learn (Python)
• Dataiku
• Excel
• Tableau
• ….
![Page 128: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/128.jpg)
Industrialisation : Automatisation, performance, maintenabilité,
important volume de données….
Important travail de réécriture de code !
• Brique ETL en amont
• Construction du modèle :• Volume de donnée « faible » : R / SAS / Python industrialisé
• Volume de donnée « important » : Spark / Hadoop/Mahout (calcul distribué)
• Solutions cloud (Azure ML / Amazon ML / Google prediction API)
• Distribution du modèle en aval :• Webservice
• Embarqué dans une application
• …
![Page 129: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/129.jpg)
Mettre en place
un projet
ML
![Page 130: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/130.jpg)
![Page 131: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/131.jpg)
![Page 132: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/132.jpg)
Start Small – Scale Fast
![Page 133: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/133.jpg)
Big Data et machine learning: Manuel du data scientistDunod
MOOC Machine Learning, CourseraAndrew Ng
![Page 134: Zenika matinale spark-zeppelin_ml](https://reader034.vdocument.in/reader034/viewer/2022051503/587c05331a28ab7c668b75b7/html5/thumbnails/134.jpg)