mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
updated getting started samples
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
USE [tpcx1b]
|
||||
USE [tpcxbb_1gb]
|
||||
|
||||
DROP PROC IF EXISTS generate_customer_return_clusters;
|
||||
GO
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Build a predictive model with SQL Server R Services
|
||||
# Perform customer clustering with SQL Server R Services
|
||||
|
||||
This sample provides custom reports for SQL Server R Services that can be viewed from SQL Server Management Studio. The reports can be used to view configuration information, resource usage, execution statistics, active sessions and other information about R Services.
|
||||
In this sample, we are going to get ourselves familiar with clustering.
|
||||
Clustering can be explained as organizing data into groups where members of a group are similar in some way.
|
||||
|
||||
### Contents
|
||||
|
||||
@@ -14,13 +15,12 @@ This sample provides custom reports for SQL Server R Services that can be viewed
|
||||
|
||||
## About this sample
|
||||
|
||||
Predictive modeling is a powerful way to add intelligence to your application. It enables applications to predict outcomes against new data.
|
||||
The act of incorporating predictive analytics into your applications involves two major phases:
|
||||
model training and model operationalization.
|
||||
We will be using the Kmeans algorithm to perform the clustering of customers. This can for example be used to target a specific group of customers for marketing efforts.
|
||||
Kmeans clustering is an unsupervised learning algorithm that tries to group data based on similarities. Unsupervised learning means that there is no outcome to be predicted, and the algorithm just tries to find patterns in the data.
|
||||
|
||||
In this sample, you will learn how to create a predictive model in R and operationalize it with SQL Server 2016.
|
||||
In this sample, you will learn how to perform Kmeans clustering in R and deploying the solution in SQL Server 2016.
|
||||
|
||||
Follow the step by step tutorial [here](http://aka.ms/sqldev/R) to walk through this sample.
|
||||
Follow the step by step tutorial [here](https://www.microsoft.com/en-us/sql-server/developer-get-started/rclustering) to walk through this sample.
|
||||
|
||||
<!-- Delete the ones that don't apply -->
|
||||
- **Applies to:** SQL Server 2016 (or higher)
|
||||
@@ -35,7 +35,8 @@ Follow the step by step tutorial [here](http://aka.ms/sqldev/R) to walk through
|
||||
## Before you begin
|
||||
|
||||
To run this sample, you need the following prerequisites.
|
||||
Section 1 in the [tutorial](http://aka.ms/sqldev/R) covers all prerequisites.
|
||||
Section 1 in the [tutorial](https://www.microsoft.com/en-us/sql-server/developer-get-started/rclustering) covers the prerequisites.
|
||||
After that, you can download a DB backup file and restore it using Setup.sql. [Download DB](https://deve2e.azureedge.net/sqlchoice/static/tpcxbb_1gb.bak)
|
||||
|
||||
**Software prerequisites:**
|
||||
|
||||
@@ -48,14 +49,13 @@ Section 1 in the [tutorial](http://aka.ms/sqldev/R) covers all prerequisites.
|
||||
<a name=sample-details></a>
|
||||
## Sample Details
|
||||
|
||||
### PredictiveModel.R
|
||||
### Customer Clustering.R
|
||||
|
||||
The R script that generates a predictive model and uses it to predict rental counts
|
||||
The R script that performs clustering.
|
||||
|
||||
### PredictiveModel.SQL
|
||||
|
||||
Takes the R code in PredictiveModel.R and uses it inside SQL Server. Creating stored procedures for training and prediction.
|
||||
### Customer Clustering.SQL
|
||||
|
||||
The SQL code to create stored procedure that performs clustering, and queries to verify and take further actions.
|
||||
|
||||
|
||||
<a name=related-links></a>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
-- Before we start, we need to restore the DB for this tutorial.
|
||||
-- Step1: Download the compressed backup file
|
||||
-- Save the file on a location where SQL Server can access it. For example: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\
|
||||
-- In a new query window in SSMS, execute the following restore statement, but REMEMBER TO CHANGE THE FILE PATHS
|
||||
-- to match the directories of your installation!
|
||||
USE master;
|
||||
GO
|
||||
RESTORE DATABASE Tpcx1b
|
||||
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\Tpcx1b.bak'
|
||||
WITH
|
||||
MOVE 'Tpcx1b' TO 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\Tpcx1b.mdf'
|
||||
,MOVE 'Tpcx1b_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\Tpcx1b.ldf';
|
||||
GO
|
||||
@@ -1,6 +1,6 @@
|
||||
# Build a predictive model with SQL Server R Services
|
||||
|
||||
This sample provides custom reports for SQL Server R Services that can be viewed from SQL Server Management Studio. The reports can be used to view configuration information, resource usage, execution statistics, active sessions and other information about R Services.
|
||||
This sample shows how to create a predictive model in R and operationalize it with SQL Server 2016.
|
||||
|
||||
### Contents
|
||||
|
||||
@@ -35,7 +35,8 @@ Follow the step by step tutorial [here](http://aka.ms/sqldev/R) to walk through
|
||||
## Before you begin
|
||||
|
||||
To run this sample, you need the following prerequisites.
|
||||
Section 1 in the [tutorial](http://aka.ms/sqldev/R) covers all prerequisites.
|
||||
Section 1 in the [tutorial](http://aka.ms/sqldev/R) covers the prerequisites.
|
||||
After that, you can download a DB backup file and restore it using Setup.sql. [Download DB](https://deve2e.azureedge.net/sqlchoice/static/TutorialDB.bak)
|
||||
|
||||
**Software prerequisites:**
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
-- Before we start, we need to restore the DB for this tutorial.
|
||||
-- Step1: Download the compressed backup file (https://deve2e.azureedge.net/sqlchoice/static/TutorialDB.bak)
|
||||
--Save the file on a location where SQL Server can access it. For example: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\
|
||||
-- In a new query window in SSMS, execute the following restore statement, but REMEMBER TO CHANGE THE FILE PATHS
|
||||
-- to match the directories of your installation!
|
||||
USE master;
|
||||
GO
|
||||
RESTORE DATABASE TutorialDB
|
||||
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\TutorialDB.bak'
|
||||
WITH
|
||||
MOVE 'TutorialDB' TO 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\TutorialDB.mdf'
|
||||
,MOVE 'TutorialDB_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\TutorialDB.ldf';
|
||||
GO
|
||||
Reference in New Issue
Block a user