Initial values in nlinfit or fitnlm
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
0 votes
Share a link to this answer
22 Comments
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
- They have their own roles. The patternsearch and ga functions search the entire (or a very large part of the) parameter space for the best parameter estimates. The fitnlm function searches in the region near the initial estimates you’ve given it. The advantage of fitnlm is that it then allows you to calculate the statistics on the fit.
- The parameters estimated by ga are more likely to be the most accurate, because it searches more widely. In a parameter space with a global minimum that is relatively straightforward to find, all parameter estimation routines will work optimally, and find essentially the same parameter estimates. The problem arises when there are several local minima that fitnlm, using a gradient-descent approach, could become ‘trapped’ in. Since ga does not use a gradient-descent approach, it is more likely to find the global minimum without getting trapped in local minima. When you then give those parameter estimates to fitnlm, it will converge quickly on the optimal parameter estimates, and give you the statistics on the fit.
Share a link to this comment
Share a link to this comment
Share a link to this comment
- For patternsearch: The estimated parameters are sensitive to the initial guess. The RMSE value is same for multiple combinations which makes difficult to decide the best set of parameters.
- For ga: It gives completely random set every time I run. The number of data points is only 1600. Can it be an issue for ga to not work properly? It also estimates negative values for some coefficients which is not logical as per the model. How can I define this constraint?
Share a link to this comment
- Depending on the model, there may be several parameter combinations that provide essentially the same fit. This is likely a problem with the model.
- It is usually necesary to run ga several times, ideally with a large initial population, to get the best fit. It is possible to automate this (running ga in a loop) and then saving the best individual from each run. See: How to save data from Genetic Algorithm in case MATLAB crashes? for the necessary code.
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
Share a link to this comment
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)