public static void evaluate(Recommender recommender, DataModel model, int samples, RunningAverage tracker, string tag)
        {
            printHeader();
            IEnumerator <long> enumerator = recommender.getDataModel().getUserIDs();

            while (enumerator.MoveNext())
            {
                long current = enumerator.Current;
                List <RecommendedItem> items = recommender.recommend(current, model.getNumItems());
                PreferenceArray        prefs = model.getPreferencesFromUser(current);
                prefs.sortByValueReversed();
                FastIDSet modelSet = new FastIDSet();
                long      num2     = setBits(modelSet, items, samples);
                FastIDSet set2     = new FastIDSet();
                num2 = Math.Max(num2, setBits(set2, prefs, samples));
                int max = Math.Min(mask(modelSet, set2, num2), samples);
                if (max >= 2)
                {
                    long[] itemsL = getCommonItems(modelSet, items, max);
                    long[] itemsR = getCommonItems(modelSet, prefs, max);
                    double datum  = scoreCommonSubset(tag, current, samples, max, itemsL, itemsR);
                    tracker.addDatum(datum);
                }
            }
        }
        public FastIDSet getRelevantItemsIDs(long userID, int at, double relevanceThreshold, DataModel dataModel)
        {
            PreferenceArray array = dataModel.getPreferencesFromUser(userID);
            FastIDSet       set   = new FastIDSet(at);

            array.sortByValueReversed();
            for (int i = 0; (i < array.length()) && (set.size() < at); i++)
            {
                if (array.getValue(i) >= relevanceThreshold)
                {
                    set.add(array.getItemID(i));
                }
            }
            return(set);
        }