Open Puzzled-Face opened 1 month ago
Possible solution:
h_needs_ordinal_input
, perhaps) that
TRUE
for StoppingOrdinal
StoppingList
and returns TRUE
iff any sub call returns TRUE
stopTrial
method and convert the input model and data objects if required.Thanks @Puzzled-Face , I think a principled solution could maybe be to add corresponding stopTrial
methods with DataOrdinal
signature parts to all relevant Stopping
classes. Then, the required "conversion" to binary model and data would only happen at the very end when it is needed.
Thanks @Puzzled-Face , I think a principled solution could maybe be to add corresponding
stopTrial
methods withDataOrdinal
signature parts to all relevantStopping
classes. Then, the required "conversion" to binary model and data would only happen at the very end when it is needed.
Yes. That works in the case above.
I believe we will have the same issue with the other Rules
classes: CohortSize
, Increments
and NextBest
. If we do this, then I think that the existing wrapper classes (CohortSizeOrdinal
and the like) become redundant. Do you agree?
In a number of cases, the model
, samples
and data
method arguments are required only to match the signature of the generic. They are not actually required to evaluate the rule. (CohortSizeConst
is an obvious example). In these cases, we have at least three options:
samples
, model
and data
are of class ANY
and then use checkmate
to confirm that they are in the set of permitted classes (eg for the data
argument, Data
or DataOrdinal
are the only acceptable classes).I think I prefer the final option.
Note that these three options apply only when the corresponding object is not required to evaluate the rule. In other cases, a new method, whose signature uses ordinal classes, will be required. The general form of these new methods will be:
grade
parameter is validThanks @Puzzled-Face , I think a principled solution could maybe be to add corresponding
stopTrial
methods withDataOrdinal
signature parts to all relevantStopping
classes. Then, the required "conversion" to binary model and data would only happen at the very end when it is needed.Yes. That works in the case above.
I believe we will have the same issue with the other
Rules
classes:CohortSize
,Increments
andNextBest
. If we do this, then I think that the existing wrapper classes (CohortSizeOrdinal
and the like) become redundant. Do you agree?
Yeah I guess that sounds right. But before changing everything at once, probably safer to first start with one set of rules and confirm this in practice.
In a number of cases, the
model
,samples
anddata
method arguments are required only to match the signature of the generic. They are not actually required to evaluate the rule. (CohortSizeConst
is an obvious example).
Yes
In these cases, we have at least three options:
- Simply copy-and-paste the existing method, modifying the signature to use ordinal equivalents of the current argument classes.
We should avoid copy-and-paste when possible, so this is not preferred
- Convert the body of the existing method to a helper function. Modify the existing method so that it contains a simple call to the helper. Create an ordinal equivalent method that converts model, samples and data to the required binary equivalent (we already have helpers to do this) and then calls the helper.
I think that makes sense.
- Modify the signature of the existing method so that
samples
,model
anddata
are of classANY
and then usecheckmate
to confirm that they are in the set of permitted classes (eg for thedata
argument,Data
orDataOrdinal
are the only acceptable classes).
The method dispatch is not just for checking, but also for choosing the right method - so if we were to do this, then internally we need some kind of if/else conditions etc. and this would be unfortunate since we are already in the S4 framework.
I think I prefer the final option.
Note that these three options apply only when the corresponding object is not required to evaluate the rule. In other cases, a new method, whose signature uses ordinal classes, will be required.
Exactly, and for me that is another argument why I would go with option 2 above - for consistency.
The general form of these new methods will be:
- Confirm the
grade
parameter is valid- Convert the "ordinal class" arguments to their grade-specific binary equivalents (we already have helpers to do this).
- Call the binary equivalent of the method
Yes, and this can either work with conversions and then method calls, or calling helper functions similarly to above.
stopTrial-StoppingOrdinal
fails whenStoppingOrdinal
rules are nested within the overall stopping rule.No error occurs with the design returned by
.DefaultDesignOrdinal()
because its stopping rule is given byNote that the overall rule is a
StoppingOrdinal
, but none of its components are. To demonstrate:But an overall stopping rule that is (at least partially) composed of
StoppingOrdinal
s is perfectly possible:After which,
The problem arises because
stopTrial-StoppingOrdinal
simply converts the model and data objects it is passed to their binary equivalents and then delegates to the appropriatestopTrial
method without checking whether any subordinateStopping
rules are themselvesStoppingOrdinal
s. The situation is relatively complicated because the nesting may not be direct. For example:We should also check that we don't have similar issues with other rules (eg
size-CohortSizeMin
andsize-CohortSizeMax
;maxDose-IncrementsMin
etc).