forked from Yiqing-Gu/Pidentify
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
82 lines (75 loc) · 3.48 KB
/
main.cpp
File metadata and controls
82 lines (75 loc) · 3.48 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
#include <iostream>
#include <mutex>
#include <string>
#include "modelState.h"
#include "testResults.h"
#include "cachePaths.h"
#include "runFull.h"
#include "runFromCache.h"
ModelState MODEL_STATE;
TestResults TEST_RESULTS;
CachePaths CACHE_PATHS;
std::mutex m;
double NUM_THREADS;
int K_FOLDS = 10;
size_t MIN_CLASS_MEMBERS = 30;
size_t MAX_CLASS_MEMBERS = 1000;
void printBasicHelp() {
std::string helpMsg = "Usage: ./cpv [-H] weightScheme pvalueThreshold featureWeighting neighborsChecked minSameClass "
"datasetFilepath cacheDirectory\n"
"\t -H: display more detailed help message\n"
"\t weightScheme: {\"squared\", \"linear\", \"unweighted\", \"cube root\"}\n"
"\t pvalueThreshold: {\"per class\"}\n"
"\t featureWeighting: {0, 1}\n"
"\t neighborsChecked: non negative integer\n"
"\t minSameClass: non negative integer\n"
"\t datasetFilepath: file containing dataset to run k fold cross validation on\n"
"\t cacheDirectory: folder where output logs from training and testing will be stored\n";
std::cout << helpMsg;
}
void printDetailedHelp() {
std::string helpMsg = "Usage: ./cpv [-H] weightScheme pvalueThreshold featureWeighting neighborsChecked minSameClass "
"datasetFilepath cacheDirectory\n"
"\t -H: Display more detailed help message.\n"
"\t weightScheme {\"squared\", \"linear\", \"unweighted\", \"cube root\"}: Weight assigned to points in the "
"empirical distribution curve (ECDF) during curve fitting, as a function of nearest neighbor distance. "
"Recommended to choose \"squared.\"\n"
"\t pvalueThreshold {\"per class\"}\n"
"\t featureWeighting {0, 1}: Boolean value for whether to apply feature weighting during nearest neighbor "
"distance calculations.\n"
"\t neighborsChecked {non negative integer}: Number of global nearest neighbors to find for \"voting off the "
"island.\" 5 is generally a good choice.\n"
"\t minSameClass {non negative integer}: Minimum number of global nearest neighbors required to keep a datapoint "
"during \"voting off the island.\" 3 is generally a good choice. 0 is the equivalent of disabling \"voting off the "
"island,\" and it is recommended to also pass 0 for neighborsChecked in this case.\n"
"\t datasetFilepath: File containing dataset to run k fold cross validation on. The first row must be the "
"header; the first column must be the class column; and subsequent columns must be the features. Prepending "
"\"nonNum\" to a column name will cause that column and all subsequent columns to be disregarded.\n"
"\t cacheDirectory: Folder where output logs from training and testing will be stored.\n\n"
"Recommendation: Redirect the standard output to a file to save additional helpful information, including "
"confusion matrices for the classes and \"none of the above\" (NOTA) points.\n";
std::cout << helpMsg;
}
int main(int argc, char* argv[]) {
switch (argc) {
case 4:
runFromPValues(argv);
break;
case 5:
runFromNNDistances(argv);
break;
case 8:
runFull(argc, argv);
break;
case 10:
runFull(argc, argv);
break;
default:
if (argc > 1 && std::strcmp(argv[1], "-H") == 0) {
printDetailedHelp();
}
else {
printBasicHelp();
}
}
}