Exemplo n.º 1
0
int main(int argc, char** argv) {
	string filename = argv[1], _eps = argv[2];
	double eps = stod(_eps);
	ifstream fin(filename);
	string line;
	Examples e;
	Appear app;
	while (getline(fin, line)) {
		istringstream sin(line);
		int ans;
		sin >> ans;
		e.PB(Example(ans));
		
		int key;
		char c;
		Feature val;
		while (sin >> key >> c >> val) {
			e[e.size() - 1].feat[key] = val;
			app.insert(key);
		}
	}
	
	exPtrs p;
	for (int i = 0; i < e.size(); i++)
		p.PB(&e[i]);

	Tree *root = decide(p, eps, app);
	
	cout << "int tree_predict(double *attr) {" << endl;
	print(root, 1);
	cout << "}" << endl;
	
	delete root;
	
	return 0;
}