Skip to content

Making Modifications

Xiaomao Ding edited this page Jul 7, 2017 · 4 revisions

The code for the model itself has been set in a manner that supports customized functions training/test data generation, choice of classification algorithm, and mosaic parameters. There are three subdirectories in the toolbox directory that hold these types of functions.

Adding new code

The ClassifierFunctions subdirectory contains functions that describe how the classifier should use the training data to learn a decision rule. Each of these functions must take as input (trainingData,testingData,trainingClasses,testingClasses). The first output must be the percent correct value when of the predictions made on the testingData by a classifier trained on the trainingData. Furthermore, the function name must start with 'cf#_' where # is the next unused integer. This is because the function that loads the classifier function does so based on the alphanumerical listing of the functions in the directory.

Similarly, the DatasetFunctions folder contains functions that generate the training and test datasets used to train and evaluate the classifiers. See any of the data generating functions for input/output parameter formatting. Note that the last input parameter is an optional coneMosaic object that some dataset generating function use and some do not. Like the classifier functions, the a dataset generating function name must begin with 'df#_' as the loader function uses this to numerically index the appropriate function.

Finally, the model code is also written in a similar manner. In the toolbox/Model/ModelVersions directory resides a single function that executes the main model logic: loading the optical images, performing the PCA/standardization, recording model performance. New model functions can be placed in this folder. As long as the function names start with 'm#_', they will be accessible to the loader.

Note: Input/output parameters across functions of the same type must be kept consistent for new functions to work. See existing functions for details on what the input/output formatting should be.

Calculation params

In order to make use of any new code added in the manner described above, it is necessary to change the parameters of the calculation. This can be done in the runAllFirstOrderCalcs script. The fields to change for the calcParams struct are MODEL_ORDER, cFunction, and dFunction, which refer to the model function number, classifier function number, and dataset function number, respectively. Change these to the appropriate numbered function and the software will load it during runtime.