SQL Server 2016 R Services -...
Transcript of SQL Server 2016 R Services -...
•
•
•
•
•
Act:
Score,
Visualize
Deploy Apps,
Services &
Visualizaitons
Measure
Preparation Modeling
Feature &
Algorithm
Selection
Model
Testing &
Validation
Operationalization
Models
Visualizations
Ingest
Profile
Explore
Visualize
Transform
Cleanse
Denormalize
Advanced Analytics Portfolio
5
SSRS
SharePoint BI
Excel BI
Datazen
SQL Server
SQL Server
Integration Services SQL Server Analysis Services
Hadoop
(on-premise / Azure VM)
SQL Server
MDS, DQS
Applications
HIVE
SQOOPPIG
OOZIE
SQL
HBase
Hadoop/OSOn-premise
✓ Comprehensive Connected Choice✓ ✓
Storm
R Server
Intelligence Cognitive Services, Bot Framework. Cortana
Dashboards and Visualizations Power BI SSRS, DataZen, R R visualizations
Machine learning and Analytics Machine learning, Stream Analytics, HDInsight SSAS, SQL Server R Services Microsoft R
Big Data Store Data Lake, SQL, DW OLTP, DW, Hadoop, EDSs Hadoop, Teradata, Linux, Windows
Information Management Data Factory, Data Catalog, Event Hubs SSIS, DQS, MDS Spark SQL/ETL
Cortana Intelligence Suite Microsoft RSQL Server 2016
In Database analytics R-based analyticsCloud analytics
Transform data into intelligent action
Intelligence
Cortana
Cognitive
Services
Bot
Framework
Preconfigured Solutions
Dashboards and Visualizations
Machine Learning and Analytics
Big Data Store
Information Management
Easily build, deploy, and share predictive analytics solutions
• Simple, scalable, cutting edge. A fully managed cloud service that enables you to easily build, deploy, and share predictive analytics solutions.
• Deploy in minutes. Azure Machine Learning means business. You can deploy your model into production as a web service that can be called from any device, anywhere and that can use any data source.
• Publish, share, monetize. Share your solution with the world in the Gallery or on the Azure Marketplace.
Machine Learning
and Analytics
HDInsight
(Hadoop and
Spark)
Stream
Analytics
Data Lake
Analytics
Machine
Learning
Demo
??
Lack of Commercial
Support
Single-threaded /
Not parallelized
Complex DeploymentProcessesProduction
Limited Data Scale
inMemory
Challenges posed by open source R
Microsoft R Products
• Free and open source R distribution
• Enhanced and distributed by Microsoft
Microsoft R Open / Client
• Built in Advanced Analytics and Stand Alone Server Capability
• Leverages the Benefits of SQL 2016 Enterprise Edition
SQL Server R Services
• Microsoft R Server for Redhat Linux
• Microsoft R Server for SUSE Linux
• Microsoft R Server for Teradata DB
• Microsoft R Server for Hadoop on Redhat
Microsoft R Server
Microsoft R products
MRS extends open-source R to allow:
• Multi-threading• Matrix operations, linear algebra, and many other math operations run on all
available cores
• Parallel processing• ScaleR functions utilize all available resources, local or distributed
• On-disk data storage• RAM limitations lifted
Microsoft R Server
R Open Microsoft R Server
DeployR
ConnectR• High-speed & direct
connectors
Available for:• High-performance XDF
• SAS, SPSS, delimited & fixed format text data files
• Hadoop HDFS (text & XDF)
• Teradata Database & Aster
• EDWs and ADWs
• ODBCScaleR• Ready-to-Use high-performance
big data big analytics
• Fully-parallelized analytics
• Data prep & data distillation
• Descriptive statistics & statistical tests
• Range of predictive functions
• User tools for distributing customized R algorithms across nodes
• Wide data sets supported – thousands of variables
DistributedR• Distributed computing framework
• Delivers cross-platform portability
R+CRAN• Open source R interpreter
• R 3.1.2
• Freely-available huge range of R algorithms
• Algorithms callable by RevoR
• Embeddable in R scripts
• 100% Compatible with existing R scripts, functions and packages
RevoR• Performance enhanced R
interpreter
• Based on open source R
• Adds high-performance math library to speed up linear algebra functions
MRS Components
https://info.microsoft.com/rs/157-GQE-382/images/EN-WBNR-Slidedeck-Using-Microsoft-R-Server-for-Scalability.pdf
Platforms
Demo
Flexibility & Agility
Cost Effective
Performance & Scale
Manage and
Monitoring
Microsoft R Open
Microsoft R Server
R IDE
Data Scientist
WorkstationSQL Server 2016Script
Results
Execution
1
2
3
sqlCompute <- RxInSqlServer()
rxSetComputeContext(sqlCompute)
linModObj <- rxLinMod()
Advanced Analytics
Extensions
Model Development (R Users)
Working from R IDE on a local workstation, execute an R script that runs in-database on remote SQL
server, and get the results back.
Microsoft R Open
Microsoft R Server
Application
SQL Server 2016
2
exec sp_execute_external_script
@language = ‘R’, @script = -- R code --
Advanced Analytics
Extensions
Microsoft R Open
Mcirosoft R Server
Call System Stored Procedure1
Results: scores, plots3
The stored procedure
contains R code and
executes in-database
Model Operationalization with SQL R Services
Call a T-SQL System Stored Procedure to generate features and train (or retrain) the model
Call a T-SQL System Stored Procedure from my application and have it trigger R script execution in-
database to predict on new dataset. Results are then returned to my application (predictions, plots).
R Code->T-SQL Stored Proc
R script usage from SQL Server
Original R script:
IrisPredict <- function(data, model){library(e1071)predicted_species <- predict(model, data)return(predicted_species)
}
library(RODBC)conn <- odbcConnect("MySqlAzure", uid = myUser, pwd = myPassword);Iris_data <-sqlFetch(conn, "Iris_Data");Iris_model <-sqlQuery(conn, "select model from my_iris_model");IrisPredict (Iris_data, model);
Calling R script from SQL Server:
/* Input table schema */create table Iris_Data (name varchar(100), length int, width int);/* Model table schema */create table my_iris_model (model varbinary(max));
declare @iris_model varbinary(max) = (select model from my_iris_model);exec sp_execute_external_script@language = 'R'
, @script = 'IrisPredict <- function(data, model){library(e1071)predicted_species <- predict(model, data)return(predicted_species)
}IrisPredict(input_data_1, model);', @parallel = default, @input_data_1 = N'select * from Iris_Data', @params = N'@model varbinary(max)', @model = @iris_modelwith result sets ((name varchar(100), length int, width int, species varchar(30)));
Values highlighted in yellow are SQL queries embedded in the original R script
Values highlighted in aqua are R variables that bind to SQL variables by name
Advanced analytics
CapabilityExtensible in-database analytics, integrated with R,
exposed through T-SQL
Centralized enterprise library for analytic models
Benefits
SQL Server
Analytical engines
Integrate with R
Become fully extensible
Data management layer
Relational data
Use T-SQL interface
Stream data in-memory
Analytics library
Share and collaborate
Manage and deploy
R +
Data Scientists
Business
Analysts
Publish algorithms, interact
directly with data
Analyze through T-SQL,
tools, and vetted algorithms
DBAsManage storage and
analytics together
R integration and advanced analytics
Advanced analytics
Summary: Advanced Analytics Products
Intelligence Cognitive Services, Bot Framework. Cortana
Dashboards and Visualizations Power BI SSRS, DataZen, R R visualizations
Machine learning and Analytics Machine learning, Stream Analytics, HDInsight SSAS, SQL Server R Services Microsoft R
Big Data Store Data Lake, SQL, DW OLTP, DW, Hadoop, EDSs Hadoop, Teradata, Linux, Windows
Information Management Data Factory, Data Catalog, Event Hubs SSIS, DQS, MDS Spark SQL/ETL
Cortana Intelligence Suite Microsoft RSQL Server 2016
In Database analytics R-based analyticsCloud analytics
Microsoft Cognitive ServicesGive your apps a human side
Microsoft Cognitive ServicesGive your apps a human side
Cognitive Services API Collection
Filtering the signal from the noise
Rolls-Royce
“Our goal is not data for the sake of data, but to embrace the cloud and analytical technologies to deliver more expert insights to the right stakeholders at the right time.“
Nick Farrant
Senior Vice President
ROLLS-ROYCE
ObjectivesConnect Rolls-Royce jet
engine data to Microsoft's
intelligent cloud for insights
to improve aircraft
performance, safety and
maintenance.
TacticsUse Cortana Intelligence
to scale quickly and
efficiently, aggregate data
across customer fleets
and process data
in real time.
Results• More efficient flight and
maintenance plans
• Targeted and actionable fuel
efficiency insights
• Quickly-generated reports and
dashboards that tell compelling
stories and deliver high-quality
insights
Microsoft and Rolls-Royce collaborate to offer advanced operational intelligence to airlines
“Using our energy management
platform based on Azure, they can
cut those peak hours, avoid the
upgrade, and save a lot of money.”
- Knut Johansen, CEO
Solution
Rolls Royce uses Cortana
Intelligence to connect jet
engine data to Microsoft's
Cloud to improve aircraft
performance, safety and
maintenance
Results
• Drive 1-2% increase in fuel
efficiency, saving $Ms/year.
• Use savings from actionable
insight to offer additional
services to customers.
• Do failure prediction for next
flights and fleet monitoring
using anomaly detection.
DEMO