int -> float

This commit is contained in:
Michael Zhang 2021-09-07 10:46:27 -05:00
parent 2b79fcc041
commit fb31f850e7
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B

View file

@ -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);
}