# GSoC Project - 2023

**URL:** <https://discourse.pymc.io/t/gsoc-project-2023/11735>\
**Category:** Development\
**Tags:** gsoc2023, gsoc\
**Created:** [March 29, 2023, 2:48pm UTC](https://discourse.pymc.io/t/gsoc-project-2023/11735 "2023-03-29T14:48:59Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [April 2, 2023, 10:43am UTC](https://discourse.pymc.io/t/gsoc-project-2023/11735/7 "2023-04-02T10:43:14Z")

</div>

@shreyas3156 Sorry for the delay in answering. All good questions, let me see if I can reply:

> [@shreyas3156](#):
>
> The **pdf in the interval should be 0** and the **pdf at the cutoff points should be the difference in the CDFs** at that point and the previous one?

Yes, that’s my understanding

> [@shreyas3156](#):
>
> Are there more ways other than using pm.math.switch() to perform interval censoring? (I came across IfElse too but it does not execute both the branches of the clause so I don’t think it can be used)

I think switch is the most natural, with the last condition being the “didn’t match anything → logp=-np.inf”

> [@shreyas3156](#):
>
> Is it acceptable to define a new ScalarOp in PyTensor or is it something we generally want to avoid?

We generally want to avoid it but can be considered if it seems like a clear winner. Are you thinking of a Switch with multiple branches?

> [@shreyas3156](#):
>
> Since we use MeasurableVariables in the IR graphs and preserve the RV mappings, is the autodifferentiation carried out on the IR graph (through its logp) or the original graph? I ask this in light of the idea of defining a new `MeasurableElemwise` to replace the `Elemwise{Switch}` Op in the IR graph but I’m unsure if it will break posterior sampling.

Differentiation is carried out in the logp graph, so the IR doesn’t matter for that.

---

_[View the full topic](https://discourse.pymc.io/t/gsoc-project-2023/11735)._
