Event tensors
What does the code in the MR do ?
The goal of this MR is to find another way than !124 (closed) of fixing #102 (closed)
The issue with !124 (closed) is that it changes the return value type of method _nll
from a Tensor
to a WeightedTensor
which is in contradiction with the base class and other subclasses.
Also, it changes the behavior of _get_func_result_for_tensor_or_weighted_tensor
when the passed value is a WeightedTensor
I think that the issue comes from the fact that we are using a WeightedTensor
to model something that isn't really a weighted tensor in the same way as the other variables. In most cases, events should be handled in the same way as regular variables represented as weighted tensors, but in a few cases they should be handled differently because the weights have a slightly different meaning for events.
This MR proposes to introduce a new EventTensor
class, which is a simple subclass of WeightedTensor
. The main logic modifications are:
- The getter of
WeibullRightCensoredObservationModel
returns anEventTensor
- All Weibull family objects expect an
EventTensor
for parameterx
instead of aWeightedTensor
-
_get_func_result_for_tensor_or_weighted_tensor
doesn't do anything with the weights when it receives anEventTensor
The MR also proposes to make the _get_func()
method of the SymbolicDistribution
class public since it seemed to simplify the code in the WeibullRightCensoredObservationModel
The rest of the modifications are basically PEP8 stuffs.