Message Boards Message Boards

0
|
1600 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Adding a custom function to FitRegularization

Posted 1 year ago

Hi, I am trying to add a custom function to FitRegularization in FindFit. The description says to use FitRegularization->rfun for a user function rfun[a] where "a" indicates points in data sets. I could not find any working examples and the above does not work. Could anyone who used/implemented this feature explain the correct format?

2 Replies

I am not convinced whether this is a good answer, but maybe helpful though. When I try:

FindFit[data, function[x], {a1}, x, FitRegularization -> (g[#] &)]

then I get the error message

FindFit::nrrfun: The regularization function g[#1]& evaluates to {0.} that is not a real number for a residual vector.

i.e. it evaluates to a List. This brings me to the idea of doing it simply like so:

FindFit[data, function[x], {a1}, x, FitRegularization -> (First[g[#]] &)]

which MMA can obviously digest whithout problems. Does that make sense to you, can you use that approach with your real data?

POSTED BY: Henrik Schachner

Crossposted here.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract