Question: Can you please advise how i can implement this sql query:

```
select * from products where (category, category2, category3) in (2, 138, 136, 125)

```

Error:

```
#1241 - Operand should contain 3 column(s)

```

Answer: 
1) input variable : continuous / output variable : categorical  

C4.5 algorithm solve this situation.
[C4.5](https://en.wikipedia.org/wiki/C4.5_algorithm)

In order to handle continuous attributes, C4.5 creates a threshold and then splits the list into those whose attribute value is above the threshold and those that are less than or equal to it.

2) input variable : continuous / output variable : continuous  

CART(classification and regression trees) algorithm solves this situation. [CART](https://en.wikipedia.org/wiki/Decision_tree_learning) 

Case 2 is the regression problem. You should enumerate the attribute `j`, and enumerate the values `s` in that attribute, and then splits the list into those whose attribute value is above the threshold and those that are less than or equal to it. Then you get two areas
[![enter image description here](https://i.stack.imgur.com/oecME.png)](https://i.stack.imgur.com/oecME.png)

Find the best attribute `j` and the best split value `s`, which 

[![enter image description here](https://i.stack.imgur.com/PIAH0.png)](https://i.stack.imgur.com/PIAH0.png)

`c_1` and `c_2` and be solved as follows: 

[![enter image description here](https://i.stack.imgur.com/CBCGj.png)](https://i.stack.imgur.com/CBCGj.png)

Then when do regression,  

[![enter image description here](https://i.stack.imgur.com/y19cp.png)](https://i.stack.imgur.com/y19cp.png)

where

[![enter image description here](https://i.stack.imgur.com/sga1c.png)](https://i.stack.imgur.com/sga1c.png)
I can explain the concept at a very high level.

The main goal of the algorithm is to find an attribute that we will use for the first split. We can use various impurity metrics to evaluate the most significant attribute. Those impurity metrics can be Information Gain, Entropy, Gain Ratio, etc. But, if the decision variable is a continuous type variable, then we usually use another impurity metric 'standard deviation reduction'. But, whatever metric you use, depending on your algorithm (i.e. ID3, C4.5, etc) you actually find an attribute that will be used for splitting. 

When you have a continuous type attribute, then things get a little tricky. You need to find a threshold value for an attribute that will give you the highest impurity (Entropy, Gain Ratio, Information Gain ... whatever). Then, you find which attribute's threshold value gives that highest impurity, and then chose an attribute accordingly, right?

Now, if the attribute is a continuous type and decision variable is also continuous type, then you can simply combine the above two concepts and generate the Regression Tree.

That means, as the decision variable is continuous type, you will use the metric (like Variance reduction) and chose the attribute which will give you the highest value of the chosen metric (i.e. variance reduction) for the threshold value of all attributes.

You can visualize such a regression tree using a Decision Tree Machine Learning software like [SpiceLogic Decision Tree Software](https://www.spicelogic.com/Products/decision-tree-software-27) 
Say, you have a data table like this:

[![enter image description here](https://i.stack.imgur.com/jMpds.png)](https://i.stack.imgur.com/jMpds.png)

The software will generate the Regression tree like this:

[![enter image description here](https://i.stack.imgur.com/tusIs.png)](https://i.stack.imgur.com/tusIs.png)