public abstract class UserSimilarityMetric extends Object implements Partible<User>
When the execution of the similarity metric is completed, the similarity of each user with respect to another one can be retrieved using the getSimilarities(int userIndex) method.
Modifier and Type | Field and Description |
---|---|
protected DataModel |
datamodel
DataModel for which de similarities must be computed
|
protected double[][] |
similarities
Matrix that contains the similarity between each pair of users
|
Constructor and Description |
---|
UserSimilarityMetric() |
Modifier and Type | Method and Description |
---|---|
void |
afterRun()
Is executed once after execute the method exec.
|
void |
beforeRun()
Is executed once before execute the method 'exec'.
|
double[] |
getSimilarities(int userIndex)
Returns the similarity array of an user.
|
void |
run(User user)
Is executed once for each object in the array of objects passed as parameter in the exec method
of the Parallelizer class.
|
void |
setDatamodel(DataModel datamodel)
Sets the DataModel for which the similarity are going to be computed
|
abstract double |
similarity(User user,
User otherUser)
This method must returns the similarity between two users.
|
String |
toString() |
protected DataModel datamodel
protected double[][] similarities
public void setDatamodel(DataModel datamodel)
datamodel
- DataModel instancepublic double[] getSimilarities(int userIndex)
userIndex
- Index of the userpublic abstract double similarity(User user, User otherUser)
If two users do not have a similarity value, the method must return Double.NEGATIVE_INFINITY.
The value returned by this method should be higher the greater the similarity between users.
user
- A userotherUser
- Other userpublic void beforeRun()
Partible
public void run(User user)
Partible
public void afterRun()
Partible
Copyright © 2020. All rights reserved.