SQL Server Machine Learning Services

THIS TOPIC APPLIES TO: yesSQL Server (Windows only)noAzure SQL DatabasenoAzure SQL Data WarehousenoParallel Data Warehouse

SQL Server 2017 Machine Learning Services (previously SQL Server 2016 R Services) provides a platform for developing and deploying intelligent applications that uncover new insights. Because machine learning is integrated with SQL Server, you can keep analytics close to the data and eliminate the costs and security risks associated with data movement.

  • In SQL Server 2016, you can easily develop and deploy solutions based on the popular R language for data science.

    Features include the Microsoft R libraries, that provide new scalability and performance for your R solutions, and state-of-the-art algorithms in MicrosoftML.

  • In SQL Server 2017, you can use both R and Python to develop and operationalize data science solutions.

    The revoscalepy library for Python provides remote compute contexts and scalability comparable to those in RevoScaleR.

SQL Server supports improved performance, security, and manageability for machine learning workloads through a comprehensive set of tools and technologies. You can deploy R or Python solutions using convenient, familiar SQL methodology and tools. Just use Transact-SQL to call the R or Python runtimes from your production applications, to build models or retrieve visuals. If you have already trained a model, you can generate predictions from it using only T-SQL, through native scoring.

Machine learning in SQL Server 2017

  • Install Machine Learning Services (In-Database) during SQL Server setup to enable secure execution of R or Python scripts on the SQL Server computer.

    When you select this feature, extensions are installed in the database engine to support execution of code written in R or Python. A new service is created, the SQL Server Trusted Launchpad, to manage communications between the external runtimes and the SQL Server instance.

  • Install Microsoft Machine Learning Server (Standalone) on a separate computer if you don't need to use SQL Server as the compute context. Machine Learning Server includes the same machine learning components, plus the ability to execute scalable, distributed machine learning jobs as a web service.

  • Install Microsoft R Client on remote computers to develop solutions that can be deployed to SQL Server, or to Machine Learning Server on Windows, Linux, or Hadoop.

Machine learning in SQL Server 2016

  • Install R Services (In-Database) during setup of SQL Server 2016 to enable secure execution of R scripts on the SQL Server computer.

    When you select this feature, you get the ability to run R script using the SQL Server as the compute context, or to run R script in a stored procedure.

  • Install Microsoft R Server (Standalone) from SQL Server 2016 setup, to install the R components on a separate computer that you can use for developing or deploying R solutions.

How to get started

SQL Server setup provides two options:

  • Install the in-database analytics feature that is integrated with SQL Server, or
  • Install the standalone version of Machine Learning Server (or Microsoft R Server) that supports at-scale machine learning without an instance of SQL Server.

If you need to run your R code in SQL Server, either by using stored procedures or by using the SQL Server instance as the compute context, you must install R Services (In-Database) as described in the setup guide. This option provides maximum data security and integration with SQL Server tools.

Microsoft Machine Learning Server (Standalone) is a separate option designed for using the Microsoft R and related Python libraries on a Windows computer that is not running SQL Server. This option requires an Enterprise Edition license for SQL Server.

We recommend that you install Machine Learning Server (Standalone) on a laptop or other remote computer used for development, and use that computer to create and test machine learning solutions that can easily be deployed to an instance of SQL Server that is running Machine Learning Services (In-Database) or another supported compute context.

You can also use the mrsdeploy package that is installed with Machine Learning Server to publish and distribute R and Python jobs as a web service.

Additional resources