Predictive Maintenance Template with SQL Server R Services

By for March 18, 2016

Report Abuse
In this tutorial, we demonstrate how to develop and deploy end-to-end Predictive Maintenance solutions with SQL Server 2016 R Services
#Predictive Maintenance Template with SQL Server 2016 R Services In this template, we demonstrate how to develop and deploy end-to-end Predictive Maintenance solutions with [SQL Server 2016 R Services](https://msdn.microsoft.com/en-us/library/mt674876.aspx), which utilizes the combined power of SQL Server and Microsoft R Server. We demonstrate how to solve the following three problems here: - **Predict the Remaining Useful Life (RUL) of an asset**, or Time to Failure (TTF). This is formulated as a **regression** problem. - **Predict if an asset will fail within certain time frame** (e.g. days). This is formulated as a **binary classification** problem. - **Predict if an asset will fail in different time windows**. This is formulated as a **Multi-class classification** problem. The solutions are demonstrated using an aircraft engine data. For a full description of the template, please refer to the [template](https://gallery.cortanaanalytics.com/Collection/Predictive-Maintenance-Template-3) in the gallery. We show two version of implementation with SQL Server R Services: - **Model Development with Microsoft R Server in R IDE**. Run the code in R IDE (e.g., RStudio, R Tools for Visual Studio) with data in SQL Server, and execute the computation in SQL Server. - **Model Operationalization In SQL**. Deploy the modeling steps to SQL Stored Procedures, which can be run within SQL environment (such as SQL Server Management Studio) or called by applications to make predictions. A Windows PowerShell script is provided to invoke the SQL Stored procedures and run the steps end-to-end. The code and documentation can be found from the github [here][1]. The following is the directory structure for this template, please read the Readme file under each folder for detailed instructions. * **[Data][2]** This contains the provided sample data. * **[R][3]** This contains the R development code (Microsoft R Server). It runs in R IDE, with computation being done in-database (by setting compute context to SQL Server). * **[SQLR][4]** This contains the Stored SQL procedures from data processing to model deployment. It runs in SQL environment. A Powershell script is provided to invoke the modeling steps end-to-end. See Readme files in each directory for detailed instructions. [1]: https://github.com/Microsoft/SQL-Server-R-Services-Samples/tree/master/PredictiveMaintenance/ [2]: https://github.com/Microsoft/SQL-Server-R-Services-Samples/tree/master/PredictiveMaintenance/Data [3]: https://github.com/Microsoft/SQL-Server-R-Services-Samples/tree/master/PredictiveMaintenance/R [4]: https://github.com/Microsoft/SQL-Server-R-Services-Samples/tree/master/PredictiveMaintenance/SQLR