Re: Problem applying generics to my code. Is there a better solution?
- From: "Lucas" <lscharen@xxxxxxxxx>
- Date: 5 Apr 2007 17:47:37 -0700
If I'm understanding you correctly
public static <T, P extends Distribution<?>> P conjugate(List<T>
data, Distribution<T> likelihood, P prior);
Now, conjugate sounds like a verb. Are you conjugating a likelihood
or a prior? Does it make sense to make the conjugate method into the
likelihood or prior object instead?
Which one of these three makes more sense?
"Likelihood, conjugate using data and prior":
likelihood.conjugate(data, prior)
or
"Prior, conjugate using data and likelihood":
prior.conjugate(data, likelihood)
or (where Data isn't just a List<T>)
"Data, conjugate using likelihood and prior):
data.conjugate(likelihood, prior)?
In this context "conjugate" is a property of the likelihood and the
prior distribution. It doesn't make a lot of sense to treat it as a
verb.
"A prior is CONJUGATE TO a likelihood iff the posterior
distribution has the same form as the prior"
A more natural purpose of a "conjugate" method would be a
conjugateTo() method to test for the property, e.g.
if ( prior.conjugateTo( likelihood ))
// Use fast, close-form solution
return prior.posterior( likelihood, data )
else
// Use slow, numerical simulation
return new Posterior( likelihood, data, prior );
.
- References:
- Problem applying generics to my code. Is there a better solution?
- From: Lucas
- Re: Problem applying generics to my code. Is there a better solution?
- From: Daniel Pitts
- Re: Problem applying generics to my code. Is there a better solution?
- From: Lucas
- Re: Problem applying generics to my code. Is there a better solution?
- From: Daniel Pitts
- Re: Problem applying generics to my code. Is there a better solution?
- From: Chris Uppal
- Re: Problem applying generics to my code. Is there a better solution?
- From: Daniel Pitts
- Problem applying generics to my code. Is there a better solution?
- Prev by Date: Re: Opinions wanted on source style
- Next by Date: Re: Problem applying generics to my code. Is there a better solution?
- Previous by thread: Re: Problem applying generics to my code. Is there a better solution?
- Next by thread: Re: Problem applying generics to my code. Is there a better solution?
- Index(es):
Relevant Pages
|