Machine learning using the PREDICT T-SQL command
Once you have created a model (also called a "trained model"), you can save it in a binary format for "scoring" the results of a prediction. Both R and Python have methods to store the trained models as binary outputs. It's common to store these models in the database itself, which then allows you to process requests from clients in a T-SQL statement and return the results as a dataset. This process requires the runtime (R or Python) to process the request.
As an example, if you were to create the k-means clustering solution around the customer returns mentioned earlier, you could save that model as a binary object, perhaps even from another server that holds the customer data. You could then deploy that model to a server located at each store and run it using the PREDICT
statement to alert the salespeople to the behavior that might lead to a return, thereby preventing customer dissatisfaction.
Functions...