You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Grant Ingersoll <gs...@apache.org> on 2011/11/03 00:11:03 UTC
Use of Preconditions in Mahalanobis and other places
I was looking at some of the DistanceMeasure stuff (Mahalanobis at the moment) and it strikes me as a bit odd that our core distance() functions would use Preconditions to check things that are part of construction/configuration of the instance. A call to distance() is likely executed a lot of times. Is it really going to change? Any objections to me removing them?
As an aside, should we have SquaredMahalanobis too, much like we have SquaredEuclidean? Seems like, since we just need relativeness we don't actually care about the sqrt, right?
Re: Use of Preconditions in Mahalanobis and other places
Posted by Grant Ingersoll <gs...@apache.org>.
Done. JIRA closed.
On Nov 2, 2011, at 8:05 PM, Ted Dunning wrote:
> The preconditions should still be there, but should be in the constructor
> in such cases (IMHO).
>
> This might be an argument for removing setters if they exist or adding
> preconditions to the setters.
>
> On Wed, Nov 2, 2011 at 4:11 PM, Grant Ingersoll <gs...@apache.org> wrote:
>
>> I was looking at some of the DistanceMeasure stuff (Mahalanobis at the
>> moment) and it strikes me as a bit odd that our core distance() functions
>> would use Preconditions to check things that are part of
>> construction/configuration of the instance. A call to distance() is likely
>> executed a lot of times. Is it really going to change? Any objections to
>> me removing them?
>>
>> As an aside, should we have SquaredMahalanobis too, much like we have
>> SquaredEuclidean? Seems like, since we just need relativeness we don't
>> actually care about the sqrt, right?
>>
>>
Re: Use of Preconditions in Mahalanobis and other places
Posted by Ted Dunning <te...@gmail.com>.
The preconditions should still be there, but should be in the constructor
in such cases (IMHO).
This might be an argument for removing setters if they exist or adding
preconditions to the setters.
On Wed, Nov 2, 2011 at 4:11 PM, Grant Ingersoll <gs...@apache.org> wrote:
> I was looking at some of the DistanceMeasure stuff (Mahalanobis at the
> moment) and it strikes me as a bit odd that our core distance() functions
> would use Preconditions to check things that are part of
> construction/configuration of the instance. A call to distance() is likely
> executed a lot of times. Is it really going to change? Any objections to
> me removing them?
>
> As an aside, should we have SquaredMahalanobis too, much like we have
> SquaredEuclidean? Seems like, since we just need relativeness we don't
> actually care about the sqrt, right?
>
>