RapidMiner

RapidMiner

Way to get list of the actual "nearest neighbors"?

Regular Contributor

Way to get list of the actual "nearest neighbors"?

When applying a NearestNeighbor model, is there a way to return the list nearest neighbor points for each predicted value?

In other words, if I run an existing KNN model to predict new values on 100 new examples, where K=5, I want to return the five nearest neighbor point matches for each example.  Something like


Example#  Neighbor    ID
1              1                AAA
1              2                BBB
1              3                CCC
1              4                DDD
1              5                EEE
2              1                FFF
2                2                CCC
2                3                GGG
2                4                AAA
2                5                HHH
3                1                JJJ
etc.


Even if it doesn't rank the neighbors, just getting a list of neighbors for each example row would be great.  Any suggestions are appreciated.

Keith
4 REPLIES
Moderator

Re: Way to get list of the actual "nearest neighbors"?

Hi Keith,

I do not know if this is possible with RapidMiner without checking, but I assume that it is at least not a one-operator-process .. Smiley Wink

However, I would start by using the [tt]ExampleSet2SimilarityExampleSet[/tt] operator in combination with some filtering techniques ... did you try that already?

Regards,
Tobias
Regular Contributor

Re: Way to get list of the actual "nearest neighbors"?

Thanks Tobias.  I wasn't aware of the similiarity operators.  That's almost exactly what I'm looking for.  Is there a version that can compute similarity distances using attribute weights?

Keith
Moderator

Re: Way to get list of the actual "nearest neighbors"?

Hi Keith,

since there is neither parameter to specify if attribute weights are considered nor an input indicating that attribute weights might be processed, I assume that attribute weights may not be considered. But in conjunction with numerical attribute weights, you may use the [tt]AttributeWeightsApplier[/tt] before using one of the similarity calculation operator.

Cheers,
Tobias
Regular Contributor

Re: Way to get list of the actual "nearest neighbors"?

Cool!  I will try that.  Thanks again.

Keith