Question

Jollyer on Tue, 31 Jan 2017 00:41:02


I have a problem with the Microsoft tutorial at https://www.microsoft.com/en-us/sql-server/developer-get-started/r

The tutorial is about creating a predictive model in SQL Server R Services (it's about predicting rental counts). In the very last line, the sample code for using the model looks like this:

EXEC dbo.predict_rentals @model = 'rxDTree', @q ='SELECT CONVERT(INT, 3) AS Month,

CONVERT(INT, 24) AS Day, CONVERT(INT, 4) AS WeekDay, CONVERT(INT, 1) AS Snow,

CONVERT(INT, 1) AS Holiday';

Below that, the expected result shows as RentalCount_Predicted = 332.571428571429

I was able to reproduce this result. However, I always get this result, no matter what values I choose for WeekDay, Snow, or Holiday. For example, I get the same result when using the following:

EXEC dbo.predict_rentals @model = 'rxDTree', @q ='SELECT CONVERT(INT, 3) AS Month,

  CONVERT(INT, 24) AS Day, CONVERT(INT, 4) AS WeekDay, CONVERT(INT, 0) AS Snow,

  CONVERT(INT, 0) AS Holiday';

This can't be right because WeekDay, Snow, and Holiday are vital determining factors for predicting the rental count.

What am I doing wrong?


Sponsored