|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mymedialite.datatype.SymmetricMatrix<java.lang.Float>
org.mymedialite.correlation.CorrelationMatrix
public class CorrelationMatrix
Class for computing and storing correlations and similarities.
Field Summary | |
---|---|
protected int |
numEntities
Number of entities, e.g. |
Fields inherited from class org.mymedialite.datatype.SymmetricMatrix |
---|
data, dim |
Constructor Summary | |
---|---|
CorrelationMatrix(int numEntities)
Creates a CorrelationMatrix object for a given number of entities. |
Method Summary | |
---|---|
void |
addEntity(int entity_id)
Add an entity to the CorrelationMatrix by growing it to the requested size.. |
static CorrelationMatrix |
create(int numEntities)
Creates a correlation matrix. |
int[] |
getNearestNeighbors(int entity_id,
int k)
Get the k nearest neighbors of a given entity. |
IntList |
getPositivelyCorrelatedEntities(int entity_id)
Get all entities that are positively correlated to an entity, sorted by correlation. |
boolean |
isSymmetric()
True if the matrix is symmetric, false otherwise. |
static CorrelationMatrix |
readCorrelationMatrix(java.io.BufferedReader reader)
Creates a CorrelationMatrix from the lines of a StreamReader. |
double |
sumUp(int entity_id,
java.util.Collection<java.lang.Integer> entities)
Sum up the correlations between a given entity and the entities in a collection. |
void |
write(java.io.PrintWriter writer)
Write out the correlations to a StreamWriter. |
Methods inherited from class org.mymedialite.datatype.SymmetricMatrix |
---|
createMatrix, get, grow, init, numberOfColumns, numberOfRows, set, transpose |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int numEntities
Constructor Detail |
---|
public CorrelationMatrix(int numEntities)
numEntities
- number of entitiesMethod Detail |
---|
public boolean isSymmetric()
IMatrix
isSymmetric
in interface IMatrix<java.lang.Float>
isSymmetric
in class SymmetricMatrix<java.lang.Float>
public static CorrelationMatrix create(int numEntities)
numEntities
- the number of entities
public static CorrelationMatrix readCorrelationMatrix(java.io.BufferedReader reader) throws java.io.IOException
EntityID1 EntityID2 Correlationwhere EntityID1 and EntityID2 are non-negative integers and Correlation is a floating point number.
reader
- the StreamReader to read from
java.io.IOException
public void write(java.io.PrintWriter writer)
writer
- A public void addEntity(int entity_id)
entity_id
- the numerical ID of the entitypublic double sumUp(int entity_id, java.util.Collection<java.lang.Integer> entities)
entity_id
- the numerical ID of the entityentities
- a collection containing the numerical IDs of the entities to compare to
public IntList getPositivelyCorrelatedEntities(int entity_id)
entity_id
- the entity ID
public int[] getNearestNeighbors(int entity_id, int k)
entity_id
- the numerical ID of the entityk
- the neighborhood size
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |