Add Measure

From SUMOwiki
Jump to navigationJump to search

Before starting ensure you are familiar with OO_Programming_in_Matlab.


In order for a modeling algorithm to work some kind of measure is needed that scores models and guides the search towards a good local optimum of the model parameter space (NOT of the simulator!!). A model can be scored in many different ways: using a separate validation set, simply the error in the fitted samples, cross validation, minimum description length (MDL), etc.

You are free to implement your own measures and add them to the toolbox. For example, this could be useful if you want to enforce a problem specific property. Say you are modeling a passive electronic component and you want to ensure the model retains passivity. This can be done by implementing a custom measure that performs the necessary checks.

To implement a new measure we suggest the following:

  • Go to the src/matlab/measures subdirectory and take a look at the most simple measure: SampleError
  • Make a copy of the SampleError directory and give it the same of your Measure
  • You should subclass Measure and ensure two methods are provided:
    • a constructor to read out the configuration information (if any) and construct the object
    • a calculateMeasure method that, given a model, returns a positive score where a lower score indicates a better model