Skip to content

Student's t-distribution as base distribution #31

Answered by francois-rozet
CaioDaumann asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @CaioDaumann, thank you for your question! There are several ways to create a custom base distribution, but it must be a LazyDistribution, that is a module that returns a distribution when called.

The first way is to create a function (or a class constructor) that returns a Distribution when called and wrap it inside Unconditional.

def student_t(log_df: Tensor) -> Distribution:
    return Independent(StudentT(df=log_df.exp()), 1)
    
base = Unconditional(student_t, torch.randn(5))

There are a few subtleties with Unconditional. First, keyword arguments are not considered as parameters (or buffers), they will be passed unmodified to the function during the forward. This means that te…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@francois-rozet
Comment options

Comment options

You must be logged in to vote
5 replies
@CaioDaumann
Comment options

@francois-rozet
Comment options

@CaioDaumann
Comment options

@francois-rozet
Comment options

@CaioDaumann
Comment options

Answer selected by CaioDaumann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants