Salary Prediction on Years of Experience — Beginner’s Machine Learning Problem
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 -
- Linear Regression
- 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.
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…