Video and more...
This commit is contained in:
parent
14e6bcce9a
commit
99ed3d4427
@ -20,7 +20,7 @@ from sklearn.ensemble import ExtraTreesClassifier
|
|||||||
from sklearn.feature_selection import SelectFromModel
|
from sklearn.feature_selection import SelectFromModel
|
||||||
|
|
||||||
print("Loading dataset in memory [ ... ]")
|
print("Loading dataset in memory [ ... ]")
|
||||||
files = pd.read_csv('dataset_clean.txt',delimiter=',', low_memory=False)
|
files = pd.read_csv('dataset/dataset_clean.txt',delimiter=',', low_memory=False)
|
||||||
print("Loading dataset in memory [ DONE ]")
|
print("Loading dataset in memory [ DONE ]")
|
||||||
|
|
||||||
print("Dataset basic infos:")
|
print("Dataset basic infos:")
|
||||||
|
|||||||
@ -20,7 +20,7 @@ from sklearn.ensemble import ExtraTreesClassifier
|
|||||||
from sklearn.feature_selection import SelectFromModel
|
from sklearn.feature_selection import SelectFromModel
|
||||||
|
|
||||||
print("Loading dataset in memory [ ... ]")
|
print("Loading dataset in memory [ ... ]")
|
||||||
files = pd.read_csv('dataset_clean.txt',delimiter=',', low_memory=False)
|
files = pd.read_csv('dataset/dataset_clean.txt',delimiter=',', low_memory=False)
|
||||||
print("Loading dataset in memory [ DONE ]")
|
print("Loading dataset in memory [ DONE ]")
|
||||||
|
|
||||||
# =-=-=-=-=-=-=-= Data Prepare Work =-=-=-=-=-=-=
|
# =-=-=-=-=-=-=-= Data Prepare Work =-=-=-=-=-=-=
|
||||||
|
|||||||
@ -121,18 +121,18 @@ def predict_one_line(model,line):
|
|||||||
# - At the end, print the prediction accuracy result
|
# - At the end, print the prediction accuracy result
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
#nb_malware_to_test = 50
|
nb_malware_to_test = 50
|
||||||
nb_malware_to_test = 34199
|
#nb_malware_to_test = 34199
|
||||||
good_ans = 0
|
good_ans = 0
|
||||||
for i in range(34179,nb_malware_to_test):
|
#for i in range(34179,nb_malware_to_test):
|
||||||
#for i in range(nb_malware_to_test):
|
for i in range(nb_malware_to_test):
|
||||||
print(" =-=-=-= Prediction {} out of {} ({}%) [ ERT ~ {} min ] =-=-=-=".format(i, nb_malware_to_test, round((i/nb_malware_to_test)*100,1), round(((nb_malware_to_test-i)*1.2)/60,1)))
|
print(" =-=-=-= Prediction {} out of {} ({}%) [ ERT ~ {} min ] =-=-=-=".format(i, nb_malware_to_test, round((i/nb_malware_to_test)*100,1), round(((nb_malware_to_test-i)*1.2)/60,1)))
|
||||||
features = file_to_test.values[i,]
|
features = file_to_test.values[i,]
|
||||||
features_list = features.tolist()
|
features_list = features.tolist()
|
||||||
features_array = [features_list]
|
features_array = [features_list]
|
||||||
features = np.array(features_array)
|
features = np.array(features_array)
|
||||||
res.append(predict_one_line(saved_model, features))
|
res.append(predict_one_line(saved_model, features))
|
||||||
if res[i-34179] == file_to_test.values[i,][54]:
|
if res[i] == file_to_test.values[i,][54]:
|
||||||
good_ans +=1
|
good_ans +=1
|
||||||
print(features)
|
print(features)
|
||||||
print(res)
|
print(res)
|
||||||
|
|||||||
@ -199,8 +199,8 @@ def predict_from_features(features, model):
|
|||||||
X_unknown = features_numpy
|
X_unknown = features_numpy
|
||||||
X_unknown_columns = selected_features
|
X_unknown_columns = selected_features
|
||||||
X_unknown = pd.DataFrame(X_unknown, columns=X_unknown_columns)
|
X_unknown = pd.DataFrame(X_unknown, columns=X_unknown_columns)
|
||||||
#ans = model.predict(X_unknown)
|
ans = model.predict(X_unknown)
|
||||||
ans = model.predict([features])
|
#ans = model.predict([features])
|
||||||
return ans[0]
|
return ans[0]
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
BIN
tenamortech_malware_scanner_website_ihm.mp4
Normal file
BIN
tenamortech_malware_scanner_website_ihm.mp4
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user