-
Notifications
You must be signed in to change notification settings - Fork 1
/
classifiers.py
28 lines (22 loc) · 956 Bytes
/
classifiers.py
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
from sklearn.svm import SVC, LinearSVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import MinMaxScaler
classifier_dict = {
'LSVC': Pipeline([
('norm', MinMaxScaler(feature_range=(0, 1))),
('clf', LinearSVC(dual=False, tol=1e-4))]),
'LSVM': Pipeline([
('norm', MinMaxScaler(feature_range=(0, 1))),
('clf', SVC(kernel='linear', class_weight='balanced'))]),
'RSVM': Pipeline([
('norm', MinMaxScaler(feature_range=(0, 1))),
('clf', SVC(kernel='rbf', class_weight='balanced'))]),
'LSVH': Pipeline([
('norm', MinMaxScaler(feature_range=(0, 1))),
('clf', LinearSVC(loss='hinge', class_weight='balanced', tol=1e-4))]),
'PSVM': Pipeline([
('norm', MinMaxScaler(feature_range=(0, 1))),
('clf', SVC(kernel='poly', class_weight='balanced'))]),
'RF': RandomForestClassifier(),
}