MyMediaLite
3.07
|
Extension methods for correlation matrices. More...
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. |
Extension methods for correlation matrices.
static IList<int> GetNearestNeighbors | ( | this ICorrelationMatrix | c, |
int | entity_id, | ||
uint | k | ||
) | [inline, static] |
Get the k nearest neighbors of a given entity.
c | a correlation matrix |
entity_id | the numerical ID of the entity |
k | the neighborhood size |
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.
c | a correlation matrix |
entity_id | the entity 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.
correlation | a correlation matrix |
reader | the 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.
correlation | a correlation matrix |
reader | the StreamReader to read from |
static void SetZero | ( | this ICorrelationMatrix | c | ) | [inline, static] |
Sets all values in a matrix to zero.
c | a 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.
correlation | the correlation matrix |
entity_id | the numerical ID of the entity |
entities | a collection containing the numerical IDs of the entities to compare to |
q | score exponent |