Question: 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

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!