Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
update notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
suriyan committed Aug 7, 2020
1 parent f81d3ff commit d8470d1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 145 deletions.
46 changes: 15 additions & 31 deletions pydomains/models/malware_pred_2017_lstm_rf_svc.ipynb
Expand Up @@ -807,8 +807,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.ensemble import RandomForestClassifier\n",
"\n",
Expand All @@ -820,19 +822,6 @@
"rf_model.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/malware_cat_2017_rf.pickle', 'rb') as file:\n",
" rf_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 33,
Expand Down Expand Up @@ -899,8 +888,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"from sklearn import svm\n",
"\n",
Expand All @@ -909,19 +900,6 @@
"svc_model.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/malware_cat_2017_svm.pickle', 'rb') as file:\n",
" svc_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 26,
Expand Down Expand Up @@ -1092,23 +1070,29 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.save('./models/malware_cat_lstm_2017.h5')"
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"words_df = pd.DataFrame(words_list, columns=['vocab'])\n",
"words_df.to_csv('./models/malware_cat_vocab_2017.csv', index=False, encoding='utf-8')"
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
Expand Down
46 changes: 15 additions & 31 deletions pydomains/models/phish_pred_2016_lstm_rf_svc.ipynb
Expand Up @@ -1062,8 +1062,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.ensemble import RandomForestClassifier\n",
"\n",
Expand All @@ -1075,19 +1077,6 @@
"rf_model.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/phish_cat_2016_rf.pickle', 'rb') as file:\n",
" rf_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 16,
Expand Down Expand Up @@ -1171,8 +1160,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"from sklearn import svm\n",
"\n",
Expand All @@ -1181,19 +1172,6 @@
"svc_model.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/phish_cat_2016_svm.pickle', 'rb') as file:\n",
" svc_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 21,
Expand Down Expand Up @@ -1371,23 +1349,29 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.save('./models/phish_cat_lstm_2016.h5')"
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"words_df = pd.DataFrame(words_list, columns=['vocab'])\n",
"words_df.to_csv('./models/phish_cat_vocab_2016.csv', index=False, encoding='utf-8')"
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
Expand Down
42 changes: 12 additions & 30 deletions pydomains/models/phish_pred_2017_lstm_rf_svc.ipynb
Expand Up @@ -1061,8 +1061,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.ensemble import RandomForestClassifier\n",
"\n",
Expand All @@ -1074,19 +1076,6 @@
"rf_model.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/phish_cat_2017_rf.pickle', 'rb') as file:\n",
" rf_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 15,
Expand Down Expand Up @@ -1170,8 +1159,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"from sklearn import svm\n",
"\n",
Expand All @@ -1180,19 +1171,6 @@
"svc_model.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/phish_cat_2017_svm.pickle', 'rb') as file:\n",
" svc_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 19,
Expand Down Expand Up @@ -1370,15 +1348,19 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.save('./models/phish_cat_lstm_2017.h5')"
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"words_df = pd.DataFrame(words_list, columns=['vocab'])\n",
"words_df.to_csv('./models/phish_cat_vocab_2017.csv', index=False, encoding='utf-8')"
Expand Down
62 changes: 9 additions & 53 deletions pydomains/models/toulouse_pred_2017_rf_svc.ipynb
Expand Up @@ -1002,8 +1002,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"from sklearn.ensemble import RandomForestClassifier\n",
Expand All @@ -1016,19 +1018,6 @@
"rf_model.fit(X_train, y_train_lab)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/toulouse_cat_2017_rf.pickle', 'rb') as file:\n",
" rf_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 15,
Expand Down Expand Up @@ -1251,32 +1240,10 @@
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"%%time\n",
"from sklearn import svm\n",
"\n",
"#svc_model = svm.SVC(probability=True, random_state=21, max_iter=-1, tol=0.001,verbose=True)\n",
"svc_model = svm.SVC(probability=True, random_state=21, max_iter=10, tol=0.01, verbose=True)\n",
"# Fit on training data\n",
"svc_model.fit(X_train, y_train_lab)"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"%%time\n",
"#svc_model = svm.SVC(probability=True, random_state=21, max_iter=-1, tol=0.001,verbose=True)\n",
"svc_model = svm.SVC(probability=True, random_state=21, max_iter=100, tol=0.01, verbose=True)\n",
"# Fit on training data\n",
"svc_model.fit(X_train, y_train_lab)"
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"#svc_model = svm.SVC(probability=True, random_state=21, max_iter=-1, tol=0.001,verbose=True)\n",
Expand All @@ -1285,19 +1252,6 @@
"svc_model.fit(X_train, y_train_lab)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
"# Load from file\n",
"with open('models/toulouse_cat_2017_svm.pickle', 'rb') as file:\n",
" svc_model = pickle.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 21,
Expand Down Expand Up @@ -1439,8 +1393,10 @@
]
},
{
"cell_type": "raw",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pickle\n",
"\n",
Expand Down

0 comments on commit d8470d1

Please sign in to comment.