Machine Learning in SQL Server

T-SQL Tuesday Logo

By Riley Major, 2018-03-13

These days, most business logic is still built by subject matter experts. Humans explore their habits and instincts and try to come up with a process which business analysts turn into an algorithm which developers turn into code. That’s expensive, time consuming, and is all based on the presumption that computers need to be told what to do.

Instead, machines can be told what winning looks like and what the valid moves are. Then through trial and error– lots of trail and error– a program arises from the mathematical ether that accomplishes a goal. For a contrived problem space like a game (e.g. tic tac toe), once you input the rules, you can throw CPU cycles– or humans— at the system until it starts winning. But for real world problems, you need data.

Data is a collection of game results– paths selected, buttons clicked, products chosen, parts failed, minerals found, energy spent, crops yielded, babies born. Use it to train a model and predictions can be made without any understanding of the underlying mechanisms. Life itself is the result of the game of survival played generation after generation, genomes drifting from selective pressure toward the best solution for a particular environment.

While it might seem scary not to understand how a program is able to arrive at correct results, should it matter if it routinely works? We still don’t know how Tylenol works, but that doesn’t stop us from taking 149.3 kilotons of the stuff per year.

In the past 8 years we’ve seen the introduction of R and Python in SQL Server and Azure Machine Learning in the cloud. Machine Learning and Artificial Intelligence are hot topics right now and in the next 8 years I predict we’ll see Microsoft build those capabilities into the SQL engine itself. Currently, Azure Models can be operationalized by calling out to a web service. Within 8 years, I predict you will be able to consume them from a SELECT statement.

There’s a good chance I’m wrong about that. Not about the dominance of programs and logic which are effectively written by other programs. That’s inevitable. But rather about it being built into the SQL Server engine. These days, with “serverless” computing, capabilities are spreading out rather than consolidating, and they’re all being tied together via web interaction. So perhaps Azure’s web-consumable models are the end game. But I think there’s power in being able to merge data and analysis on the fly without the overhead of stitching together HTTP calls. We’ll just have to see if there’s enough value to make it happen.

Leave a Reply

Your email address will not be published.