Skip to Main Content
SQL Server 2017 Machine Learning Services with R
book

SQL Server 2017 Machine Learning Services with R

by Toma≈æ Ka≈°trun Kaštrun, Julie Koesmarno
February 2018
Intermediate to advanced content levelIntermediate to advanced
338 pages
7h 5m
English
Packt Publishing
Content preview from SQL Server 2017 Machine Learning Services with R

Performing predictions with R Services in the SQL Server database

Calling stored procedures is the easiest way to organize your code and start predicting right away.

Again, only a sample will be shown here of how to create a stored procedure to predict new datasets:

CREATE OR ALTER PROCEDURE [dbo].[Predicting_rentalCount] ( @model VARCHAR(30) ,@query NVARCHAR(MAX) ) AS BEGIN DECLARE @nar_model VARBINARY(MAX) = (SELECT model FROM [dbo].[Rental_data_models] WHERE model_name = @model); EXEC sp_execute_external_script @language = N'R' ,@script = N' #input from query new_data <- InputDataSet #model from query model <- unserialize(nar_model) #prediction prediction <- rxPredict(model,data = new_data, overwrite = TRUE, type="response",extraVarsToWrite ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL Server Big Data Clusters: Data Virtualization, Data Lake, and AI Platform

SQL Server Big Data Clusters: Data Virtualization, Data Lake, and AI Platform

Benjamin Weissman, Enrico van de Laar
Mastering SQL Server 2017

Mastering SQL Server 2017

Milos Radivojevic, Dejan Sarka, William Durkin, Christian Cote, Matija Lah

Publisher Resources

ISBN: 9781787283572Supplemental Content