System.getProperty("model.als.iterations.convergenceThreshold",
Double.toString(AlternatingLeastSquares.DEFAULT_CONVERGENCE_THRESHOLD));
String maxIterationsString =
System.getProperty("model.iterations.max",
Integer.toString(AlternatingLeastSquares.DEFAULT_MAX_ITERATIONS));
MatrixFactorizer als = new AlternatingLeastSquares(rbyRow,
rbyColumn,
features,
Double.parseDouble(iterationsConvergenceString),
Integer.parseInt(maxIterationsString));
if (currentGeneration != null) {
FastByIDMap<float[]> previousY = currentGeneration.getY();
if (previousY != null) {
FastByIDMap<float[]> previousYClone;
Lock yLock = currentGeneration.getYLock().readLock();
yLock.lock();
try {
previousYClone = new FastByIDMap<float[]>(previousY.size());
for (FastByIDMap.MapEntry<float[]> entry : previousY.entrySet()) {
previousYClone.put(entry.getKey(), entry.getValue().clone());
}
} finally {
yLock.unlock();
}
als.setPreviousY(previousYClone);
}
}
try {
als.call();
log.info("Factorization complete");
} catch (ExecutionException ee) {
throw new IOException(ee.getCause());
} catch (InterruptedException ignored) {
log.warn("ALS computation was interrupted");