SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
52 stars 41 forks source link

better support for integer parameters in fit (Trac #482) #616

Open pkienzle opened 5 years ago

pkienzle commented 5 years ago

For models such as pearl necklace which have an integer number of pearls, some bumps fitters will fail. LM and newton in particular will fail; nelder-mead and DE won't fail, but may not select the best integer; dream should work fine, though not as efficiently as it could if it knew it were working with integer parameters.

Other models such as the n-shell model need to introduce extra parameters with each additional shell. These are not supported by any fitter.

Migrated from http://trac.sasview.org/ticket/482

{
    "status": "new",
    "changetime": "2017-10-27T10:33:41",
    "_ts": "2017-10-27 10:33:41.607674+00:00",
    "description": "For models such as pearl necklace which have an integer number of pearls, some bumps fitters will fail.  LM and newton in particular will fail; nelder-mead and DE won't fail, but may not select the best integer; dream should work fine, though not as efficiently as it could if it knew it were working with integer parameters.\n\nOther models such as the n-shell model need to introduce extra parameters with each additional shell.  These are not supported by any fitter.",
    "reporter": "pkienzle",
    "cc": "",
    "resolution": "",
    "workpackage": "SasView Bug Fixing",
    "time": "2015-11-23T23:17:35",
    "component": "SasView",
    "summary": "better support for integer parameters in fit",
    "priority": "minor",
    "keywords": "",
    "milestone": "SasView 4.3.0",
    "owner": "",
    "type": "defect"
}
butlerpd commented 5 years ago

Trac update at 2017/10/27 10:33:41: butler changed milestone from "SasView Next Release +1" to "SasView 4.3.0"

butlerpd commented 4 years ago

@pkienzle has there been any change to this to your knowledge? and is this a sasmodels issue or even a bumps issue? or is it really a SasView issue? I think I'll move it to 5.1 for now but would be better to delineate where the fixes need to happen (if indeed they have not already been implmented)

pkienzle commented 4 years ago

No change.

This could be partly addressed as a documentation issue. Add some docs to models with integer parameters warning that they can't be fit with all optimizers.

Next level is to add a warning to sasview that appears when an integer parameter is selected for fitting.

Third level is extending all optimizers to support "mixed integer optimization" so no warning is necessary.

Fourth level is adding "model selection" to bumps, adding additional shell parameters when the number of shells is updated for example.

butlerpd commented 4 years ago

Thanks @pkienzle Is the third level a sasmodels or sasview fix?

First is sasmodels and the second a sasview fix. Fourth I guess starts in bumps. Thinking perhaps to create several tickets in the correct repos but will need to carefully link them together across the repos.

pkienzle commented 4 years ago

Sasview, sascalc, sasmodels and bumps will all need updates.

Sasmodels needs to be able to mark parameters as integer parameters, and the models with integer parameters need to be updated. Sasmodels docs need to be updated (https://github.com/SasView/sasmodels/issues/256). Perhaps the kernel wrapper can automatically convert floats to integers so that the model writer doesn't need to remember to do so (there was at least one bug where Iq used float to integer conversion but the volume conversion did not.

Sasmodels needs integer weight distributions for polydispersity (#615) and these need to be added to sasview.

Sascalc needs to tell bumps that it has integer parameters.

Bumps needs algorithms to handle integer parameters. Parameter uncertainties for integer parameters need special handling.

Sasview should restrict input values to integers for integer parameters.

The fourth level (fitted multiplicity parameters for rpa, onion, spherical_sld) would require even more effort across all packages, but this would rarely be needed and can be modeled well enough with a mixture model.

pkienzle commented 4 years ago

I recommend leaving this as one ticket until somebody wants to work on it.

butlerpd commented 4 years ago

Ok .. will leave in SasView as one ticket for now then

butlerpd commented 1 year ago

@smk78 -- do you know why you added the documentation tag here? Eventually, if the changes all get made they will need to be documented but that is true of every ticket. I did not see where documentation came in otherwise. Did I miss something?

smk78 commented 11 months ago

@butlerpd , yes, because in https://github.com/SasView/sasview/issues/616#issuecomment-619628048 @pkienzle said that this could be partly dealt with by additional clarity in the model documentation.