本文整理汇总了C++中MatrixDouble::loadFromCSVFile方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixDouble::loadFromCSVFile方法的具体用法?C++ MatrixDouble::loadFromCSVFile怎么用?C++ MatrixDouble::loadFromCSVFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixDouble
的用法示例。
在下文中一共展示了MatrixDouble::loadFromCSVFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, const char * argv[])
{
InfoLog log("ClusterTreeExample");
//Load some training data to train the ClusterTree model
MatrixDouble trainingData;
if( !trainingData.loadFromCSVFile("ClusterTreeData.csv") ){
log << "Failed to load training data!" << endl;
return EXIT_FAILURE;
}
//Create a new ClusterTree instance
ClusterTree ctree;
//Set the number of steps that will be used to choose the best splitting values
//More steps will give you a better model, but will take longer to train
ctree.setNumSplittingSteps( 100 );
//Set the maximum depth of the tree
ctree.setMaxDepth( 10 );
//Set the minimum number of samples allowed per node
ctree.setMinNumSamplesPerNode( 10 );
//Set the minimum RMS error allowed per node
ctree.setMinRMSErrorPerNode( 0.1 );
//Train a cluster tree model
if( !ctree.train( trainingData ) ){
log << "Failed to train model!" << endl;
return EXIT_FAILURE;
}
if( !ctree.saveModelToFile("Model.grt") ){
log << "Failed to train model!" << endl;
return EXIT_FAILURE;
}
if( !ctree.loadModelFromFile("Model.grt") ){
log << "Failed to train model!" << endl;
return EXIT_FAILURE;
}
//Print the tree
ctree.print();
return EXIT_SUCCESS;
}