1. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Microsoft Machine
Learning empresarial
Maximiliano Accotto | MVP Data Platform since 2005
TriggerDB Consulting SRL
www.triggerdb.com
3. 15 al 17 de Noviembre 2018.NET Conf UY v2018
¿Que es Machine Learning?
La creación de programas capaces de generalizar
comportamientos a partir de una información
suministrada en forma de ejemplos.
4. 15 al 17 de Noviembre 2018.NET Conf UY v2018
AcciónDecisión
Tableros interactivos
¿Por qué pasó?
Predictions
¿Qué pasará?
Recommendations
¿Qué debería hacer? Recomendaciones Automatizadas
Soporte en la decisión
Data
Value
Reportes Estaticos
¿Qué pasó? Procesos manuales
Del dato a la decisión y acción
5. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Evolución del análisis
¿Qué debería
hacer?
¿Qué pasará?¿Por qué pasó?¿Qué pasó?
Dashboards
Interactivos
Recomendaciones
Automatización
Modelos
Predictivos
Reportes
Insight
Diagnóstico PrescriptivoPredictivoDescriptivo
BI Tradicional Análisis Avanzado
6. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Spark
SQL Server
Virtual machines
GPUs
Container services
Notebooks
IDEs
Azure Machine Learning Workbench
SQL Server
Machine Learning Server
O N - P R E M I S E S
Microsoft Machine Learning
E D G E C O M P U T I N G
Azure IoT Edge
Experimentation and
Model Management
T R A I N & D E P L O Y O P T I O N S
A Z U R E
7. 15 al 17 de Noviembre 2018.NET Conf UY v2018
SQL Server Machine Learning
8. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Regular Database + App Intelligence Database + App
Llevar la inteligencia a donde están los datos
Application +
Intelligence
Database
Application
Intelligence
+ Database
VS
9. 15 al 17 de Noviembre 2018.NET Conf UY v2018
¿Porque ML en SQL Server?
Eliminar el movimiento de datos
Aprovechar la seguridad de la base de datos
Ejecutar los calculos de ML en la base de datos
Operación ML scripts y modelos
Usar store Procedures de T-SQL
Manejar los modelos en el SQL Server
Performance y escalabilidad Enterprise
Escalar con R y Python analytics usando multi-threading
y parallel processing.
SQL Server security, compliance, resource governance,
query performance, always on secondaries
Data Scientist
Interacts directly
with data
SQL Developer/
DBA
Manage data and
analytics together
SQL Transformations
010010
100100
010101
Relational data
Analytics library
R
integration
010010
100100
010101
010010
100100
010101
Python
integration
10. 15 al 17 de Noviembre 2018.NET Conf UY v2018
SQL Machine Learning Services
• SQL Server 2016
• R support (3.2.2 version)
• Microsoft R Server
• SQL Server 2017
• Scoring native en TSQL usando PREDICT function
• EXTERNAL LIBRARY DDL para el manejo de paquetes R
• Ejecución en batch para la entrada de datos
• Soporte para R (3.3.3 version)
• Soporte para Python (Anaconda 3.5.2)
11. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Any R/Python
IDE
Data Scientist
Workstation
Script
Results
Execution
1
3
Data Scientists - Exploración de Datos y Desarrollo de
Modelos
SQL Server
2
R/Python Runtime
Machine Learning
Services
train <- RxSqlServerData(query,
connectionString, computeContext)
rxLogit(formula, train)
12. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Application exec sp_execute_external_script
@language = ‘Python’
, @script =
-- Python code --
The stored procedure contains R or
Python code and executes in-
database
Application Developer - Operacionalización de
modelos
Stored Proc call
Results
1
3
Execution
SQL Server
2
R/Python Runtime
Machine Learning
Services
13. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Trabajo del DBA: Habilitar ML en SQL Server
Enable External scripts
– Exec sp_configure ‘external
scripts enabled’, 1
– RCONFIGURE
SQL Server
2016
O superior
14. 15 al 17 de Noviembre 2018.NET Conf UY v2018
sp_execute_external_script
15. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Tipos de salida
1. Dataset
• Standard resultset of rows and columns
• Data types will vary
2. Plot
• Static images
• Binary
3. Model
• Trained models such as linear regression, naïve bayes, etc.
• Binary
16. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Realtime Predictions usando Scoring nativo
• PREDICT function
• No depende de R o Python runtime
• Habilitado on SQL Server tanto en Windows como Linux
• Uso
• Single or small number of rows scoring
• Highly concurrent scoring scenarios
• Predict during INSERT, UPDATE, MERGE statements
• Requirements
• Models built using RevoScaleR or revoscalepy
• rxLinMod, rxLogit, rxBTrees, rxDTree, rxDForest
• Serialized using rxSerializeModel (R) or rx_serialize_model (Python)
17. 15 al 17 de Noviembre 2018.NET Conf UY v2018
PREDICT syntax
18. 15 al 17 de Noviembre 2018.NET Conf UY v2018
1,000,000 predictions per second
https://blogs.technet.microsoft.com/dataplatforminsider/2016/10/11/1000000-predictions-per-
second/
19. 15 al 17 de Noviembre 2018.NET Conf UY v2018
SQL Server Machine Server
20. 15 al 17 de Noviembre 2018.NET Conf UY v2018
SQL Machine Learning Server
• Soporte Multi-plataforma
• Windows, Linux, Hadoop, SQL Server
• Microsoft R Server
• RevoScaleR, MicrosoftML, olapR, sqlrutils packages
• Uso de Web services para operar.
• Microsoft Machine Learning Server
• Soporte de R & Python
• revoscalepy, microsoftml python libraries
• rxExecBy
21. 15 al 17 de Noviembre 2018.NET Conf UY v2018
SQL Machine Learning Server
• Setup one-box
configuration
> az ml admin boostrap
• Jupyter notebook
deploy, and consume
22. 15 al 17 de Noviembre 2018.NET Conf UY v2018
SQL Machine Learning Server – Multi Server
Configuration
23. 15 al 17 de Noviembre 2018.NET Conf UY v2018
SQL Server 2019 y ML (big data Cluster)
24. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Azure Machine Learning
25. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Azure Machine Learning
• Compila y entrena modelos en Microsoft Azure.
• Utiliza tecnologías de código abierto como TensorFlow, PyTorch o
Jupyter.
• Puede hacer experimentos en su entorno local y luego escálelos
vertical u horizontalmente a la nube con grandes clústeres
habilitados para GPU.
• Puede administrar sus modelos con herramientas integradas
26. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Azure Machine Learning workbench
27. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Integración con VS code
28. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Machine Learning Studio
30. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Machine Learning en Apache
Spark
31. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Implementaciones de ML para Spark
• Machine Learning Server
• Azure Hdinsight con ML Server
• Azure Databricks
32. 15 al 17 de Noviembre 2018.NET Conf UY v2018
ML para Spark
• PySpark y R
• Integración con herramientas como jupyter , Visual Studio, Vscode o
Rstudio
33. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Recursos
34. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Recursos
• Galerías de ML
• Ejemplos de MS en Github
• Ejemplos ML para Spark GitHub
• Azure Data Science Virtual Machine
• Lab Azure Machine Learning
• Lab Azure Hdinsight
35. 15 al 17 de Noviembre 2018.NET Conf UY v2018
Microsoft Machine Learning
www.triggerdb.com
maxiaccotto
maxi@triggerdb.com
Maximiliano Accotto | MVP Data Platform