Third method: Support vector regressor svr is quite the same with svm(support vector machine) it uses the same principles as the SVM for classification, with only a few minor differences and the only different is that it suits better for regression purpose input : training d
(x_train: list, x_test: list, train_user: list)
| 60 | |
| 61 | |
| 62 | def support_vector_regressor(x_train: list, x_test: list, train_user: list) -> float: |
| 63 | """ |
| 64 | Third method: Support vector regressor |
| 65 | svr is quite the same with svm(support vector machine) |
| 66 | it uses the same principles as the SVM for classification, |
| 67 | with only a few minor differences and the only different is that |
| 68 | it suits better for regression purpose |
| 69 | input : training data (date, total_user, total_event) in list of float |
| 70 | where x = list of set (date and total event) |
| 71 | output : list of total user prediction in float |
| 72 | >>> support_vector_regressor([[5,2],[1,5],[6,2]], [[3,2]], [2,1,4]) |
| 73 | 1.634932078116079 |
| 74 | """ |
| 75 | regressor = SVR(kernel="rbf", C=1, gamma=0.1, epsilon=0.1) |
| 76 | regressor.fit(x_train, train_user) |
| 77 | y_pred = regressor.predict(x_test) |
| 78 | return float(y_pred[0]) |
| 79 | |
| 80 | |
| 81 | def interquartile_range_checker(train_user: list) -> float: |