int -> float
This commit is contained in:
parent
2b79fcc041
commit
fb31f850e7
1 changed files with 3 additions and 2 deletions
|
@ -62,6 +62,7 @@ public class BasicAssociationModelProvider implements Provider<AssociationModel>
|
|||
for (Long2ObjectMap.Entry<LongSortedSet> xEntry: itemUsers.long2ObjectEntrySet()) {
|
||||
long xId = xEntry.getLongKey();
|
||||
LongSortedSet xUsers = xEntry.getValue();
|
||||
HashSet xSet = new HashSet(xUsers);
|
||||
|
||||
// set up a map to hold the scores for each 'y' item for this 'x'
|
||||
Long2DoubleMap itemScores = new Long2DoubleOpenHashMap();
|
||||
|
@ -72,9 +73,9 @@ public class BasicAssociationModelProvider implements Provider<AssociationModel>
|
|||
LongSortedSet yUsers = yEntry.getValue();
|
||||
|
||||
// TODO Compute P(Y & X) / P(X) and store in itemScores
|
||||
HashSet ySet = new HashSet(yUsers), xSet = new HashSet(xUsers);
|
||||
HashSet ySet = new HashSet(yUsers);
|
||||
ySet.retainAll(xSet);
|
||||
double p = ySet.size() / xSet.size();
|
||||
double p = 1.0 * ySet.size() / xUsers.size();
|
||||
itemScores.put(yId, p);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue