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)
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 HelpStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started