Example usage for org.apache.mahout.cf.taste.impl.common FastIDSet removeAll

List of usage examples for org.apache.mahout.cf.taste.impl.common FastIDSet removeAll

Introduction

In this page you can find the example usage for org.apache.mahout.cf.taste.impl.common FastIDSet removeAll.

Prototype

public boolean removeAll(FastIDSet c) 

Source Link

Usage

From source file:com.buddycloud.channeldirectory.search.handler.common.mahout.ChannelRecommender.java

License:Apache License

private int getPreferenceCount(long theUserId) throws TasteException {
    FastIDSet possibleItemIDs = new FastIDSet();
    long[] theNeighborhood = userNeighborhood.getUserNeighborhood(theUserId);
    DataModel dataModel = recommenderDataModel.getDataModel();

    for (long userID : theNeighborhood) {
        possibleItemIDs.addAll(dataModel.getItemIDsFromUser(userID));
    }/*w  w w .j av  a  2s. com*/
    possibleItemIDs.removeAll(dataModel.getItemIDsFromUser(theUserId));

    return possibleItemIDs.size();
}

From source file:de.unima.dws.webmining.rs.recommender.AvgUserPrefAdaptedUserBasedRecommender.java

License:Apache License

protected FastIDSet getAllOtherItems(long[] theNeighborhood, long theUserID) throws TasteException {
    DataModel dataModel = getDataModel();
    FastIDSet possibleItemIDs = new FastIDSet();
    for (long userID : theNeighborhood) {
        possibleItemIDs.addAll(dataModel.getItemIDsFromUser(userID));
    }//from w  ww.j  a  v a  2  s .  com
    possibleItemIDs.removeAll(dataModel.getItemIDsFromUser(theUserID));
    return possibleItemIDs;
}

From source file:io.prediction.engines.base.mahout.AllValidItemsCandidateItemsStrategy.java

License:Apache License

protected FastIDSet doGetCandidateItemsInternal(long[] validItemIDs, long[] seenItemIDs) throws TasteException {
    FastIDSet possibleItemsIDs = new FastIDSet();
    possibleItemsIDs.addAll(this.validItemIDs);

    if (seenItemIDs != null)
        possibleItemsIDs.removeAll(seenItemIDs);

    return possibleItemsIDs;
}

From source file:org.plista.kornakapi.core.recommender.CachingAllUnknownItemsCandidateItemsStrategy.java

License:Apache License

@Override
public FastIDSet getCandidateItems(long userID, PreferenceArray preferencesFromUser, DataModel dataModel)
        throws TasteException {
    FastIDSet possibleItemIDs = allItemIDs.clone();
    possibleItemIDs.removeAll(preferencesFromUser.getIDs());
    return possibleItemIDs;
}