TomographicImaging / CIL

A versatile python framework for tomographic imaging
https://tomographicimaging.github.io/CIL/
Apache License 2.0
95 stars 41 forks source link

SGD with mini-batches #1707

Open MargaretDuff opened 8 months ago

MargaretDuff commented 8 months ago

We want to be able to do completely random mini-batch stochastic gradient descent ( or maybe other flavours...)

We could consider something like: https://github.com/epapoutsellis/StochasticCIL/blob/b177e46dfb22c5305f52b6d61f16f42e03ddb2f0/Wrappers/Python/cil/optimisation/functions/SGFunction.py#L61

Example usage:

rs = RandomSampling.uniform(len(f_subsets), batch_size=5) 

F = SGFunction(f_subsets, selection=rs)
proxSGD = ISTA(initial = initial, f=F, g=G, 
            update_objective_interval = rs.num_batches, 
            max_iteration = num_epochs*rs.num_batches)
proxSGD.run(verbose=1)

Points to consider

Discussed with @zeljkozeljko

epapoutsellis commented 8 months ago

Please check also https://github.com/TomographicImaging/CIL/pull/1345#issuecomment-1342616153 Walnut comparison for TV recon using SGD and MB.