Esempio n. 1
0
int
main (void)
{
  testA ();
  testB ();
  testC ();
  testD ();
  testE ();
  testF ();
  testG ();
  testH ();
  testI ();
  testJ ();
  testK ();
  testL ();
  testM ();
  testN ();
  testO ();
  testP ();
  testQ ();
  testR ();
  testS ();
  testT ();
  testU ();
  testV ();
  /*
  testW ();
  testX ();
  testY ();
  testZ ();
  */
  exit (0);
}
Esempio n. 2
0
int main()
{
	testA();
	testB();
	testC();
	testD();
	return 0;
}
Esempio n. 3
0
int main(int argc, char **argv)
{
    const char *progname = argv[0];
    commonInit();

    if(argc < 2)
        return usage(progname);

    if(!strcmp(argv[1], "optim")) {
        double cStart =  -5., cStop = 15., cStep = 2.;
        double gStart = -15., gStop =  3., gStep = 2.;

        argc -= 1;
        argv = &argv[1];

        while(1) {
            int opt = getopt(argc, argv, "c:g:");
            if(opt == -1)
                break;
            if(opt != 'c' && opt != 'g')
                return usage(progname);

            QStringList sl = QString(optarg).split(",");
            if(sl.count() != 3) {
                fprintf(stderr, "-c and -g options require a list of three numbers: start, stop and step\n");
                return 1;
            }

            bool ok1 = false, ok2 = false, ok3 = false;
            double optStart = sl.at(0).toDouble(&ok1);
            double optStop  = sl.at(1).toDouble(&ok2);
            double optStep  = sl.at(2).toDouble(&ok3);
            if(!ok1 || !ok2 || !ok3) {
                fprintf(stderr, "invalid numbers passed to -c or -g arguments\n");
                return 1;
            }

            if(opt == 'c') {
                cStart = optStart;
                cStop  = optStop;
                cStep  = optStep;
            }
            else if(opt == 'g') {
                gStart = optStart;
                gStop  = optStop;
                gStep  = optStep;
            }
        }

        if(argc - optind != 4)
            return usage(progname);

        WindowFile trainA(argv[optind]);
        if(!trainA.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind]);
            return 1;
        }
        WindowFile trainB(argv[optind+1]);
        if(!trainB.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind+1]);
            return 1;
        }
        WindowFile crossA(argv[optind+2]);
        if(!crossA.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind+2]);
            return 1;
        }
        WindowFile crossB(argv[optind+3]);
        if(!crossB.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind+3]);
            return 1;
        }

        cmd_optim(trainA, trainB, crossA, crossB,
                  cStart, cStop, cStep,
                  gStart, gStop, gStep);

        trainA.close();
        trainB.close();
        crossA.close();
        crossB.close();
    }
    else if(!strcmp(argv[1], "train")) {
        if(argc != 7)
            return usage(progname);
        char *modelfile = argv[2];
        bool ok1 = false, ok2 = false;
        double cParam = QString(argv[3]).toDouble(&ok1);
        double gParam = QString(argv[4]).toDouble(&ok2);
        if(!ok1 || !ok2) {
            fprintf(stderr, "invalid number passed as 'c' or 'g' parameter\n");
            return 1;
        }
        WindowFile trainA(argv[5]);
        if(!trainA.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[5]);
            return 1;
        }
        WindowFile trainB(argv[6]);
        if(!trainB.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[6]);
            return 1;
        }
        cmd_train(modelfile, cParam, gParam, trainA, trainB);
        trainA.close();
        trainB.close();
    }
    else if(!strcmp(argv[1], "cross")) {
        if(argc != 7)
            return usage(progname);
        bool ok1 = false, ok2 = false, ok3 = false;
        int nFold = QString(argv[2]).toInt(&ok1);
        double cParam = QString(argv[3]).toDouble(&ok2);
        double gParam = QString(argv[4]).toDouble(&ok3);
        if(!ok1 || !ok2 || !ok3) {
            fprintf(stderr, "invalid number passed as n-fold or 'c' or 'g' parameter\n");
            return 1;
        }
        WindowFile trainA(argv[5]);
        if(!trainA.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[5]);
            return 1;
        }
        WindowFile trainB(argv[6]);
        if(!trainB.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[6]);
            return 1;
        }
        cmd_cross(nFold, cParam, gParam, trainA, trainB);
        trainA.close();
        trainB.close();
    }
    else if(!strcmp(argv[1], "test")) {
        if(argc != 5)
            return usage(progname);
        svm_model *model = svm_load_model(argv[3]);
        if(model == NULL) {
            fprintf(stderr, "can't open model file '%s' for reading\n", argv[3]);
            return 1;
        }
        WindowFile testFile(argv[4]);
        if(!testFile.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[4]);
            return 1;
        }
        if(!strcmp(argv[2], "count"))
            cmd_test_count(model, testFile);
        else if(!strcmp(argv[2], "list"))
            cmd_test_list(model, testFile);
        else return usage(progname);
        svm_free_and_destroy_model(&model);
        testFile.close();
    }
    else if(!strcmp(argv[1], "roc")) {
        if(argc != 5)
            return usage(progname);
        svm_model *model = svm_load_model(argv[2]);
        if(model == NULL) {
            fprintf(stderr, "can't open model file '%s' for reading\n", argv[2]);
            return 1;
        }
        WindowFile testA(argv[3]);
        if(!testA.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[3]);
            return 1;
        }
        WindowFile testB(argv[4]);
        if(!testB.open(QIODevice::ReadOnly)) {
            fprintf(stderr, "can't open feature file '%s' for reading\n", argv[4]);
            return 1;
        }
        cmd_roc(model, testA, testB);
        testA.close();
        testB.close();
    }
    else return usage(progname);

    return 0;
}
Esempio n. 4
0
int main()
{
  testA();
  testB();
  testC();
}
Esempio n. 5
0
int main(int argc, char * argv[]) {
    matlabTest();
    testA();
    testB();
}
Esempio n. 6
0
int main() {
	testarray = (char_t*)malloc(IOTEST_SIZE);
	testA(); testB(); testC();
	return 0;
}