Example usage for org.apache.mahout.cf.taste.impl.common FastByIDMap rehash

List of usage examples for org.apache.mahout.cf.taste.impl.common FastByIDMap rehash

Introduction

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

Prototype

public void rehash() 

Source Link

Usage

From source file:net.ufida.info.mahout.common.MemoryDiffStorage.java

License:Apache License

private void pruneInconsequentialDiffs() {
    // Go back and prune inconsequential diffs. "Inconsequential" means, here, only represented by one
    // data point, so possibly unreliable
    Iterator<Map.Entry<Long, FastByIDMap<RunningAverage>>> it1 = averageDiffs.entrySet().iterator();
    while (it1.hasNext()) {
        FastByIDMap<RunningAverage> map = it1.next().getValue();
        Iterator<Map.Entry<Long, RunningAverage>> it2 = map.entrySet().iterator();
        while (it2.hasNext()) {
            RunningAverage average = it2.next().getValue();
            if (average.getCount() <= 1) {
                it2.remove();/*  w w w.  j  a va 2 s . c  om*/
            }
        }
        if (map.isEmpty()) {
            it1.remove();
        } else {
            map.rehash();
        }
    }
    averageDiffs.rehash();
}