50 void mapCallback(
float progress,
void *extra_param );
59 main(
int argc,
char **argv )
63 printf (
"Usage: %s request_file [log_level [config_file]]\n", argv[0]);
68 string log_level(
"info");
72 log_level.assign( argv[2] );
89 char *request_file = argv[1];
98 int resp = request.
configure( &om, request_file );
129 int nparam = metadata->
nparam;
149 MPI_Init( &argc, &argv );
153 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
189 int omissions = matrix->
getValue(0.0, 1.0);
190 int total = omissions + matrix->
getValue(1.0, 1.0);
196 if ( commissionError >= 0.0 ) {
198 int commissions = matrix->
getValue(1.0, 0.0);
199 total = commissions + matrix->
getValue(0.0, 0.0);
201 Log::instance()->
info(
"Commission error: %7.2f%% (%d/%d)\n", commissionError * 100, commissions, total );
234 catch ( std::exception& e ) {
261 printf(
"Could not find any algorithms.\n" );
265 printf(
"\nChoose an algorithm between:\n" );
269 while ( ( metadata = *availables++ ) )
271 printf(
" [%d] %s\n", count++, metadata->
name.c_str() );
273 printf(
" [q] Quit\n" );
294 if ( ! quit_option ) {
300 printf(
"\nOption: " );
301 fgets( buf, 128, stdin );
303 int first_char_ascii = (int)buf[0];
306 if ( first_char_ascii == 113 || first_char_ascii == 81 ) {
310 option = atoi( buf );
312 if ( option <= 0 || option >= quit_option ) {
318 return availables[option-1];
333 for ( ; param < end; param++, result++ )
340 printf(
"\n* Parameter: %s\n\n", param->
name.c_str() );
341 printf(
" %s\n", param->
overview.c_str() );
349 printf(
"%s >= %d\n", param->
name.c_str(), int( param->
min_val ) );
353 printf(
" %s >= %f\n", param->
name.c_str(), param->
min_val );
360 printf(
"%s <= %d\n\n", param->
name.c_str(), int( param->
max_val ) );
364 printf(
" %s <= %f\n\n", param->
name.c_str(), param->
max_val );
369 printf(
"Enter with value [%s]: ", param->
typical.c_str() );
375 if ( fgets( value, 64, stdin ) && ( *value >=
' ' ) ) {
380 char * pos = strchr( value,
'\n' );
411 int length = strlen(
id );
412 char **end = vet + nvet;
415 if ( ! strncmp(
id, *vet++, length ) )
416 return *(vet-1) + length;
static void loadConfig(const std::string configFile)
int configure(OpenModeller *om, char *request_file)
void warn(const char *format,...)
'Warn' level.
void setPrefix(const char *pref)
bool calcConfusionMatrix()
AlgMetadata const * readAlgorithm(AlgMetadata const **availables)
int showAlgorithms(AlgMetadata const **availables)
AreaStats * getActualAreaStats()
void setModelCallback(ModelCreationCallback func, void *param=0)
double getAccuracy() const
const ConfusionMatrix *const getConfusionMatrix()
void setValue(std::string const val)
static Log * instance()
Returns the instance pointer, creating the object on the first call.
void setMapCallback(ModelProjectionCallback func, void *param=0)
int getValue(Scalar predictionValue, Scalar actualValue) const
Log::Level getLogLevel(std::string level)
void mapCallback(float progress, void *extra_param)
void setLevel(Level level)
double getCommissionError() const
void makeModel(OpenModeller *om)
void error(const char *format,...)
'Error' level.
char * extractParameter(char *name, int nvet, char **vet)
void setupExternalResources()
AlgMetadata const ** availableAlgorithms()
static int searchDefaultDirs()
void setLowestTrainingThreshold(const Model &model, const SamplerPtr &sampler)
int setAlgorithm(std::string const id, int nparam, AlgParameter const *param)
double getOmissionError() const
double getThreshold() const
void setId(std::string const id)
void info(const char *format,...)
'Info' level.
const SamplerPtr & getSampler() const
bool requestedProjection()
void makeProjection(OpenModeller *om)
RocCurve *const getRocCurve()
void modelCallback(float progress, void *extra_param)
int getAreaPredictedPresent() const
int main(int argc, char **argv)
int readParameters(AlgParameter *result, AlgMetadata const *metadata)