forked from divya711yadhav/PhisingwebsitesDetection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rf_model.py
35 lines (24 loc) · 827 Bytes
/
rf_model.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
29
30
31
32
33
34
35
import pickle
import numpy,sklearn,pandas
"""# save the model to disk
filename = 'finalized_model.sav'
pickle.dump(clf, open(filename, 'wb'))
"""
def predictor(splitted_data):
print("/n script rf_model")
# load the model from disk
filename = 'finalized_model.sav'
loaded_model = pickle.load(open(filename, 'rb'))
print("model loaded")
print(splitted_data.shape)
print(list(splitted_data))
x = splitted_data.columns[3:9]
preds = loaded_model.predict(splitted_data[x])
print("prediction complete")
print(preds)
if preds == 0:
str1 = "Spoofed webpage: Yes"
else: str1 = "Spoofed webpage: NO"
score = loaded_model.predict_proba(splitted_data[x])
str2 = "Confidence score: "+ str(score[0][1])
return str1,str2