-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
30 lines (23 loc) · 752 Bytes
/
test.py
File metadata and controls
30 lines (23 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 15:02:20 2020
@author: Harini
"""
import numpy as np
from sklearn.preprocessing import StandardScaler
from twinsvm import twinsvmclassifier
params1 = {'Epsilon1': 0.1, 'Epsilon2': 0.1, 'C1': 1, 'C2': 1,'kernel_type':0,'kernel_param': 1}
params2 = {'Epsilon1': 0.1, 'Epsilon2': 0.1, 'C1': 1, 'C2': 1,'kernel_type':2,'kernel_param': 2}
names = ["Twin SVM","Twin SVM with RBF Kernel"]
classifiers = [
twinsvmclassifier(**params1),
twinsvmclassifier(**params2)]
X = [[1,2],[4,2]]
X = np.asarray(X)
y = [0,1]
y = np.asarray(y)
for name, clf in zip(names, classifiers):
print(name)
clf.fit(X,y)
ypred = clf.predict(X)
print("ypred:"+str(ypred))