Stochastic Framework #1377
Replies: 8 comments 8 replies
-
|
Beta Was this translation helpful? Give feedback.
-
The above poll isn't useful as it only allows selecting one of them. |
Beta Was this translation helpful? Give feedback.
-
My preference would be to use a In this case the name CIL/Wrappers/Python/cil/optimisation/algorithms/SPDHG.py Lines 190 to 191 in 76e5014 SPDHG would also benefit from being able to call a generator as discussed here, so I would definitely drop the term function from the name of the method. My proposal is something like class IndexGenerator(object):
@staticmethod
def random(num_subsets):
return IndexGenerator.FunctionNumberGenerator(num_subsets, replacement=True)
@staticmethod
def random_shuffle(num_subsets):
return IndexGenerator.FunctionNumberGenerator(num_subsets, replacement=False, shuffle='random')
@staticmethod
def single_shuffle(num_subsets):
return IndexGenerator.FunctionNumberGenerator(num_subsets, replacement=False, shuffle='single' )
@staticmethod
def FunctionNumberGenerator(num_functions, sampling_method):
'''This is the function at https://github.com/TomographicImaging/CIL/blob/a81b01f59d786cf0c7163f65aa39482569eb379c/Wrappers/Python/cil/optimisation/utilities/FunctionNumberGenerator.py#L20''' Personally I understand better the terms Finally, I wonder if it would be more advantageous to be able to specify the interval |
Beta Was this translation helpful? Give feedback.
-
Thank you @paskino @KrisThielemans . Polls in github do not allow multiple questions and answers so I will create a poll using mentimeter, but I would like to know all the questions. So far we have the following: Q1: The name of a function that returns an index number refering to the selected
Q2 The design of such a function:
Q3 Arguments of this function are a)
Q4 names for sampling_methods:
Q5: Base class for stochastic framework Q6: Signature of base class for stochastic framework
@zeljkozeljko, @jakobsj, @gfardell, @BillyTang , @ClaireDelplancke, @mehrhardt, @Imraj-Singh , @samdporter in case you want to add another question, option etc please leave a comment below and I will add them in the poll. If you agree with questions/options, please 👍 and I will create the poll. |
Beta Was this translation helpful? Give feedback.
-
My opinion is resumed in #1377 (comment) Q1 Q2: a factory with the name Q3, I suggest to make available several factory method to create the required generator. The only argument would then be the number of subsets. Would it make sense to make the generator generate indices in a range [a,b], so that the factory will need to know Q4 Q5 and Q6 we have discussed at length, and what you write is the consensus reached. |
Beta Was this translation helpful? Give feedback.
-
In terms of Q5, Q6, I have changed the base class in the last 5 months 4 times:
I think we need to be sure of the design, reach a final decision that we all agree and implement. |
Beta Was this translation helpful? Give feedback.
-
@paskino, I'd modify your proposal to hide the |
Beta Was this translation helpful? Give feedback.
-
With version 24.0.0 SGD was introduced and with the merge of #1624 and #1625 the stochastic framework has been added to CIL. |
Beta Was this translation helpful? Give feedback.
-
This is a poll for the design of
FunctionNumberGenerator
ApproximateGradientSumFunction
that are currently implemented in the latest commit of #1345.
Apart from the names of the generator
FunctionNumberGenerator
and the most important class for our stochastic frameworkApproximateGradientSumFunction
, we need to decide on their signatures.FunctionNumberGenerator
At the moment the
FunctionNumberGenetator
implements three different sampling methods and basically wraps thenumpy.random.choice.
p=None
)p=None
). At the end of each epoch, i.e., after selected all functions, the list of functions is permuted again.p=None
). The list of functions is permuted only once is used for all epochs.from here.
ApproximateGradientSumFunction
This represents a sum of
n
functions and the differences from theSumFunction
are.gradient
) is implemented for each function.gradient
method is implemented in a stochastic mode and is determined by its children, e.g.,SGFunction
,SAG(A)Function
, etcAt the moment the
ApproximateGradientSumFunction
acceptsselection=string
, accepted strings are:random (1st sampling method)
,random _permutation(2nd sampling method)
,fixed_permutation (3rd sampling method)
, orselection = FunctionNumberGenetator(...)
Note: Please propose alternative names for the generator/class and their arguments in the poll options below and I can add them
0 votes ·
Beta Was this translation helpful? Give feedback.
All reactions