SVR Modeling on Salary

Import salary dataset

dataset=read.csv('Position_Salaries.csv')
dataset=dataset[2:3]

Fitting SVR to the dataset

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.4.2
library(e1071)
## Warning: package 'e1071' was built under R version 3.4.2
regressor=svm(formula= Salary ~. , data=dataset, type="eps-regression")

Predict the salary with SVR prediction

y_svr_pred=predict(regressor, data.frame(Level=6.5))
y_svr_pred
##        1 
## 177861.1

Visualizing the SVR Regression

g2=ggplot()+
  geom_point(aes(x=dataset$Level , y=dataset$Salary), 
             colour="purple")+
  geom_line(aes(x=dataset$Level, y=predict(regressor, newdata= dataset)),
            colour="black")+
  ggtitle("Truth or Bluff(SVR)")+
  xlab('Level')+
  ylab("Salary")
g2

Conclusion

We can see the prediction is very good, except for the CEO level salary, we can consider him as an outlier. Our the potential employee is very honest.