Package park :: Package fitting :: Module fitresult :: Class FitHandler

Class FitHandler

source code


Abstract interface for fit thread handler.

The methods in this class are called by the optimizer as the fit progresses.

Note that it is up to the optimizer to call the fit handler correctly, reporting all status changes and maintaining the 'done' flag.

Instance Methods
 
improvement(self)
Called when a result is observed which is better than previous results from the fit.
source code
 
error(self, msg)
Model had an error; print traceback
source code
 
progress(self, current, expected)
Called each cycle of the fit, reporting the current and the expected amount of work.
source code
 
finalize(self)
Fit is complete; best results are reported
source code
 
abort(self)
Fit was aborted.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  done = False
True when the fit job is complete
  result = None
The current best result of the fit
Properties

Inherited from object: __class__

Method Details

improvement(self)

source code 

Called when a result is observed which is better than previous results from the fit.

result is a FitResult object, with parameters, #calls and fitness.

progress(self, current, expected)

source code 

Called each cycle of the fit, reporting the current and the expected amount of work. The meaning of these values is optimizer dependent, but they can be converted into a percent complete using (100*current)//expected.

Progress is updated each iteration of the fit, whatever that means for the particular optimization algorithm. It is called after any calls to improvement for the iteration so that the update handler can control I/O bandwidth by suppressing intermediate improvements until the fit is complete.