SVR

Skeleton Code:



#Download Total.csv from FYP drive for verification.
import pandas as pd
import numpy as np

from sklearn import metrics

#loading the dataset
dataset = pd.read_csv('Total.csv')

S = dataset.iloc[:,0:7].values
t = dataset.iloc[:,7:8].values

#feature scaling
#feature scaling
from sklearn.preprocessing import StandardScaler
sc_S = StandardScaler()
sc_t = StandardScaler()
S2 = sc_S.fit_transform(S)
t2 = sc_t.fit_transform(t)

#fitting the SVR to the dataset
from sklearn.svm import SVR
regressor = SVR(kernel = 'rbf')
regressor.fit(S2, t2)
pred_t = regressor.predict(S2)
t_pred =sc_t.inverse_transform(pred_t)

errs = metrics.mean_absolute_error(t, t_pred)
print(errs)



result for 7 features:

  • bpmax:

('Mean Absolute Error:', 17.920415662979593)

('Mean Squared Error:', 574.55000643544315)

('Root Mean Squared Error:', 23.969772765619684)

Variance score: 0.39


bpmin:

  • ('Mean Absolute Error:', 4.1293880055297576)
  • ('Mean Squared Error:', 101.27077558626165)
  • ('Root Mean Squared Error:', 10.063338192978593)
  • Variance score: 0.86


average:

('Mean Absolute Error:', 11.02)


('Root Mean Squared Error:', 17.01

Variance score: 0.625

results for 3 features:

  • bpmax:
  • ('Mean Absolute Error:', 19.836865103969824)
  • ('Mean Squared Error:', 667.70987599952321)
  • ('Root Mean Squared Error:', 25.840082739796387)
  • Variance score: 0.29


bpmin:

  • ('Mean Absolute Error:', 14.884539824328918)
  • ('Mean Squared Error:', 937.56161531935163)
  • ('Root Mean Squared Error:', 30.619627942209743)
  • Variance score: -0.27

avg:

('Mean Absolute Error:', 17.35)

('Root Mean Squared Error:', 28.225)

Variance score: 0.01