MLP2C(1)

NAME
mlp2c - create C source code to implement trained multi-layer perceptron classifier

SYNOPSIS
mlp2c -model_file file [-suffix s]
[ -adjust_test_priors -test_uniform_priors |
-test_priors_list x[,x]... ] > file.c

DESCRIPTION
This filter creates source code on the standard output which can be included in a user's program to implement a trained MLP classifier. An MLP parameter file is required as an argument to the -model_file command line argument. All normalization, feature selection, and algorithm parameters are set as they were in the trained classifier. A user's program calls the classify() subroutine with a floating vector equal to the raw classifier input and another floating point vector to hold classifier outputs. The classify() program returns an integer (0 to the number of classes minus 1) equal to the classification decision and fills in the output vector. Generated source code contains two subroutines. The classify() subroutine performs classification, and the normalize() subroutine is used by classify() for data normalization. These names can be changed by editing the generated source code or using the -suffix command line flag. The following options are recognized:

-model_file file
    The name of a parameter file containing a trained MLP classifier. Parameter files are created automatically under LNKnet when an MLP classifier is trained. The prefix for the parameter file name is the experiment number followed by "mlp" and the suffix is ".param". For example, the name of the parameter file for an experiment named X1 is X1mlp.param.

-suffix string
    String is a suffix that is added onto the classify() and normalize() subroutine names to make that name more unique. The command -suffix X1mlp results in subroutines named classify_X1mlp() and normalize_X1mlp().

-adjust_test_priors
    Scale classifier outputs to simulate uniform test priors or to give the class priors in test_priors_list. One of the next two flags, -test_uniform_priors or -test_priors_list, must also be set.

-test_uniform_priors
    When -adjust_test_priors is set, scale the outputs to give uniform test priors.

-test_priors_list x[,x]...
    When -adjust_test_priors is set, scale the outputs to give the class probabilities in the test_priors_list.

EXAMPLE OF USER'S CODE
The following program calls the classifier subroutine to generate decision regions.
    main()
    {
      float x,y, xstep, ystep, inputs[2], outputs[2];
      int class;
      /* sample a 50 by 50 grid of patterns between (-1,-1) and (2,2) */
      xstep = ystep = (2.-(-1.))/50.;
      for(x = -1.; x < 2; x += xstep){
        inputs[0] = x;
        for(y = -1.; y < 2; y += ystep){
          	inputs[1] = y;
          	/* find the class for the current pattern */
          	class = classify_mlp(inputs, outputs);
          	/* print out the results */
          	printf("%d", class);
    		}
        printf("\n");
    	}
    }

SEE ALSO
mlp_lnk(1), LNKnet User's Guide

HISTORY
1-June-93 Original version written by Linda Kukolich.
Modified 22 June 1994, added -suffix flag
Modified 18 April 1995, added priors adjustment flags