Just peeking at the code, Tommaso --

    Map<String, Integer> classCounts = new HashMap<String, Integer>();

this will cause unpredictable results in case of class ties (hash map
order varies from vm to vm). I think it'd be better to make it an
ordered set (on the class name for example), then the ties would
always be broken in the same way. Alternatively, you can add another
condition in the if loop searching for the winning class (and
resolving the ties).

Just a thought.

D.

On Tue, Oct 23, 2012 at 6:32 PM,  <tomm...@apache.org> wrote:
> Author: tommaso
> Date: Tue Oct 23 16:32:05 2012
> New Revision: 1401343
>
> URL: http://svn.apache.org/viewvc?rev=1401343&view=rev
> Log:
> [LUCENE-4345] - adding @lucene.experimental annotation to kNN
>
> Modified:
>     
> lucene/dev/trunk/lucene/classification/src/java/org/apache/lucene/classification/KNearestNeighborClassifier.java
>
> Modified: 
> lucene/dev/trunk/lucene/classification/src/java/org/apache/lucene/classification/KNearestNeighborClassifier.java
> URL: 
> http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/classification/src/java/org/apache/lucene/classification/KNearestNeighborClassifier.java?rev=1401343&r1=1401342&r2=1401343&view=diff
> ==============================================================================
> --- 
> lucene/dev/trunk/lucene/classification/src/java/org/apache/lucene/classification/KNearestNeighborClassifier.java
>  (original)
> +++ 
> lucene/dev/trunk/lucene/classification/src/java/org/apache/lucene/classification/KNearestNeighborClassifier.java
>  Tue Oct 23 16:32:05 2012
> @@ -33,6 +33,7 @@ import java.util.Map;
>  /**
>   * A k-Nearest Neighbor classifier (see 
> <code>http://en.wikipedia.org/wiki/K-nearest_neighbors</code>) based
>   * on {@link MoreLikeThis}
> + * @lucene.experimental
>   */
>  public class KNearestNeighborClassifier implements Classifier {
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to