You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Alexey Anatolevitch <al...@gmail.com> on 2013/04/23 15:28:11 UTC

org.apache.lucene.classification - bug in SimpleNaiveBayesClassifier

Hi,

Anybody is actively working on the classification package?

I was trying it with 4.2.1 and SimpleNaiveBayesClassifier seems to have a
bug - the local copy of BytesRef referenced by foundClass is affected by
subsequent TermsEnum.iterator.next() calls as the shared BytesRef.bytes
changes... I can provide a test case if that was not clear.

I believe it's either BytesRef.clone() that needs to create a full copy of
the underlying array, or a local fix SimpleNaiveBayesClassifier to actually
copy bytes instead of clone()

Alexey

Re: org.apache.lucene.classification - bug in SimpleNaiveBayesClassifier

Posted by Adrien Grand <jp...@gmail.com>.
Hi Alexey,

On Tue, Apr 23, 2013 at 3:28 PM, Alexey Anatolevitch
<al...@gmail.com> wrote:
> I was trying it with 4.2.1 and SimpleNaiveBayesClassifier seems to have a
> bug - the local copy of BytesRef referenced by foundClass is affected by
> subsequent TermsEnum.iterator.next() calls as the shared BytesRef.bytes
> changes... I can provide a test case if that was not clear.
>
> I believe it's either BytesRef.clone() that needs to create a full copy of
> the underlying array, or a local fix SimpleNaiveBayesClassifier to actually
> copy bytes instead of clone()

Good catch Alexey. If you can open an issue in JIRA and provide a
patch, I'll be happy to review it!

--
Adrien

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org