-
Notifications
You must be signed in to change notification settings - Fork 0
/
runOctaveSet
executable file
·66 lines (52 loc) · 2.65 KB
/
runOctaveSet
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
#!/usr/local/bin/octave -q
args = argv();
BASE_PATH = strcat(pwd,"/data/",args{1});
goodFileName = 'goodList.siteWords'
badFileName = 'badList.siteWords'
pathRawSiteData = strcat(BASE_PATH,'/rawSiteData/');
good_file = strcat(BASE_PATH,'/rawSiteData/',goodFileName);
bad_file = strcat(BASE_PATH,'/rawSiteData/',badFileName);
featuresFile = strcat(BASE_PATH,'/features/dictionary_features_file.binsev');
classFile = strcat(BASE_PATH,'/features/dictionary_classes_file.binsev');
dictionaryWordsFile = strcat(BASE_PATH,'/urlTerms/dictionary_words_file.binsev');
dictionaryPairsFile = strcat(BASE_PATH,'/urlTerms/dictionary_pairs_file.binsev');
urlsFile = strcat(BASE_PATH,'/urlTerms/urls_file.binsev');
modelFile = strcat(BASE_PATH, "/svmModel/model.binsev");
predFile = strcat(BASE_PATH,'/svmModel/pred.binsev');
predNewFile = strcat(BASE_PATH,'/svmModel/predNew.binsev');
accuracyFile = strcat(BASE_PATH,'/svmModel/accuracy.binsev');
pFile = strcat(BASE_PATH,'/svmModel/p.binsev');
pNewFile = strcat(BASE_PATH,'/svmModel/pNew.binsev');
search_string_out_file = strcat(BASE_PATH, "/searchTerms/newSearchStrings.txt");
eval_output_file = strcat(BASE_PATH, "/fitness/evalout.txt");
[class, dictionary_words, dictionary_pairs, features, urls] = extraction(good_file,bad_file);
[model, pred, accuracy, p] = trainSVM(class, features,'-s 0 -t 3');
pos_word = genSearchStrings(model, dictionary_words, dictionary_pairs);
tic
fileID2 = fopen(search_string_out_file,'w');
fprintf(fileID2,'%s',char(pos_word));
fclose(fileID2);
toc
fprintf('Newly Search String Paramenters Written to:\n %s\n',char(search_string_out_file));
fprintf('=============== Optimal Search String Parameter Data Written =============\n\n\n');
tic
fprintf('\n\nSaving Dictionary Files: \n')
save("-mat7-binary", classFile, "class")
fprintf('\n Successful Save to dictionary_classes_file.binsev');
save("-mat7-binary", dictionaryWordsFile, "dictionary_words")
fprintf('\n Successful Save to dictionary_words_file.binsev');
save("-mat7-binary", dictionaryPairsFile, "dictionary_pairs")
fprintf('\n Successful Save to dictionary_pairs_file.binsev');
save("-mat7-binary", featuresFile, "features")
fprintf('\n Successful Save to dictionary_features_file.binsev');
save("-mat7-binary", urlsFile, "urls")
fprintf('\n Successful Save to urls_file.binsev');
save("-mat7-binary", modelFile, "model")
fprintf('\n Successful Save to model.binsev');
save("-mat7-binary", predFile, "pred")
fprintf('\n Successful Save to pred.binsev');
save("-mat7-binary", accuracyFile, "accuracy")
fprintf('\n Successful Save to accuracy.binsev');
save("-mat7-binary", pFile, "p")
fprintf('\n Successful Save to p.binsev\n');
toc