Showing posts with label modeling scoring using SQL. Show all posts
Showing posts with label modeling scoring using SQL. Show all posts

Monday, August 27, 2012

Predictive model scoring in Oracle


As described in an earlier post, "Build Predictive Models Using PL/SQL", we can build models within Oracle using function 
DBMS_DATA_MINING.CREATE_MODEL. The models are called mining objects.

The ultimate purpose of building a predictive mode is to apply it to new data. This can be done using SQL function prediction_probability(). 
We call this function in our SQL scripts. It will return the probability of being fraud, delinquency, clicking an online ads, or whatever the model is predicting.

select ACCOUNT_NUM, Transaction_ID, prediction_probability(fraud_model,  1 using *) score from tbl_transaction_data;

This is probably the most efficient way to deploy a model into production. (Model deployment is traditionally a major headache.) Again, data never leave the database and no standalone analytics server is needed.