Blog Archive

Sunday, December 2, 2012

Feeding Arguments into an Optimization Function

Let's say you only want to optimize a few parameters in a function - not all of them. In this case, you should pass the rest of the parameters through arguments.

Example: The below function needs the data (time vector and observation vector) passed to it
def freqfitscore(inputs,timevec,obsvec):

Show full code for function


We import the function as "score" and pass the data to it during the optimization by using the arguments slot
a=fmin(score,guess,args=(timevec,obsvec),full_output=1)

Show full optimization code below

No comments:

Post a Comment