uHat = SSVDHelper.drmLoadAsDense(fs, uHatPath, conf); vRowWritable = new VectorWritable(vRow); sValues = SSVDHelper.loadVector(sigmaPath, conf); SSVDSolver.OutputScalingEnum outputScaling = SSVDSolver.OutputScalingEnum.valueOf(context.getConfiguration() break; case HALFSIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); sValues.assign(Functions.SQRT); break; xi = SSVDHelper.loadAndSumUpVectors(new Path(xiPathStr), conf); sq = SSVDHelper.loadAndSumUpVectors(new Path(conf.get(PROP_SQ_PATH)), conf);
@Override protected void setup(Context context) throws IOException, InterruptedException { super.setup(context); Path uHatPath = new Path(context.getConfiguration().get(PROP_UHAT_PATH)); Path sigmaPath = new Path(context.getConfiguration().get(PROP_SIGMA_PATH)); FileSystem fs = FileSystem.get(uHatPath.toUri(), context.getConfiguration()); uHat = SSVDHelper.drmLoadAsDense(fs, uHatPath, context.getConfiguration()); // since uHat is (k+p) x (k+p) kp = uHat.columnSize(); k = context.getConfiguration().getInt(PROP_K, kp); uRow = new DenseVector(k); uRowWritable = new VectorWritable(uRow); SSVDSolver.OutputScalingEnum outputScaling = SSVDSolver.OutputScalingEnum.valueOf(context.getConfiguration() .get(PROP_OUTPUT_SCALING)); switch (outputScaling) { case SIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); break; case HALFSIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); sValues.assign(Functions.SQRT); break; default: } }
try { Class<? extends Writable> labelType = SSVDHelper.sniffInputLabelType(inputPath, conf); FileSystem fs = FileSystem.get(conf); Vector xi = SSVDHelper.loadAndSumUpVectors(pcaMeanPath, conf); if (xi == null) { throw new IOException(String.format("unable to load mean path xi from %s.", Vector s_b0 = omega.mutlithreadedTRightMultiply(xi); SSVDHelper.saveVector(s_b0, sbPath = new Path(pcaBasePath, "somega.seq"), conf); SSVDHelper.loadAndSumUpperTriangularMatricesAsSymmetric(new Path(btPath, BtJob.OUTPUT_BBT + "-*"), conf); Vector sq = SSVDHelper.loadAndSumUpVectors(sqPath, conf); Vector sb = SSVDHelper.loadAndSumUpVectors(sbPath, conf); Matrix mC = sq.cross(sb); SSVDHelper.saveVector(svalues, svPath = new Path(svPath, "svalues.seq"), conf);
fs.copyFromLocalFile(aLocPath, aPath); Path xiPath = new Path(tempDirPath, "xi/xi.seq"); SSVDHelper.saveVector(xi, xiPath, conf); Matrix a = SSVDHelper.drmLoadAsDense(fs, aPath, conf); SSVDHelper.drmLoadAsDense(fs, new Path(svdOutPath, "Bt-job/" + BtJob.OUTPUT_Q + "-*"), conf); for (Iterator<Pair<Writable, Vector>> iter = SSVDHelper.drmIterator(fs, new Path(ssvd.getuSigmaPath()+"/*"), conf,
/** * Load multiple upper triangular matrices and sum them up. * * @return the sum of upper triangular inputs. */ public static DenseSymmetricMatrix loadAndSumUpperTriangularMatricesAsSymmetric(Path glob, Configuration conf) throws IOException { Vector v = loadAndSumUpVectors(glob, conf); return v == null ? null : new DenseSymmetricMatrix(v); }
try { List<double[]> denseData = new ArrayList<double[]>(); for (Iterator<Pair<Writable, Vector>> iter = drmIterator(fs, glob, conf, closeables); iter.hasNext(); ) { Pair<Writable, Vector> p = iter.next();
SSVDHelper.saveVector(svalues, getOutputPath("sigma"), conf);
SSVDHelper.drmLoadAsDense(fs, new Path(svdOutPath, "Bt-job/" + BtJob.OUTPUT_Q + "-*"), conf); SSVDHelper.drmLoadAsDense(fs, new Path(svdOutPath, "U/*"), conf); SSVDHelper.drmLoadAsDense(fs, new Path(svdOutPath, "V/*"), conf);
try { Class<? extends Writable> labelType = SSVDHelper.sniffInputLabelType(inputPath, conf); FileSystem fs = FileSystem.get(conf); Vector xi = SSVDHelper.loadAndSumUpVectors(pcaMeanPath, conf); if (xi == null) { throw new IOException(String.format("unable to load mean path xi from %s.", Vector s_b0 = omega.mutlithreadedTRightMultiply(xi); SSVDHelper.saveVector(s_b0, sbPath = new Path(pcaBasePath, "somega.seq"), conf); SSVDHelper.loadAndSumUpperTriangularMatricesAsSymmetric(new Path(btPath, BtJob.OUTPUT_BBT + "-*"), conf); Vector sq = SSVDHelper.loadAndSumUpVectors(sqPath, conf); Vector sb = SSVDHelper.loadAndSumUpVectors(sbPath, conf); Matrix mC = sq.cross(sb); SSVDHelper.saveVector(svalues, svPath = new Path(svPath, "svalues.seq"), conf);
@Override protected void setup(Context context) throws IOException, InterruptedException { super.setup(context); Path uHatPath = new Path(context.getConfiguration().get(PROP_UHAT_PATH)); Path sigmaPath = new Path(context.getConfiguration().get(PROP_SIGMA_PATH)); FileSystem fs = FileSystem.get(uHatPath.toUri(), context.getConfiguration()); uHat = SSVDHelper.drmLoadAsDense(fs, uHatPath, context.getConfiguration()); // since uHat is (k+p) x (k+p) kp = uHat.columnSize(); k = context.getConfiguration().getInt(PROP_K, kp); uRow = new DenseVector(k); uRowWritable = new VectorWritable(uRow); SSVDSolver.OutputScalingEnum outputScaling = SSVDSolver.OutputScalingEnum.valueOf(context.getConfiguration() .get(PROP_OUTPUT_SCALING)); switch (outputScaling) { case SIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); break; case HALFSIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); sValues.assign(Functions.SQRT); break; default: } }
/** * Load multiple upper triangular matrices and sum them up. * * @return the sum of upper triangular inputs. */ public static DenseSymmetricMatrix loadAndSumUpperTriangularMatricesAsSymmetric(Path glob, Configuration conf) throws IOException { Vector v = loadAndSumUpVectors(glob, conf); return v == null ? null : new DenseSymmetricMatrix(v); }
try { List<double[]> denseData = new ArrayList<double[]>(); for (Iterator<Pair<Writable, Vector>> iter = drmIterator(fs, glob, conf, closeables); iter.hasNext(); ) { Pair<Writable, Vector> p = iter.next();
SSVDHelper.saveVector(svalues, getOutputPath("sigma"), conf);
DenseMatrix a = SSVDHelper.drmLoadAsDense(fs, aPath, conf); SSVDHelper.drmLoadAsDense(fs, new Path(svdOutPath, "Bt-job/" + BtJob.OUTPUT_Q + "-*"), conf);
try { Class<? extends Writable> labelType = SSVDHelper.sniffInputLabelType(inputPath, conf); FileSystem fs = FileSystem.get(conf); Vector xi = SSVDHelper.loadAndSumUpVectors(pcaMeanPath, conf); if (xi == null) { throw new IOException(String.format("unable to load mean path xi from %s.", Vector s_b0 = omega.mutlithreadedTRightMultiply(xi); SSVDHelper.saveVector(s_b0, sbPath = new Path(pcaBasePath, "somega.seq"), conf); SSVDHelper.loadAndSumUpperTriangularMatricesAsSymmetric(new Path(btPath, BtJob.OUTPUT_BBT + "-*"), conf); Vector sq = SSVDHelper.loadAndSumUpVectors(sqPath, conf); Vector sb = SSVDHelper.loadAndSumUpVectors(sbPath, conf); Matrix mC = sq.cross(sb); SSVDHelper.saveVector(svalues, svPath = new Path(svPath, "svalues.seq"), conf);
uHat = SSVDHelper.drmLoadAsDense(fs, uHatPath, conf); vRowWritable = new VectorWritable(vRow); sValues = SSVDHelper.loadVector(sigmaPath, conf); SSVDSolver.OutputScalingEnum outputScaling = SSVDSolver.OutputScalingEnum.valueOf(context.getConfiguration() break; case HALFSIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); sValues.assign(Functions.SQRT); break; xi = SSVDHelper.loadAndSumUpVectors(new Path(xiPathStr), conf); sq = SSVDHelper.loadAndSumUpVectors(new Path(conf.get(PROP_SQ_PATH)), conf);
@Override protected void setup(Context context) throws IOException, InterruptedException { super.setup(context); Path uHatPath = new Path(context.getConfiguration().get(PROP_UHAT_PATH)); Path sigmaPath = new Path(context.getConfiguration().get(PROP_SIGMA_PATH)); FileSystem fs = FileSystem.get(uHatPath.toUri(), context.getConfiguration()); uHat = SSVDHelper.drmLoadAsDense(fs, uHatPath, context.getConfiguration()); // since uHat is (k+p) x (k+p) kp = uHat.columnSize(); k = context.getConfiguration().getInt(PROP_K, kp); uRow = new DenseVector(k); uRowWritable = new VectorWritable(uRow); SSVDSolver.OutputScalingEnum outputScaling = SSVDSolver.OutputScalingEnum.valueOf(context.getConfiguration() .get(PROP_OUTPUT_SCALING)); switch (outputScaling) { case SIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); break; case HALFSIGMA: sValues = SSVDHelper.loadVector(sigmaPath, context.getConfiguration()); sValues.assign(Functions.SQRT); break; default: } }
/** * Load multiple upper triangular matrices and sum them up. * * @return the sum of upper triangular inputs. */ public static DenseSymmetricMatrix loadAndSumUpperTriangularMatricesAsSymmetric(Path glob, Configuration conf) throws IOException { Vector v = loadAndSumUpVectors(glob, conf); return v == null ? null : new DenseSymmetricMatrix(v); }
try { List<double[]> denseData = new ArrayList<>(); for (Iterator<Pair<Writable, Vector>> iter = drmIterator(fs, glob, conf, closeables); iter.hasNext(); ) { Pair<Writable, Vector> p = iter.next();
SSVDHelper.saveVector(svalues, getOutputPath("sigma"), conf);