Book Image

SQL Server 2017 Machine Learning Services with R

By : Julie Koesmarno, Tomaž Kaštrun
Book Image

SQL Server 2017 Machine Learning Services with R

By: Julie Koesmarno, Tomaž Kaštrun

Overview of this book

R Services was one of the most anticipated features in SQL Server 2016, improved significantly and rebranded as SQL Server 2017 Machine Learning Services. Prior to SQL Server 2016, many developers and data scientists were already using R to connect to SQL Server in siloed environments that left a lot to be desired, in order to do additional data analysis, superseding SSAS Data Mining or additional CLR programming functions. With R integrated within SQL Server 2017, these developers and data scientists can now benefit from its integrated, effective, efficient, and more streamlined analytics environment. This book gives you foundational knowledge and insights to help you understand SQL Server 2017 Machine Learning Services with R. First and foremost, the book provides practical examples on how to implement, use, and understand SQL Server and R integration in corporate environments, and also provides explanations and underlying motivations. It covers installing Machine Learning Services;maintaining, deploying, and managing code;and monitoring your services. Delving more deeply into predictive modeling and the RevoScaleR package, this book also provides insights into operationalizing code and exploring and visualizing data. To complete the journey, this book covers the new features in SQL Server 2017 and how they are compatible with R, amplifying their combined power.
Table of Contents (12 chapters)

To get the most out of this book

In order to work with SQL Server Machine Learning Services, and to run the code examples found in this book, the following software will be required:

  • SQL Server 2016 and/or SQL Server 2017 Developer or Enterprise Edition
  • SQL Server Management Studio (SSMS)
  • R IDE such as R Studio or Visual Studio 2017 with RTVS extension
  • Visual Studio 2017 Community edition with the following extensions installed:
    • R Tools for Visual Studio (RTVS)
    • SQL Server Data Tools (SSDT)
  • VisualStudio.com online account

The chapters in this book go through the installation and configuration steps as the software is introduced.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/SQL-Server-2017-Machine-Learning-Services-with-R. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "To calculate crosstabulations – the relationship between two (or more) variables – we will use two functions: rxCrossTabs and rxMargins."

A block of code is set as follows:

> df <- data.frame(unlist(var_info)) 
> df 

Any command-line input or output is written as follows:

EXECsp_execute_external_script
          @language = N'R'
          ,@script = N'
                      library(RevoScaleR)
                      df_sql <- InputDataSet        
                      var_info <- rxGetInfo(df_sql)
                      OutputDataSet <- data.frame(unlist(var_info))'
                      ,@input_data_1 = N'
                      SELECT 
                       BusinessEntityID
                      ,[Name]
                      ,SalesPersonID
                      FROM [Sales].[Store]'

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "You can always check the run_value of external scripts enabled if it is set to 1."

Warnings or important notes appear like this.
Tips and tricks appear like this.