forked from divy9881/Malware_Classifier_For_PE_Files
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_CLI.py
More file actions
112 lines (79 loc) · 2.79 KB
/
01_CLI.py
File metadata and controls
112 lines (79 loc) · 2.79 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import operator
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import StandardScaler
import time
from Accuracy import Accuracy
from getXY import getXY, getXY_single
import sys
from sklearn.model_selection import train_test_split
from pprint import pprint as pp
X, y = getXY(sys.argv[1])
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)
from Models.Logistic import Load
# start_time = time.time()
modelLR = Load()
# print("Time Taken to Train: {}".format(time.time() - start_time))
y_pred = modelLR.predict(X_test)
acc,con=Accuracy(y_test, y_pred)
print('Logistic Reg Accuracy: {}'.format(acc))
pp(con)
print()
### ---------------- Random Forest ---------------------- ###
from Models.RandomForest import Load as RLoad
# start_time = time.time()
modelRF = RLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))
y_pred = modelRF.predict(X_test)
acc,con = Accuracy(y_test, y_pred)
print('Random Forest Accuracy: {}'.format(acc))
pp(con)
print()
### ------------------------ SVM --------------------------- ###
from Models.SVM import Load as SVMLoad
# start_time = time.time()
modelSVM = SVMLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))
y_pred = modelSVM.predict(X_test)
acc,con=Accuracy(y_test, y_pred)
print('SVM with rbf Accuracy: {}'.format(acc))
print(con)
print()
### ---------------------- AdaBoost ------------------------- ###
from Models.AdaBoost import Load as AdaLoad
# start_time = time.time()
modelAda = AdaLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))
y_pred = modelAda.predict(X_test)
acc,con=Accuracy(y_test, y_pred)
print('AdaBoost Accuracy: {}'.format(acc))
print(con)
print()
### --------------------- Gradient Boosting ---------------- ###
from Models.GradientBoosting import Load as GBLoad
# start_time = time.time()
modelGB = GBLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))
y_pred = modelGB.predict(X_test)
acc,con=Accuracy(y_test, y_pred)
print('Gradient Boosting Accuracy: {}'.format(acc))
print(con)
### -------------------- XGBoost --------------------------- ###
from Models.XGBoost import Load as XGBLoad
# start_time = time.time()
modelXGB = XGBLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))
y_pred = modelXGB.predict(X_test)
acc,con=Accuracy(y_test, y_pred)
print('XGBoost Accuracy: {}'.format(acc))
print(con)
### --------------------- Decision Tree ------------------------ ###
from Models.DecisionTree import Load as DTLoad
# start_time = time.time()
modelDT = DTLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))
y_pred = modelDT.predict(X_test)
acc,con=Accuracy(y_test, y_pred)
print('Decision Tree Accuracy: {}'.format(acc))
print(con)