MS SQL SERVER: Time series algorithm


Published on

MS SQL SERVER: Time series algorithm

Published in: Technology, Economy & Finance
  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

MS SQL SERVER: Time series algorithm

  1. 1. Microsoft Time Series Algorithm<br />
  2. 2. overview<br />Understanding Microsoft Time Series algorithm<br />Time Series Scenarios<br />DMX<br />Creating the Query<br />Altering the Query <br />Executing the Query<br />
  3. 3. Microsoft Time Series algorithm<br />The Microsoft Time Series algorithm provides regression algorithms that are optimized for the forecasting of continuous values, such as product sales, over time.<br />A time series consists of a series of data collected over successive increments of time or other sequence indicator.  <br />A time series model can predict trends based only on the original dataset that is used to create the model.<br />
  4. 4. Microsoft Time Series algorithm<br />shows a typical model for forecasting sales of a product in four different sales regions over time.<br />Historical information appears to the left of the vertical line and represents the data that the algorithm uses to create the model.<br />Predicted information appears to the right of the vertical line and represents the forecast that the model makes<br />
  5. 5. Time Series Scenarios<br /><ul><li>Performing a Simple Forecast</li></ul>This step involvescreating a model, showing it some data, and asking it for predictions of future values.<br /><ul><li>Predicting Interdependent Series</li></ul>The Microsoft implementation finds relationships where they exist between series and will use these relationships in forecasting.<br />Marking a series as INPUT indicates that it cannot be forecasted and will be considered only as to its impact on other series. <br />Marking a series as PREDICT_ONLY, on the other hand, indicates that the series can be forecasted, but will not be considered by other series.<br />
  6. 6. Time Series Scenarios<br /><ul><li>Understanding Your Time Series</li></ul>You can explore the individual patterns that are being used for prediction and see if the previous sales have a larger impact on future behavior.<br />you can get more descriptive rules about your data, because the Time Series algorithm is based on the decision tree implementation used in the Microsoft Decision Trees algorithm.<br />
  7. 7. DMX<br />The main element that differentiates a mining structure used for time series from other structures is the inclusion of a KEY TIME column. <br />The KEY TIME content type indicates that a column is a KEY as well as the time slice representing the row.<br />
  8. 8. DMX<br />CREATE MINING MODEL statement:<br />CREATE MINING MODEL [<Mining Structure Name>]<br /> ( <key columns>, <br /> <predictable attribute columns> <br /> ) <br />USING <algorithm name>([parameter list]) <br />WITH DRILLTHROUGH<br />The code defines the key column for the mining model, which in the case of a time series model uniquely identifies a time step in the source data. <br />The time step is identified with the KEY TIME keywords after the column name and data types. <br /> You can have multiple predictable attributes in a single mining model. When there are multiple predictable attributes, the Microsoft Time Series algorithm generates a separate analysis for each series:<br />
  9. 9. DMX(Creating the Query )<br />To create a new DMX query in SQL Server Management Studio<br />Open SQL Server Management Studio.<br />In the Connect to Server dialog box, for Server type, select Analysis Services.<br /> In Server name, type LocalHost, or the name of the instance of Analysis Services that you want to connect to for this lesson. Click Connect.<br />In Object Explorer, right-click the instance of Analysis Services, point to New Query, and then click DMX.<br />Query Editor opens and contains a new, blank query.<br />
  10. 10. DMX(Altering the Query )<br />In Query Editor, copy the generic example of the CREATE MINING MODEL statement into the blank query.<br />Replace the following: <br />1. [mining model name] with [Forecasting_MIXED] <br />2. <key columns> <br /> with<br /> [Reporting Date] DATE KEY TIME,<br /> [Model Region] TEXT KEY <br />The TIME KEY keyword indicates that the ReportingDate column contains the time step values used to order the values. <br />The TEXT and KEY keywords indicate that the ModelRegion column contains an additional series key.<br />
  11. 11. DMX(Altering the Query )<br /> Replace the following:<br />3. < predictable attribute columns> )<br /> with:<br /> [Quantity] LONG CONTINUOUS PREDICT, <br /> [Amount] DOUBLE CONTINUOUS PREDICT<br /> )<br />4. USING <algorithm name>([parameter list])<br /> WITH DRILLTHROUGH<br /> with:<br />USING Microsoft_Time_Series(AUTO_DETECT_PERIODICITY = 0.8, FORECAST_METHOD = 'MIXED') WITH DRILLTHROUGH<br />
  12. 12. DMX(Altering the Query )<br />The complete statement should now be as follows:<br />CREATE MINING MODEL [Forecasting_MIXED]<br /> ( [Reporting Date] DATE KEY TIME,<br /> [Model Region] TEXT KEY, <br /> [Quantity] LONG CONTINUOUS PREDICT,<br /> [Amount] DOUBLE CONTINUOUS PREDICT ) <br /> USING Microsoft_Time_Series (AUTO_DETECT_PERIODICITY = 0.8, FORECAST_METHOD = 'MIXED') <br /> WITH DRILLTHROUGH <br />On the File menu, click Save DMXQuery1.dmx As.<br />In the Save As dialog box, browse to the appropriate folder, and name the file Forecasting_MIXED.dmx.<br />
  13. 13. After a query is created and saved, it needs to be executed to create the mining model and its mining structure on the server. <br />In Query Editor, on the toolbar, click Execute<br />A new structure named  <br /> Forecasting_MIXED_Structure now exists on the server, together with the related mining model <br /> Forecasting_MIXED.<br />DMX(Executing the Query )<br />
  14. 14. Visit more self help tutorials<br />Pick a tutorial of your choice and browse through it at your own pace.<br />The tutorials section is free, self-guiding and will not involve any additional support.<br />Visit us at<br />