dataset=read.csv('Position_Salaries.csv')
dataset=dataset[2:3]
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")
y_svr_pred=predict(regressor, data.frame(Level=6.5))
y_svr_pred
## 1
## 177861.1
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
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.