This function loops over the command line arguments to find (weight,featureDef)-pairs. The vectors featureDefs and weights are filled with the findings Definition at line 41 of file mainPrecomputeKernelMatrix.cpp. References Impala::Core::Feature::FeatureDefinition::AsString(), Impala::Util::Database::GetIOBuffer(), Impala::CmdOptions::GetString(), ILOG_DEBUG, ILOG_VAR, Impala::MakeString(), and Impala::Util::IOBuffer::Puts(). Referenced by mainPrecomputeKernelMatrix(). 00046 { 00047 /* 00048 The inputFeatures can no longer be given through the arguments only through 00049 an option. 00050 */ 00051 ILOG_VAR(Application.mainPrecomputeKernelMatrix.CheckParameters); 00052 00053 /* add input features through the INI file */ 00054 String inputFeatures = options.GetString("inputFeatures"); 00055 if(!inputFeatures.empty()) 00056 { 00057 ILOG_DEBUG("imput features: "<< inputFeatures); 00058 Util::StringParser p(inputFeatures); 00059 while(!p.TheEnd()) 00060 { 00061 double weight = p.GetDouble(); 00062 ILOG_DEBUG("w: "<<weight); 00063 if(weight == 0.0) 00064 { 00065 ILOG_ERROR_ONCE("\"" << inputFeatures << "\" contains a zero weight"); 00066 return false; 00067 } 00068 String name = p.GetString(' ', false); 00069 if(name.empty()) 00070 { 00071 ILOG_ERROR_ONCE("While parsing --inputFeatures: unbalanced length, empty name"); 00072 return false; 00073 } 00074 ILOG_DEBUG("n: "<< name); 00075 weights.push_back(weight); 00076 Feature::FeatureDefinition fdef(name); 00077 name = dataset->GetFilePathFeatureIndex(fdef, "", false, false); 00078 if(name.empty()) 00079 { 00080 ILOG_ERROR_ONCE("could not open \"" << fdef.AsString() << "\""); 00081 return false; 00082 } 00083 featureDefs.push_back(fdef); 00084 } 00085 } 00086 00087 if(Link::Mpi::MyId() == 0) 00088 { 00089 String filename; 00090 if (dataset2) 00091 filename = dataset2->GetFilePathPrecomputedKernels 00092 (resultname+".input.txt", dataset->GetSetName(), 00093 true, false); 00094 else 00095 filename = dataset->GetFilePathPrecomputedKernels 00096 (resultname+".input.txt", "", true, false); 00097 00098 Util::Database* db = (dataset2) ? dataset2->GetDatabase() 00099 : dataset->GetDatabase(); 00100 Util::IOBuffer* buf = db->GetIOBuffer(filename, false, false, "tmp"); 00101 if(buf) 00102 { 00103 for(int i=0 ; i<weights.size() ; ++i) 00104 { 00105 String s = MakeString(weights[i]) + " " + featureDefs[i].AsString(); 00106 buf->Puts(s); 00107 } 00108 delete buf; 00109 } 00110 else 00111 ILOG_ERROR_ONCE("could not open input.txt"); 00112 } 00113 00114 return true; 00115 }
Here is the call graph for this function:
|