CFEngine API

org.recommender.algorithms
Class SimilarityWeight

java.lang.Object
  |
  +--org.recommender.algorithms.SimilarityWeight
All Implemented Interfaces:
java.lang.Comparable

public class SimilarityWeight
extends java.lang.Object
implements java.lang.Comparable

Represents the similarity between the active user (or item) and some neighbor user (or item). The ID of the active user (or item) is not actually stored; it is assumed that users of this class will keep track of that or infer it from context. Used by many nearest-neighbor algorithms of various varieties. This was once called "CorrelationCoeff", but its name was changed since it was being used for more than just correlations.

Author:
Daniel Lowd

Constructor Summary
SimilarityWeight(int neighborID, float weight)
          Construct a new SimilarityWeight.
 
Method Summary
 int compareTo(java.lang.Object o)
          Implementation of the Comparable interface.
 int getNeighborID()
          Returns the ID representing the neighbor we are considering.
 float getWeight()
          Returns the similarity weight for this neighbor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimilarityWeight

public SimilarityWeight(int neighborID,
                        float weight)
Construct a new SimilarityWeight.

Parameters:
neighborID - ID representing the neighbor in question.
weight - degree of similarity to neighbor
Method Detail

getNeighborID

public int getNeighborID()
Returns the ID representing the neighbor we are considering.


getWeight

public float getWeight()
Returns the similarity weight for this neighbor.


compareTo

public int compareTo(java.lang.Object o)
Implementation of the Comparable interface. Allows SimilarityWeights to be sorted by weight.

Specified by:
compareTo in interface java.lang.Comparable

CFEngine API

Copyright © 2003 - Oregon State University www.orst.edu