Get negative predicted value in Support Vector Regresion (SVR)

I am doing Covid-19 cases prediction using SVR, and getting negative values, while there should be no number of Covid-9 cases negative. Feature input that I was used is mobility factor (where have negative data) and daily cases of Covid-19. Kernel that I used is RBF kernel. Can anyone explain why I am getting negative values? are the independent variable (mobility) that I used influence that?
Category: Data Science

Which performs better in time series forecasting, LSTM or SVR?

I have run LSTM and SVR models on various datasets having sample values in the range of 1-4000 and the MAPE obtained in SVR was consistently lesser than that obtained through LSTM. I was told the reverse is true (that LSTM should perform better) but haven't found much information on this online. I would appreciate any feedback about this and any links to articles or papers (so far, I found grossly varied opinions).
Category: Data Science

Functional form for machine learning models

I am new to the field of machine learning and I have a question. Is there a way to print the function of any machine learning model, just like Y=mX + C (equation for straight line). For eg. support vector machine regression. I have done SVR for a dataset. I saved the model in the form of a pickle. Is there a way I can print the function that will be used to do further predictions. I would like to …
Category: Data Science

Scalling and unscalling of data for SVR prediction

I'm trying to use SVR to predict a certain feature. I create the model with the following code: from sklearn.svm import SVR from sklearn.preprocessing import StandardScaler X = data # this is the outcome variable y = data.iloc[:, 10].values sc_X = StandardScaler() sc_y = StandardScaler() X2 = sc_X.fit_transform(X) y = sc_y.fit_transform(y.reshape(-1, 1)) # my_custom_kernel looks at certain columns of X2 / scaled data my_regressor = SVR(kernel=my_custom_kernel) my_regressor = regressor.fit(X2, y) After creating the model, I want to test it to …
Category: Data Science

Why do I get an ValueError for an SVR model with RFE, but only when using pipeline?

I am running five different regression models to find the best predicting model for one variable. I am using a Leave-One-Out approach and using RFE to find the best predicting features. Four of the five models are running fine, but I am running into issues with the SVR. This is my code below: from numpy import absolute, mean, std import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from sklearn.model_selection import cross_val_score, LeaveOneOut from sklearn.metrics import r2_score, …
Category: Data Science

compare SVR with medium regression

We usually compare Supporting vector regression (SVR): $$\mathcal{L} = C\sum\limits_{n=1}^{N}\Big(|y_i - g(x_i)| - \epsilon\Big)^+ + \dfrac{1}{2}||w||^2.$$ and ridge regression (RR): $$\mathcal{L} = \sum\limits_{n=1}^{N}\Big(y_i - g(x_i)\Big)^2 + \dfrac{1}{2}||w||^2.$$ Here the fitting line is: $$g(x_i) = wx_i + b.$$ Since they both have $L_2$ Regularization and both can apply the Kernel trick. But I am very surprised that I cannot find any reference about SVR and medium regression with $L_2$ Regularization: $$\mathcal{L} = C\sum\limits_{n=1}^{N}\Big(|y_i - g(x_i)|\Big) + \dfrac{1}{2}||w||^2.$$ which is just the …
Topic: svr regression
Category: Data Science

Trouble performing feature selection using boruta and support vector regression

I was trying to select the most important features of a data set using Boruta in python. I have split the data into training and test set. Then I used SVM regressor to fit the data. Then I used Boruta to measure feature importance.The code is as follows: from sklearn.svm import SVR svclassifier = SVR(kernel='rbf',C=1e4, gamma=0.1) svm_model= svclassifier.fit(x_train, y_train) from boruta import BorutaPy feat_selector = BorutaPy(svclassifier, n_estimators='auto', verbose=2, random_state=1) feat_selector.fit(x_train, y_train) feat_selector.support_ feat_selector.ranking_ X_filtered = feat_selector.transform(x_train) But I get this …
Category: Data Science

SVR - RMSE is much worse after normalizing the data

I'm building a model using a custom kernel SVR that looks into a few of my dataframe's features and checks the proximity/distance between each pair of datapoints. The features are weigthed and the weights were calculated using cross validation. Initially my dataframe was not normalized, and the model's results were not very good (RMSE higher than 25% of the target range). Because I had read that SVR is sensible to scale, I decided to try to normalize the data, which …
Category: Data Science

NotFittedError says this StandardScaler instance is not fitted yet while using inverse_transform()

I have a dataset and i have used Support Vector Regression.So i needed to use StandardScaler module from sklearn.preprocessing fro Feature Scaling. After training my model when i came to predict it was giving a prediction which was Feature scaled.That's why i used inverse_transformfrom StandardScaler() and getting a error saying NotFittedError: This StandardScaler instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator. I have tried several solutions but it's getting the same error. What can …
Category: Data Science

SVR is giving same prediction for all features

I'm creating a basic application to predict the 'Closing' value of a stock for day n+1, given features of stock n using Python and Scikit-learn A sample row in my dataframe looks like this (2000 rows) Open Close High Low Volume 0 537.40 537.10 541.55 530.47 52877.98 Similar to this video, where he uses 'Dates' and 'Open Price'. In this example, Dates are the features and Open price is the target. Now in my example, I don't have a 'Dates' …
Category: Data Science

Combine AdaBoost and Support Vector Regression?

I have read several papers about using SVM instead of decision tree in AdaBoost, but I haven't seen any papers about using support vector regression (SVR) in AdaBoost. However, if using support vector regression in AdaBoost, I have to weaken SVR. So how do I weaken SVR when combining it with AdaBoost?
Topic: svr boosting svm
Category: Data Science

Understanding Support Verctor Regression (SVR)

This question also asked on another StackExchange with Bounty. Question here. I'm working with SVR, and using this resource. Erverything is super clear, with epsilon intensive loss function (from figure). Prediction comes with tube, to cover most training sample, and generalize bounds, using support vectors. Then we have this explanation. This can be described by introducing (non-negative) slack variables , to measure the deviation of training samples outside -insensitive zone. I understand this error, outside tube, but don't know, how …
Topic: svr svm python
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.