# -*- coding: utf-8 -*-
"""
Created on Mon Jan 28 14:32:55 2019

@author: Vivek
"""
# Importing libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

# Importing dataset
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
Y = dataset.iloc[:, 2:].values

# Feature Scaling
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
sc_Y = StandardScaler()
X = sc_X.fit_transform(X)
Y = sc_Y.fit_transform(Y)

# Fitting SVR to the dataset
from sklearn.svm import SVR
regressor = SVR()
regressor.fit(X, Y)

#Predicting a new result
Y_pred = sc_Y.inverse_transform(regressor.predict(sc_X.transform(np.array([[6.5]]))))

# Visualising the SVR
plt.scatter(X, Y, color = 'red')
plt.plot(X, regressor.predict(X), color = 'blue')
plt.xlabel('Position Level of an Employee')
plt.ylabel('Salary')
plt.title('Truth or Bluff (SVR)')
plt.show()
3ed842fec49b4451b61c206514fb2179901a6f43
<mask token>

<mask token>
regressor.fit(X, Y)
<mask token>
plt.scatter(X, Y, color='red')
plt.plot(X, regressor.predict(X), color='blue')
plt.xlabel('Position Level of an Employee')
plt.ylabel('Salary')
plt.title('Truth or Bluff (SVR)')
plt.show()

<mask token>
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
Y = dataset.iloc[:, 2:].values
<mask token>
sc_X = StandardScaler()
sc_Y = StandardScaler()
X = sc_X.fit_transform(X)
Y = sc_Y.fit_transform(Y)
<mask token>
regressor = SVR()
regressor.fit(X, Y)
Y_pred = sc_Y.inverse_transform(regressor.predict(sc_X.transform(np.array([
    [6.5]]))))
plt.scatter(X, Y, color='red')
plt.plot(X, regressor.predict(X), color='blue')
plt.xlabel('Position Level of an Employee')
plt.ylabel('Salary')
plt.title('Truth or Bluff (SVR)')
plt.show()

<mask token>
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
Y = dataset.iloc[:, 2:].values
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
sc_Y = StandardScaler()
X = sc_X.fit_transform(X)
Y = sc_Y.fit_transform(Y)
from sklearn.svm import SVR
regressor = SVR()
regressor.fit(X, Y)
Y_pred = sc_Y.inverse_transform(regressor.predict(sc_X.transform(np.array([
    [6.5]]))))
plt.scatter(X, Y, color='red')
plt.plot(X, regressor.predict(X), color='blue')
plt.xlabel('Position Level of an Employee')
plt.ylabel('Salary')
plt.title('Truth or Bluff (SVR)')
plt.show()

# -*- coding: utf-8 -*-
"""
Created on Mon Jan 28 14:32:55 2019

@author: Vivek
"""
# Importing libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

# Importing dataset
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
Y = dataset.iloc[:, 2:].values

# Feature Scaling
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
sc_Y = StandardScaler()
X = sc_X.fit_transform(X)
Y = sc_Y.fit_transform(Y)

# Fitting SVR to the dataset
from sklearn.svm import SVR
regressor = SVR()
regressor.fit(X, Y)

#Predicting a new result
Y_pred = sc_Y.inverse_transform(regressor.predict(sc_X.transform(np.array([[6.5]]))))

# Visualising the SVR
plt.scatter(X, Y, color = 'red')
plt.plot(X, regressor.predict(X), color = 'blue')
plt.xlabel('Position Level of an Employee')
plt.ylabel('Salary')
plt.title('Truth or Bluff (SVR)')
plt.show()