From the course: Develop ML Models with Python and T-SQL

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Demo: Using the model for linear regression predictions

Demo: Using the model for linear regression predictions

From the course: Develop ML Models with Python and T-SQL

Demo: Using the model for linear regression predictions

- [Instructor] The next example will utilize the model that's already stored in the database. As we see here, demo 1B utilizes the pyodbc, pandas and pickle modules. We're going to be connecting to the database using pyodbc, and as we had done in the previous example, we had also specified our server name as well as our database name. In addition, after we establish the connection, we're going to create a cursor object and then we're going to utilize that to select from the models. You'll notice that I stipulated select top one model from the models table. And the reason for that is if we're maintaining version history and we're updating that table with various models over time, we want to select the best that's available. And so we're selecting the top model that has the name of LR model, and this is because we're sorting it by created date descending. We check to see that that row exists, and once it's retrieved, we then utilize the pickle module to be able to load that byte data…

Contents