Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use the interior point method for solving SVR instead of python package: sklearn.svm.SVR dont use cvxpy # imports import numpy as np import matplotlib.pyplot as

use the interior point method for solving SVR instead of python package: sklearn.svm.SVR

dont use cvxpy

# imports import numpy as np import matplotlib.pyplot as plt # np.random.seed(0) noise = np.random.rand(100, 1) x = np.random.rand(100, 1) y = 3 * x + 15 + noise # y=ax+b Target function a=3, b=15 # plot plt.scatter(x,y,s=10) plt.xlabel('x') plt.ylabel('y') plt.show() from sklearn import svm # SVR linearModel=svm.SVR(C=1, kernel='linear') # linearModel.fit(x, y) # predicted=linearModel.predict(x) from sklearn import metrics print('R2 score: ', linearModel.score(x, y)) mse = metrics.mean_squared_error(y, predicted) print('MSE score: ', mse) # plot plt.scatter(x, y, s=10, label='True') plt.scatter(x, predicted, color="r",s=10, label='Predicted') plt.xlabel('x') plt.ylabel('y') plt.legend() plt.show()

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 Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions