Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ int main (int argc, const char * argv[])
return EXIT_FAILURE;
}

if( !ctree.save(std::fstream("Model.grt")) ){
auto file = std::fstream("Model.grt");

if( !ctree.save( file ) ){
log << "Failed to train model!" << endl;
return EXIT_FAILURE;
}

if( !ctree.load(std::fstream("Model.grt")) ){
if( !ctree.load( file ) ){
log << "Failed to train model!" << endl;
return EXIT_FAILURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ int main (int argc, const char * argv[])

cout << "GMM Trained in " << gmm.getNumTrainingIterationsToConverge() << " iterations.\n\n";

auto file = std::fstream("GMM.grt");

//Save the model to a file
if( !gmm.save( std::fstream("GMM.grt") ) ){
if( !gmm.save( file ) ){
cout << "Failed to save model to file!\n";
return EXIT_FAILURE;
}

//Load the model back from a file
if( !gmm.load( std::fstream("GMM.grt") ) ){
if( !gmm.load( file ) ){
cout << "Failed to load model from file!\n";
return EXIT_FAILURE;
}
Expand Down