From the course: MySQL for Advanced Analytics: Tips, Tricks, & Techniques

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Binning data

Binning data - MySQL Tutorial

From the course: MySQL for Advanced Analytics: Tips, Tricks, & Techniques

Start my 1-month free trial

Binning data

- [Instructor] Binning is a technique used to convert continuous variables into categorical variables. Categorical variables have only a fixed set of values, unlike continuous variables. This technique is used in machine learning when some algorithms work well only with categorical variables, not continuous variables. In our example, we have already created two columns called age range and salary range. We can convert the age and salary columns, which are continuous values, into fixed bins. Age can be converted into bins of 10, say 10 to 20, 20 to 30, et cetera. We will convert salary into three bins, less than 50,000, between 50,000 and 100,000 and greater than 100,000. Let us review this SQL statement we're gonna run, and for that we are gonna open the script Binning_data. We start off in this script by setting the safe updates to zero. Let us review the update SQL now. First, we find the age bin using the floor method and then multiplying it by 10 to find the starting range value…

Contents