Machine Learning Algorithms Linear vs non Linear



I am new to machine learning. I am wondering how to get to know what Algo will be best for modelling the data. If the data has non-linear relationship ( either in parameters(coeff) or the Variable(x)), which algorithm will suit to model such relationship.

  1. Can Random Forest be used to model non linear relationship?
  2. Can Simple Regression will be suited to model non linear relationship (only in variable(x)/predictor like y=b0+b1X+b2X^2)?


Hi @seema123,


  1. Yes
  2. No

To answer in brief;

When your data has a non-linear relationship between dependent and independent variables, tree based models (like random forest) would outperform linear models (like linear regression)

Lets take an example of linear and non-linear data

  1. Linear data

Here, you can draw a line to differentiate between the data classes. So it can be solved easily by a lineaar classifier

  1. Non Linear data

Here, you cannot raw a line to separate the classes, so a linear classifier wont work. But you can draw a square which can be a good classifier. Now this square can be represented by a tree based algorithm easily, so it would perform better


Thanks for the reply.

  1. Yes
  2. No

I didn’t get it?? what does TLDR


Its a shortform for “if you don’t have much time to read the paragraph, here’s a summary” :slight_smile: