Comments (6)
There's a progress bar for fitting and sampling in the GUI.
In Jupyter notebooks there's a progress bar for the sampling (if you have tqdm installed), but no progress bar for the fitting. This could be implemented at the refnx level, but it'd also be possible for the user to provide a callback function via kwd arguments that are then passed on to the minimizer. This callback could increment it's own progress bar. I would do that by creating a callback class:
class Callback():
def __init__(self):
# create/initialise progress bar
def __call__(self, x):
# increment progress bar
callback = Callback()
fitter.fit(callback=callback)
from refnx.
What exactly would you want to see in a progress bar/progess update?
With sampling you know how far through the entire thing you are. Sometimes it's not possible with least squares to know when the end is, so you could display:
- number of iterations, maxiter, time
- chi2
The difference is that the minimisation will typically end before the end of the progress bar.
from refnx.
This is very true, I guess just some level of verbose output, chi2 would be conventional and informative I think. I was looking to see if tqmd could estimate the progress, but wasn't getting so far as am not familiar with it (and only saw it as you seem to have used it for the other progress bars)
from refnx.
For personal use I'd probably create a callback and print chi2 every few iterations.
from refnx.
I suppose it's not a bad idea to add something along these lines. I just need to find a keyword that doesn't clash with the minimizers. I think verbose
might work, and it's the same as used for sample.
I still don't know what to display in the progress bar.
from tqdm import tqdm
class Callback():
def __init__(self, maxiter):
self.maxiter = maxiter
self._bar = tqdm(total=self.maxiter)
self._it = 0
def __call__(self, x, convergence):
self._it += 1
self._bar.update(1)
self._bar.refresh()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self._bar.close()
fitter = CurveFitter(objective)
with Callback(1000) as c:
res = fitter.fit('differential_evolution', callback=c)
from refnx.
It's not a simple thing to add, because it would have to wrap any callback that the user provides as well.
from refnx.
Related Issues (20)
- pip install refnx leads to error with missing "_open_mp_helpers" HOT 3
- Drag and drop datasets doesn't work on windows HOT 1
- Save/reload doesn't work for mixed area models HOT 1
- curvefitter.fit does not accept kwargs for ‘L-BFGS-B’ HOT 2
- Saving and loading models from code HOT 4
- pyopencl does not play well with multiprocessing.
- Spawning of multiple windows when fitting with refnx HOT 1
- Using specified peak_pos (position, FWHM) in ReductionOptions is applied to both reflected and direct beam HOT 2
- Suggestion: add the option to ignore zeros in ReflectDataset? HOT 9
- Can't use non-Slab object as fronting or backing HOT 5
- Frequent Collapse HOT 5
- Inability to reduce older PNR data as the spin channels were not automatically identified HOT 4
- R increase at the beginning of the curve HOT 7
- Minor error in PolarizationEfficiency class matrix HOT 2
- Link equivalent parameters doesn't work for a MixedArea model
- refnx doesn't accept pathlib.Path objects as filenames HOT 2
- search not working on readthedocs HOT 2
- Jax backend HOT 7
- No access to emcee sampler arguements? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refnx.