Re: integer model parameters

From: Daniel Dewey <dd_at_email.domain.hidden>
Date: Sun, 4 Mar 2012 15:36:34 -0500
Off hand it seem to me that "fitting an integer-valued parameter"
is kind of an oxymoron   ;-)

It would seem instead that you'd do the fit with your n fixed
in turn at, say,  2, 3, 4, 5, 6 and compare the restults for
these 'different' models.

Or, is there no way to define your model so that non-integer values
give reasonable/continuous/intermediate results ?
replace  a^n  with  sign(a)*abs(a)^n  ?

-Dan

On Mar 4, 2012, at 3:20 PM, David P. Huenemoerder wrote:

> 
> If I have a user-defined fit fun with a parameter which is a
> non-negative integer exponent, what's a good way to constrain it to be
> an integer?  (it's the exponent of some possibly negative value).
> 
> In my fit function, I currently have something like...
> 
> define windprofile3_fit( lo, hi, par )
> {
> ...
>     variable n  = nint( par[ 4 ] ) ; % exponent >= 0, integer
> ...
> }
> 
> So internally, I think this is fine - the model function is evaluated
> as desired.
> 
> But the function will get called with arbitrary values by the
> optimizer, so what I see in the output after a fit is something like
> 
>> list_par
> ...
>  5  windprofile3(1).n        0     0         4.684222           0           5  
> ...
> 
> 
> In the _param_defaults() function, does it make sense to also set the
> "step" to 1?
> 
>    {
> 	case 4:            % n
> 	r.value =  0 ; 
> 	r.freeze = 1 ;
> 	r.min    = 0 ;
> 	r.max    = 10;
> 	r.hard_min = 0 ;
> 	r.hard_max = DOUBLE_MAX ;
> 	r.step = 1 ;
> 	r.relstep = 1./max([1,r.value]) ;
>    }
> 
> 
> What I have seems to work (no NaN's in my model line profiles); I just
> have to understand that some of the output parameter values are really
> nint(value) ... unless there's a nicer way to do this.
> 
> 
> -- Dave
> 
> David Huenemoerder  617-253-4283 (o); -253-8084 (f); http://space.mit.edu/home/dph
> MIT Kavli Institute for Astrophysics and Space Research
> 70 Vassar St., NE80-6065,
> Cambridge, MA  02139
> [Admin. Asst.: Elaine Tirrell, 617-253-7480, egt_at_email.domain.hidden> ----
> You received this message because you are
> subscribed to the isis-users list.
> To unsubscribe, send a message to
> isis-users-request_at_email.domain.hidden> with the first line of the message as:
> unsubscribe

    ----------------------------------------------------------
    Daniel Dewey                           dd_at_email.domain.hidden    MIT Kavli Institute        http://space.mit.edu/home/dd
    ----------------------------------------------------------


----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
Received on Sun Mar 04 2012 - 15:36:41 EST

This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:47 EDT