MyMediaLite  3.09
Static Public Member Functions
Extensions Class Reference

Extension methods for correlation matrices. More...

List of all members.

Static Public Member Functions

static IList< int > GetNearestNeighbors (this ICorrelationMatrix c, int entity_id, uint k)
 Get the k nearest neighbors of a given entity.
static IList< int > GetPositivelyCorrelatedEntities (this ICorrelationMatrix c, int entity_id)
 Get all entities that are positively correlated to an entity, sorted by correlation.
static void ReadAsymmetricCorrelationMatrix (this AsymmetricCorrelationMatrix correlation, StreamReader reader)
 Reads a AsymmetricCorrelationMatrix from the lines of a StreamReader.
static void ReadSymmetricCorrelationMatrix (this SymmetricCorrelationMatrix correlation, StreamReader reader)
 Reads a SymmetricCorrelationMatrix from the lines of a StreamReader.
static void SetZero (this ICorrelationMatrix c)
 Sets all values in a matrix to zero.
static double SumUp (this ICorrelationMatrix correlation, int entity_id, ICollection< int > entities, float q=1.0f)
 Sum up the correlations between a given entity and the entities in a collection.

Detailed Description

Extension methods for correlation matrices.


Member Function Documentation

static IList<int> GetNearestNeighbors ( this ICorrelationMatrix  c,
int  entity_id,
uint  k 
) [inline, static]

Get the k nearest neighbors of a given entity.

Parameters:
ca correlation matrix
entity_idthe numerical ID of the entity
kthe neighborhood size
Returns:
a sorted list containing the numerical IDs of the k nearest neighbors
static IList<int> GetPositivelyCorrelatedEntities ( this ICorrelationMatrix  c,
int  entity_id 
) [inline, static]

Get all entities that are positively correlated to an entity, sorted by correlation.

Parameters:
ca correlation matrix
entity_idthe entity ID
Returns:
a sorted list of all entities that are positively correlated to entitiy_id
static void ReadAsymmetricCorrelationMatrix ( this AsymmetricCorrelationMatrix  correlation,
StreamReader  reader 
) [inline, static]

Reads a AsymmetricCorrelationMatrix from the lines of a StreamReader.

In the first line, we expect to be the number of entities. All the other lines have the format

		      EntityID1 EntityID2 Correlation
		    

where EntityID1 and EntityID2 are non-negative integers and Correlation is a floating point number.

Parameters:
correlationa correlation matrix
readerthe StreamReader to read from
static void ReadSymmetricCorrelationMatrix ( this SymmetricCorrelationMatrix  correlation,
StreamReader  reader 
) [inline, static]

Reads a SymmetricCorrelationMatrix from the lines of a StreamReader.

In the first line, we expect to be the number of entities. All the other lines have the format

		      EntityID1 EntityID2 Correlation
		    

where EntityID1 and EntityID2 are non-negative integers and Correlation is a floating point number.

Parameters:
correlationa correlation matrix
readerthe StreamReader to read from
static void SetZero ( this ICorrelationMatrix  c) [inline, static]

Sets all values in a matrix to zero.

Parameters:
ca correlation matrix
static double SumUp ( this ICorrelationMatrix  correlation,
int  entity_id,
ICollection< int >  entities,
float  q = 1.0f 
) [inline, static]

Sum up the correlations between a given entity and the entities in a collection.

Parameters:
correlationthe correlation matrix
entity_idthe numerical ID of the entity
entitiesa collection containing the numerical IDs of the entities to compare to
qscore exponent
Returns:
the correlation sum

The documentation for this class was generated from the following file: