Question: Why am i getting this error? (i'm using python in spyder) The code: import numpy as np import matplotlib.pyplot as plt import pandas as pd

Why am i getting this error?

(i'm using python in spyder)

Why am i getting this error? (i'm using python in spyder) The

The code:

import numpy as np import matplotlib.pyplot as plt import pandas as pd

mydataset = pd.read_csv("Position_Salaries.csv") x= mydataset.iloc[:, 1:2].values y= mydataset.iloc[:, 2].values

from sklearn.preprocessing import StandardScaler sc_x = StandardScaler() sc_y = StandardScaler() x = sc_x.fit_transform(x) y = np.ravel(sc_y.fit_transform(y.reshape(-1, 1)))

from sklearn.svm import SVR regressor = SVR(kernel = 'rbf') regressor.fit(x, y)

y_pred = sc_y.inverse_transform(regressor.predict(sc_x.transform([[5.5]])))

plt.scatter(x, y, color='red') plt.plot(x, regressor.predict(x), color='blue') plt.title('Truth or Bluff (SVR)') plt.xlabel('Position level') plt.ylabel('Salary') plt.show()

pyder (Python 3.9) Edit Search Source Run Debug Consoles Projects Tools View Help

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!