
Dr. Jay Zhou has been involved in 3 head to head competitions to build the best models for clients and he won them all. His work has been used by top telecommunication companies and banks in America and Canada. His favorite tool is SQL. He is the author of the blog https://www.deep-data-mining.com, a Feedspot Top 30 Big Data Blogs Winner.
All slides used in the course are downloadable as a PDF file. The course will cover the following topics. *Why SQL for Data Science? *How to perform common tasks using SQL including: **Data Validation and Understanding **Data Cleansing and Preparation **Feature Variable Calculation. These tasks typically take 80% or more time when performing a data science project. The course will NOT cover predictive model building.
There are 2 SQL script files used for this course. Script File 1. sql_for_ds_data_prep.sql. This file should be run first. -- This script file will create 3 tables and populate them with data. -- These tables are card_txn, sales and score. -- If these tables exist, they will be dropped first. -- There are 110, 9 and 817 records in table card_txn, sales and score, respectively. Script File 2. sql_for_ds.sql. This file contains the SQL queries presented in course. We may load them into SQL Clients such as SQL Developer and run them.
Identify and clean data in a data science project by validating, understanding, preparing, and calculating feature variables before modeling with SQL in-database analysis.
Map database tables to SAS data sets, columns to variables, and records to data points, noting SAS keeps a fixed order while database tables have no order without defined criteria.
Explore persisting query results by creating and replacing tables, compare with views that preserve source code, and compute min and max transaction amounts from the card transaction table.
Use count distinct to quantify unique values, drop nonvarying columns like country, and compute unique state and city combinations with a two-step query approach.
Calculate total transaction amount by state and its percentage of the dataset, and count transactions, using with, subqueries, joins, and ratio_to_report, noting Pennsylvania around 58 percent.
Compute the correlation between transaction amount and time of day in Oracle SQL by extracting hours since midnight with trunc(date) and 24, reporting -0.09 with the R function.
Replace missing values with the state average instead of the global mean, after imputing missing state codes with the mode, and calculate the by-state average amount via views.
Convert continuous income into discrete categories using pini variables, creating low, medium, and high income bins with assigned weights to build a more flexible, robust model and final score.
Define manual boundaries for continuous variables with case when to create bins, and store the results in a replaceable view for data cleansing and preparation.
Mask the card numbers using a mapping table of old and new cards, and expose results via a view for on-the-fly queries; speed up joins with a card-number index.
Apply the lag function to compute time since last transaction for each card, partitioned by card number and ordered by transaction date, then calculate date differences.
Use lag to compute the previous transaction date in ascending order, then subtract to obtain the time lapse since the last transaction (DLF), illustrated by a 21-day example.
Compute lifetime high per card with max over a window ordered by the transaction date, and create 3-day, 7-day, and 2-hour features for fraud detection in view v_proc_06.
Discover how Oracle SQL enables data science inside the database, using views and indexes to keep data, logic, and model deployment synchronized, secure, and scalable.
All slides used in the course are in the downloadable PDF file "SQL for Data Science.pdf" below.
In this course, Dr. Jay Zhou, an industrial practitioner and and competition winner, will share his Oracle SQL skills and best practices to perform typical data science/data analytics tasks. Hopefully, after taking the course you will become a better data scientist/data analyst. In your future project, you will be more efficient, make less mistakes, manage your data and scripts better and be stress free when performing complex data work. The course will NOT cover predictive model building.