You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced-analytics/r/installing-ml-components-without-internet-access.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Installing machine learning components without internet access | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "10/31/2017"
4
+
ms.date: "11/30/2017"
5
5
ms.prod:
6
6
- "sql-server-2016"
7
7
- "sql-server-2017"
@@ -30,7 +30,7 @@ Typically, setup of the machine components used in SQL Server 2016 and SQL Serve
30
30
31
31
+**If the computer has an internet connection**
32
32
33
-
SQL Server locates and download the components for you, then installs them during setup. You must accept the license terms separately for each open source component (R or Python) that you install.
33
+
SQL Server locates and downloads the components for you, and then installs them during setup. Accept the license terms separately for each open source component (R or Python) that you install.
34
34
35
35
+**If the computer does not have internet access**
36
36
@@ -126,6 +126,11 @@ Microsoft R Open |use previous|
126
126
Microsoft R Server |[SRS_9.2.0.100_1033.cab](https://go.microsoft.com/fwlink/?LinkId=851501)|
127
127
Microsoft Python Open |use previous |
128
128
Microsoft Python Server |[SPS_9.2.0.100_1033.cab](https://go.microsoft.com/fwlink/?LinkId=851500) |
129
+
**SQL Server 2017 CU2** |
130
+
Microsoft R Open |use previous|
131
+
Microsoft R Server |use previous|
132
+
Microsoft Python Open |use previous |
133
+
Microsoft Python Server |use previous|
129
134
130
135
### <aname="bkmk_2016Installers"></a>Downloads for SQL Server 2016
- The SELECT statement gets the serialized model from the database, and stores the model in the R variable `mod` for further processing using R.
64
+
+ The SELECT statement gets the serialized model from the database, and stores the model in the R variable `mod` for further processing using R.
67
65
68
-
- The new cases for scoring are obtained from the [!INCLUDE[tsql](../../includes/tsql-md.md)] query specified in `@inquery`, the first parameter to the stored procedure. As the query data is read, the rows are saved in the default data frame, `InputDataSet`. This data frame is passed to the `rxPredict` function in R, which generates the scores.
66
+
+ The new cases for scoring are obtained from the [!INCLUDE[tsql](../../includes/tsql-md.md)] query specified in `@inquery`, the first parameter to the stored procedure. As the query data is read, the rows are saved in the default data frame, `InputDataSet`. This data frame is passed to the `rxPredict` function in R, which generates the scores.
Because a data.frame can contain a single row, you can use the same code for batch or single scoring.
73
71
74
-
- The value returned by the `rxPredict` function is a **float** that represents the probability that the driver gets a tip of any amount.
72
+
+ The value returned by the `rxPredict` function is a **float** that represents the probability that the driver gets a tip of any amount.
75
73
76
74
## Batch scoring
77
75
@@ -80,23 +78,16 @@ Now let's see how batch scoring works.
80
78
1. Let's start by getting a smaller set of input data to work with. This query creates a "top 10" list of trips with passenger count and other features needed to make a prediction.
81
79
82
80
```SQL
83
-
SELECT TOP 10a.passenger_countAS passenger_count,
84
-
a.trip_time_in_secsAS trip_time_in_secs,
85
-
a.trip_distanceAS trip_distance,
86
-
a.dropoff_datetimeAS dropoff_datetime,
87
-
dbo.fnCalculateDistance(pickup_latitude, pickup_longitude, dropoff_latitude,dropoff_longitude) AS direct_distance
ON a.medallion=b.medallion AND a.hack_license=b.hack_license AND a.pickup_datetime=b.pickup_datetime
161
-
WHERE b.medallion is null'
134
+
SET @query_string='SELECT TOP 10 a.passenger_count as passenger_count, a.trip_time_in_secs AS trip_time_in_secs, a.trip_distance AS trip_distance, a.dropoff_datetime AS dropoff_datetime, dbo.fnCalculateDistance(pickup_latitude, pickup_longitude, dropoff_latitude,dropoff_longitude) AS direct_distance FROM (SELECT medallion, hack_license, pickup_datetime, passenger_count,trip_time_in_secs,trip_distance, dropoff_datetime, pickup_latitude, pickup_longitude, dropoff_latitude, dropoff_longitude FROM nyctaxi_sample )a LEFT OUTER JOIN (SELECT medallion, hack_license, pickup_datetime FROM nyctaxi_sample TABLESAMPLE (70 percent) REPEATABLE (98052))b ON a.medallion=b.medallion AND a.hack_license=b.hack_license AND a.pickup_datetime=b.pickup_datetime WHERE b.medallion is null'
162
135
163
136
-- Call the stored procedure for scoring and pass the input data
164
137
EXEC [dbo].[PredictTip] @inquery = @query_string;
165
138
```
166
139
167
-
4. The stored procedure returns a series of values representing the prediction for each of the top ten trips. However, the top trips are also single-passenger trips with a relatively short trip distance, for which the driver is unlikely to get a tip.
140
+
4. The stored procedure returns a series of values representing the prediction for each of the top 10 trips. However, the top trips are also single-passenger trips with a relatively short trip distance, for which the driver is unlikely to get a tip.
168
141
169
142
170
143
> [!TIP]
171
144
>
172
-
> Rather than returning just the yes-tip/no-tip results, you could also return the probability score for the prediction, and then apply a WHERE clause to the _Score_ column values to categorize the score as"likely to tip"or"unlikely to tip", using a threshold value such as0.5or0.7. This step is not included in the stored procedure but it would be easy to implement.
145
+
> Rather than returning just the "yes-tip"and"no-tip" results, you could also return the probability score for the prediction, and then apply a WHERE clause to the _Score_ column values to categorize the score as"likely to tip"or"unlikely to tip", using a threshold value such as0.5or0.7. This step is not included in the stored procedure but it would be easy to implement.
173
146
174
147
## Single-row scoring
175
148
176
149
Sometimes you want to pass in individual valuesfrom an application and get a single result based on those values. For example, you could set up an Excel worksheet, web application, or Reporting Services report to call the stored procedure and provide inputs typed or selected by users.
177
150
178
-
In this section, you'll learn how to create single predictions using a stored procedure.
151
+
In this section, you learn how to create single predictions using a stored procedure.
179
152
180
153
1. Take a minute to review the code of the stored procedure _PredictTipSingleMode_, which was included as part of the download.
181
154
182
155
```SQL
183
-
CREATE PROCEDURE [dbo].[PredictTipSingleMode] @passenger_count int = 0,
- This stored procedure takes multiple single valuesas input, such as passenger count, trip distance, and so forth.
228
177
229
-
If you call the stored procedure from an external application, make sure that the data matches the requirements of the R model. This might include ensuring that the input data can be cast or converted to an R data type, or validating data type and data length. For more information, see [Working with R Data Types](https://msdn.microsoft.com/library/mt590948.aspx).
178
+
If you call the stored procedure from an external application, make sure that the data matches the requirements of the R model. This might include ensuring that the input data can be cast or converted to an R data type, or validating data type and data length.
230
179
231
180
- The stored procedure creates a score based on the stored R model.
232
181
@@ -236,12 +185,12 @@ In this section, you'll learn how to create single predictions using a stored pr
Or, use this shorter form supported for [parameters to a stored procedure](https://docs.microsoft.com/sql/relational-databases/stored-procedures/specify-parameters):
@@ -250,7 +199,7 @@ In this section, you'll learn how to create single predictions using a stored pr
3. The results indicate that the probability of getting a tip is very low on these top 10 trips, since all are single-passenger trips over a relatively short distance.
202
+
3. The results indicate that the probability of getting a tip is low on these top 10 trips, since all are single-passenger trips over a relatively short distance.
# Create graphs and plots using SQL and R (walkthrough)
25
23
26
-
In this part of the walkthrough, you'll learn techniques for generating plots and maps using R with SQL Server data. You'll create a simple histogram, to get some practice, and then develop a more complex map plot.
24
+
In this part of the walkthrough, you learn techniques for generating plots and maps using R with SQL Server data. You create a simple histogram, to get some practice, and then develop a more complex map plot.
27
25
28
26
### Create a histogram
29
27
@@ -51,8 +49,6 @@ In this part of the walkthrough, you'll learn techniques for generating plots an
0 commit comments