Commit 5461658f authored by mccrabb's avatar mccrabb
Browse files

Added optional 3rd arg for dataset

parent 364f79fb
...@@ -27,8 +27,9 @@ vector <string> parseFeatures(string fileName) { ...@@ -27,8 +27,9 @@ vector <string> parseFeatures(string fileName) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc <= 1) { if ((argc <= 2) || (argc >= 5)) {
cout << "arguments needed\n"; cout << "Given " << to_string(argc) <<" args. Need 2 or 3." << endl;
cout << "race [numTrees] [depth] [dataset (no suffix, optional)]" << endl;
exit(1); exit(1);
} }
...@@ -43,9 +44,18 @@ int main(int argc, char *argv[]) { ...@@ -43,9 +44,18 @@ int main(int argc, char *argv[]) {
vector <vector<string>> datasetAsString; vector <vector<string>> datasetAsString;
vector <FeatureType> featureTypes; vector <FeatureType> featureTypes;
vector <string> features; vector <string> features;
datasetAsString = parseDataToString("../datasets/adult.data"); if (argc == 4) {
featureTypes = parseFeatureTypes("../datasets/adult.featureTypes"); cout << "Dataset: " << argv[3] << endl;
features = parseFeatures("../datasets/adult.features"); datasetAsString = parseDataToString( (string)argv[3] + ".data");
featureTypes = parseFeatureTypes( (string)argv[3] + ".featureTypes");
features = parseFeatures( (string)argv[3] + ".features");
}
else {
cout << "WARNING: No dataset provided as an argument!" << endl;
datasetAsString = parseDataToString("../datasets/adult.data");
featureTypes = parseFeatureTypes("../datasets/adult.featureTypes");
features = parseFeatures("../datasets/adult.features");
}
//pick number of features to select for random sub-spacing //pick number of features to select for random sub-spacing
float featureWeight = sqrt(features.size())/features.size(); float featureWeight = sqrt(features.size())/features.size();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment