Salary Prediction on Years of Experience — Beginner’s Machine Learning Problem

Akshit Madan
Nov 19, 2020

In this notebook, we will train a model by providing years of experience as independent data and salary as dependent data. We will solve the problem by two ways -

  1. Linear Regression
  2. Decision Tree Regression

Prerequisites — Basic Understanding of Linear Regression and Decision Tree.

Linear Regression — LinearRegression fits a linear model with coefficients w = (w1, …, wp) to minimize the residual sum of squares between the observed targets in the dataset, and the targets predicted by the linear approximation.

Refer to the below code for building your model — To keep it simple and beginner friendly, the no. of independent variables are kept one.

Dataset Link — https://drive.google.com/file/d/1d0SUu9mwfQm0Co1DVx4r0tDqM7BBt_i2/view?usp=sharing

Decision Tree Regression — Decision tree builds regression or classification models in the form of a tree structure. It breaks down a dataset into smaller and smaller subsets while at the same time an associated decision tree is incrementally developed. The final result is a tree with decision nodes and leaf nodes.

I hope the code helped you know more about solving basic ML problems.

Thanks for reading…

--

--

Akshit Madan

Founder @Resumepal | Software Engineer | AI & LLMs | Flutter