Java Code Examples for it.unimi.dsi.fastutil.longs.LongArrayList#addAll()
The following examples show how to use
it.unimi.dsi.fastutil.longs.LongArrayList#addAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecentlyClickedPostFiltering.java From StreamingRec with Apache License 2.0 | 6 votes |
@Override public LongArrayList recommendInternal(ClickData clickData) { //filter out items that have not received at last one click in the last time frame //first, retrieve the recommendation results of the underlying algorithm LongArrayList rec = mainStrategy.recommendInternal(clickData); //create lists of filtered items and retained items LongArrayList filteredRec = new LongArrayList(); LongArrayList filteredRecNotMatch = new LongArrayList(); //iterate over the recommendation list of the underlying strategy for (int j = 0; j < rec.size(); j++) { long i = rec.getLong(j); //filter items whose last-clicked timestamp is too old if ((itemClickTime.containsKey(i)) && ((clickData.click.timestamp.getTime()-itemClickTime.get(i))<filterTime)) { filteredRec.add(i); } else if (fallback) { //if we have a fallback, add the filtered item to the fallback list filteredRecNotMatch.add(i); } } //merge the filtered list with the fallback list (empty in case fallback==false) filteredRec.addAll(filteredRecNotMatch); //return the filtered list return filteredRec; }
Example 2
Source File: PopularityPostFiltering.java From StreamingRec with Apache License 2.0 | 6 votes |
@Override public LongArrayList recommendInternal(ClickData clickData) { //filter out items with low overall click counts //first, retrieve the recommendation results of the underlying algorithm LongArrayList rec = mainStrategy.recommendInternal(clickData); //create lists of filtered items and retained items LongArrayList filteredRec = new LongArrayList(); LongArrayList filteredRecNotMatch = new LongArrayList(); //iterate over the recommendation list of the underlying strategy for (int j = 0; j < rec.size(); j++) { long i = rec.getLong(j); //filter items if they do not have enough clicks if ((itemClickCount.containsKey(i)) && (itemClickCount.get(i) >= minClickCount)) { filteredRec.add(i); } else if (fallback) { //if we have a fallback, add the filtered item to the fallback list filteredRecNotMatch.add(i); } } //merge the filtered list with the fallback list (empty in case fallback==false) filteredRec.addAll(filteredRecNotMatch); //return the filtered list return filteredRec; }
Example 3
Source File: RecencyPostFiltering.java From StreamingRec with Apache License 2.0 | 5 votes |
@Override public LongArrayList recommendInternal(ClickData clickData) { //filter out items that have been release too long ago //first, retrieve the recommendation results of the underlying algorithm LongArrayList rec = mainStrategy.recommendInternal(clickData); //create lists of filtered items and retained items LongArrayList filteredRec = new LongArrayList(); LongArrayList filteredRecNotMatch = new LongArrayList(); //iterate over the recommendation list of the underlying strategy for (int j = 0; j < rec.size(); j++) { long i = rec.getLong(j); // filter item based on the difference between the current (simulation) time and // the time of publication if ((clickData.click.timestamp.getTime() - timestampMap.get(i)) <= filterTime && (clickData.click.timestamp.getTime() - timestampMap.get(i)) > 0) { filteredRec.add(i); } else if (fallback) { //if we have a fallback, add the filtered item to the fallback list filteredRecNotMatch.add(i); } } //merge the filtered list with the fallback list (empty in case fallback==false) filteredRec.addAll(filteredRecNotMatch); //return the filtered list return filteredRec; }