public static ALSMatrixFactorization computeALS(String baseFilename, int nShards, int D, int iterations) throws IOException {
/* Run sharding (preprocessing) if the files do not exist yet */
FastSharder sharder = createSharder(baseFilename, nShards);
if (!new File(ChiFilenames.getFilenameIntervals(baseFilename, nShards)).exists() ||
!new File(baseFilename + ".matrixinfo").exists()) {
sharder.shard(new FileInputStream(new File(baseFilename)), FastSharder.GraphInputFormat.MATRIXMARKET);
} else {
logger.info("Found shards -- no need to preprocess");
}
/* Init */