Skip to content

Commit 45e85ee

Browse files
updated getting started samples
1 parent 2cb6de8 commit 45e85ee

File tree

6 files changed

+145
-5
lines changed

6 files changed

+145
-5
lines changed

samples/features/r-services/gettingstarted/customerclustering/CustomerClustering.R renamed to samples/features/r-services/Getting-Started/Customer-Clustering/Customer Clustering.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
3+
4+
# Define the connection string
5+
connStr <- paste("Driver=SQL Server;Server=", "MyServer", ";Database=", "tpcx1b", ";Trusted_Connection=true;", sep = "");
6+
27
# Input Query
38
input_query <- "
49
SELECT
@@ -35,10 +40,6 @@ FROM
3540
GROUP BY sr_customer_sk
3641
) returned ON ss_customer_sk=sr_customer_sk
3742
"
38-
39-
# Define the connection string
40-
connStr <- paste("Driver=SQL Server;Server=", "NELLIELAPTOP", ";Database=", "tpcx1b", ";Trusted_Connection=true;", sep = "");
41-
4243
# Input customer data that needs to be classified
4344
customer_returns <- RxSqlServerData(sqlQuery = input_query,
4445
colClasses = c(customer = "numeric", orderRatio = "numeric", itemsRatio = "numeric", monetaryRatio = "numeric", frequency = "numeric"),
@@ -56,7 +57,6 @@ head(customer_data, n = 5);
5657
wss <- (nrow(customer_data) - 1) * sum(apply(customer_data, 2, var))
5758
for (i in 2:20) {
5859
xt = kmeans(customer_data, centers = i)
59-
print(xt$ifault)
6060
wss[i] <- sum(kms = kmeans(customer_data, centers = i)$withinss)
6161
}
6262
plot(1:20, wss, type = "b", xlab = "Number of Clusters", ylab = "Within groups sum of squares")
File renamed without changes.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Build a predictive model with SQL Server R Services
2+
3+
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.
4+
5+
### Contents
6+
7+
[About this sample](#about-this-sample)<br/>
8+
[Before you begin](#before-you-begin)<br/>
9+
[Sample details](#sample-details)<br/>
10+
[Related links](#related-links)<br/>
11+
12+
13+
<a name=about-this-sample></a>
14+
15+
## About this sample
16+
17+
Predictive modeling is a powerful way to add intelligence to your application. It enables applications to predict outcomes against new data.
18+
The act of incorporating predictive analytics into your applications involves two major phases:
19+
model training and model operationalization.
20+
21+
In this sample, you will learn how to create a predictive model in R and operationalize it with SQL Server 2016.
22+
23+
Follow the step by step tutorial [here](http://aka.ms/sqldev/R) to walk through this sample.
24+
25+
<!-- Delete the ones that don't apply -->
26+
- **Applies to:** SQL Server 2016 (or higher)
27+
- **Key features:**
28+
- **Workload:** SQL Server R Services
29+
- **Programming Language:** T-SQL, R
30+
- **Authors:** Nellie Gustafsson
31+
- **Update history:** Getting started tutorial for R Services
32+
33+
<a name=before-you-begin></a>
34+
35+
## Before you begin
36+
37+
To run this sample, you need the following prerequisites.
38+
Section 1 in the [tutorial](http://aka.ms/sqldev/R) covers all prerequisites.
39+
40+
**Software prerequisites:**
41+
42+
<!-- Examples -->
43+
1. SQL Server 2016 (or higher) with R Services installed
44+
2. SQL Server Management Studio
45+
3. R IDE Tool like Visual Studio
46+
47+
48+
<a name=sample-details></a>
49+
## Sample Details
50+
51+
### PredictiveModel.R
52+
53+
The R script that generates a predictive model and uses it to predict rental counts
54+
55+
### PredictiveModel.SQL
56+
57+
Takes the R code in PredictiveModel.R and uses it inside SQL Server. Creating stored procedures for training and prediction.
58+
59+
60+
61+
<a name=related-links></a>
62+
63+
## Related Links
64+
<!-- Links to more articles. Remember to delete "en-us" from the link path. -->
65+
66+
For additional content, see these articles:
67+
68+
[SQL Server R Services - Upgrade and Installation FAQ](https://msdn.microsoft.com/en-us/library/mt653951.aspx)
69+
70+
[Other SQL Server R Services Tutorials](https://msdn.microsoft.com/en-us/library/mt591993.aspx)
File renamed without changes.
File renamed without changes.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Build a predictive model with SQL Server R Services
2+
3+
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.
4+
5+
### Contents
6+
7+
[About this sample](#about-this-sample)<br/>
8+
[Before you begin](#before-you-begin)<br/>
9+
[Sample details](#sample-details)<br/>
10+
[Related links](#related-links)<br/>
11+
12+
13+
<a name=about-this-sample></a>
14+
15+
## About this sample
16+
17+
Predictive modeling is a powerful way to add intelligence to your application. It enables applications to predict outcomes against new data.
18+
The act of incorporating predictive analytics into your applications involves two major phases:
19+
model training and model operationalization.
20+
21+
In this sample, you will learn how to create a predictive model in R and operationalize it with SQL Server 2016.
22+
23+
Follow the step by step tutorial [here](http://aka.ms/sqldev/R) to walk through this sample.
24+
25+
<!-- Delete the ones that don't apply -->
26+
- **Applies to:** SQL Server 2016 (or higher)
27+
- **Key features:**
28+
- **Workload:** SQL Server R Services
29+
- **Programming Language:** T-SQL, R
30+
- **Authors:** Nellie Gustafsson
31+
- **Update history:** Getting started tutorial for R Services
32+
33+
<a name=before-you-begin></a>
34+
35+
## Before you begin
36+
37+
To run this sample, you need the following prerequisites.
38+
Section 1 in the [tutorial](http://aka.ms/sqldev/R) covers all prerequisites.
39+
40+
**Software prerequisites:**
41+
42+
<!-- Examples -->
43+
1. SQL Server 2016 (or higher) with R Services installed
44+
2. SQL Server Management Studio
45+
3. R IDE Tool like Visual Studio
46+
47+
48+
<a name=sample-details></a>
49+
## Sample Details
50+
51+
### PredictiveModel.R
52+
53+
The R script that generates a predictive model and uses it to predict rental counts
54+
55+
### PredictiveModel.SQL
56+
57+
Takes the R code in PredictiveModel.R and uses it inside SQL Server. Creating stored procedures for training and prediction.
58+
59+
60+
61+
<a name=related-links></a>
62+
63+
## Related Links
64+
<!-- Links to more articles. Remember to delete "en-us" from the link path. -->
65+
66+
For additional content, see these articles:
67+
68+
[SQL Server R Services - Upgrade and Installation FAQ](https://msdn.microsoft.com/en-us/library/mt653951.aspx)
69+
70+
[Other SQL Server R Services Tutorials](https://msdn.microsoft.com/en-us/library/mt591993.aspx)

0 commit comments

Comments
 (0)