Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions