org.mymedialite.correlation
Class Pearson
java.lang.Object
org.mymedialite.datatype.SymmetricMatrix<java.lang.Float>
org.mymedialite.correlation.CorrelationMatrix
org.mymedialite.correlation.RatingCorrelationMatrix
org.mymedialite.correlation.Pearson
- All Implemented Interfaces:
- IMatrix<java.lang.Float>
public class Pearson
- extends RatingCorrelationMatrix
Correlation class for Pearson correlation.
http://en.wikipedia.org/wiki/Pearson_correlation
Field Summary |
float |
shrinkage
Shrinkage parameter. |
Constructor Summary |
Pearson(int numEntities)
Constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
shrinkage
public float shrinkage
- Shrinkage parameter.
Pearson
public Pearson(int numEntities)
- Constructor. Create a Pearson correlation matrix.
- Parameters:
numEntities
- the number of entities
create
public static CorrelationMatrix create(IRatings ratings,
EntityType entityType,
float shrinkage)
- Create a Pearson correlation matrix from given data.
- Parameters:
ratings
- the ratings dataentityType
- the entity type, either USER or ITEMshrinkage
- a shrinkage parameter
- Returns:
- the complete Pearson correlation matrix
computeCorrelation
public static float computeCorrelation(IRatings ratings,
EntityType entityType,
int i,
int j,
float shrinkage)
- Compute correlations between two entities for given ratings.
- Parameters:
ratings
- the rating dataentityType
- the entity type, either USER or ITEMi
- the ID of first entityj
- the ID of second entityshrinkage
- the shrinkage parameter
computeCorrelations
public void computeCorrelations(IRatings ratings,
EntityType entityType)
- Compute correlations for given ratings.
- Specified by:
computeCorrelations
in class RatingCorrelationMatrix
- Parameters:
ratings
- the rating dataentityType
- the entity type, either USER or ITEM